
software.amazon.awssdk.services.appmesh.model.VirtualServiceRef Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.appmesh.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An object that represents a virtual service returned by a list operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class VirtualServiceRef implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(VirtualServiceRef::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(VirtualServiceRef::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastUpdatedAt").getter(getter(VirtualServiceRef::lastUpdatedAt)).setter(setter(Builder::lastUpdatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedAt").build()).build();
private static final SdkField MESH_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("meshName").getter(getter(VirtualServiceRef::meshName)).setter(setter(Builder::meshName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("meshName").build()).build();
private static final SdkField MESH_OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("meshOwner").getter(getter(VirtualServiceRef::meshOwner)).setter(setter(Builder::meshOwner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("meshOwner").build()).build();
private static final SdkField RESOURCE_OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resourceOwner").getter(getter(VirtualServiceRef::resourceOwner)).setter(setter(Builder::resourceOwner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceOwner").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.LONG).memberName("version")
.getter(getter(VirtualServiceRef::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField VIRTUAL_SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("virtualServiceName").getter(getter(VirtualServiceRef::virtualServiceName))
.setter(setter(Builder::virtualServiceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("virtualServiceName").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, CREATED_AT_FIELD,
LAST_UPDATED_AT_FIELD, MESH_NAME_FIELD, MESH_OWNER_FIELD, RESOURCE_OWNER_FIELD, VERSION_FIELD,
VIRTUAL_SERVICE_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final Instant createdAt;
private final Instant lastUpdatedAt;
private final String meshName;
private final String meshOwner;
private final String resourceOwner;
private final Long version;
private final String virtualServiceName;
private VirtualServiceRef(BuilderImpl builder) {
this.arn = builder.arn;
this.createdAt = builder.createdAt;
this.lastUpdatedAt = builder.lastUpdatedAt;
this.meshName = builder.meshName;
this.meshOwner = builder.meshOwner;
this.resourceOwner = builder.resourceOwner;
this.version = builder.version;
this.virtualServiceName = builder.virtualServiceName;
}
/**
*
* The full Amazon Resource Name (ARN) for the virtual service.
*
*
* @return The full Amazon Resource Name (ARN) for the virtual service.
*/
public final String arn() {
return arn;
}
/**
*
* The Unix epoch timestamp in seconds for when the resource was created.
*
*
* @return The Unix epoch timestamp in seconds for when the resource was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* The Unix epoch timestamp in seconds for when the resource was last updated.
*
*
* @return The Unix epoch timestamp in seconds for when the resource was last updated.
*/
public final Instant lastUpdatedAt() {
return lastUpdatedAt;
}
/**
*
* The name of the service mesh that the virtual service resides in.
*
*
* @return The name of the service mesh that the virtual service resides in.
*/
public final String meshName() {
return meshName;
}
/**
*
* The Amazon Web Services IAM account ID of the service mesh owner. If the account ID is not your own, then it's
* the ID of the account that shared the mesh with your account. For more information about mesh sharing, see Working with shared meshes.
*
*
* @return The Amazon Web Services IAM account ID of the service mesh owner. If the account ID is not your own, then
* it's the ID of the account that shared the mesh with your account. For more information about mesh
* sharing, see Working with
* shared meshes.
*/
public final String meshOwner() {
return meshOwner;
}
/**
*
* The Amazon Web Services IAM account ID of the resource owner. If the account ID is not your own, then it's the ID
* of the mesh owner or of another account that the mesh is shared with. For more information about mesh sharing,
* see Working with shared meshes.
*
*
* @return The Amazon Web Services IAM account ID of the resource owner. If the account ID is not your own, then
* it's the ID of the mesh owner or of another account that the mesh is shared with. For more information
* about mesh sharing, see Working with shared meshes.
*/
public final String resourceOwner() {
return resourceOwner;
}
/**
*
* The version of the resource. Resources are created at version 1, and this version is incremented each time that
* they're updated.
*
*
* @return The version of the resource. Resources are created at version 1, and this version is incremented each
* time that they're updated.
*/
public final Long version() {
return version;
}
/**
*
* The name of the virtual service.
*
*
* @return The name of the virtual service.
*/
public final String virtualServiceName() {
return virtualServiceName;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt());
hashCode = 31 * hashCode + Objects.hashCode(meshName());
hashCode = 31 * hashCode + Objects.hashCode(meshOwner());
hashCode = 31 * hashCode + Objects.hashCode(resourceOwner());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(virtualServiceName());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof VirtualServiceRef)) {
return false;
}
VirtualServiceRef other = (VirtualServiceRef) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(lastUpdatedAt(), other.lastUpdatedAt()) && Objects.equals(meshName(), other.meshName())
&& Objects.equals(meshOwner(), other.meshOwner()) && Objects.equals(resourceOwner(), other.resourceOwner())
&& Objects.equals(version(), other.version()) && Objects.equals(virtualServiceName(), other.virtualServiceName());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("VirtualServiceRef").add("Arn", arn()).add("CreatedAt", createdAt())
.add("LastUpdatedAt", lastUpdatedAt()).add("MeshName", meshName()).add("MeshOwner", meshOwner())
.add("ResourceOwner", resourceOwner()).add("Version", version()).add("VirtualServiceName", virtualServiceName())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "lastUpdatedAt":
return Optional.ofNullable(clazz.cast(lastUpdatedAt()));
case "meshName":
return Optional.ofNullable(clazz.cast(meshName()));
case "meshOwner":
return Optional.ofNullable(clazz.cast(meshOwner()));
case "resourceOwner":
return Optional.ofNullable(clazz.cast(resourceOwner()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "virtualServiceName":
return Optional.ofNullable(clazz.cast(virtualServiceName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function