software.amazon.awssdk.services.proton.model.Service Maven / Gradle / Ivy
Show all versions of proton Show documentation
/*
* 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.proton.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.Consumer;
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;
/**
*
* Detailed data of an Proton service resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Service implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(Service::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField BRANCH_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("branchName").getter(getter(Service::branchName)).setter(setter(Builder::branchName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("branchName").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(Service::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(Service::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField LAST_MODIFIED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedAt").getter(getter(Service::lastModifiedAt)).setter(setter(Builder::lastModifiedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedAt").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(Service::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField PIPELINE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("pipeline").getter(getter(Service::pipeline)).setter(setter(Builder::pipeline))
.constructor(ServicePipeline::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("pipeline").build()).build();
private static final SdkField REPOSITORY_CONNECTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("repositoryConnectionArn").getter(getter(Service::repositoryConnectionArn))
.setter(setter(Builder::repositoryConnectionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("repositoryConnectionArn").build())
.build();
private static final SdkField REPOSITORY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("repositoryId").getter(getter(Service::repositoryId)).setter(setter(Builder::repositoryId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("repositoryId").build()).build();
private static final SdkField SPEC_FIELD = SdkField. builder(MarshallingType.STRING).memberName("spec")
.getter(getter(Service::spec)).setter(setter(Builder::spec))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("spec").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(Service::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusMessage").getter(getter(Service::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusMessage").build()).build();
private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("templateName").getter(getter(Service::templateName)).setter(setter(Builder::templateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, BRANCH_NAME_FIELD,
CREATED_AT_FIELD, DESCRIPTION_FIELD, LAST_MODIFIED_AT_FIELD, NAME_FIELD, PIPELINE_FIELD,
REPOSITORY_CONNECTION_ARN_FIELD, REPOSITORY_ID_FIELD, SPEC_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD,
TEMPLATE_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String branchName;
private final Instant createdAt;
private final String description;
private final Instant lastModifiedAt;
private final String name;
private final ServicePipeline pipeline;
private final String repositoryConnectionArn;
private final String repositoryId;
private final String spec;
private final String status;
private final String statusMessage;
private final String templateName;
private Service(BuilderImpl builder) {
this.arn = builder.arn;
this.branchName = builder.branchName;
this.createdAt = builder.createdAt;
this.description = builder.description;
this.lastModifiedAt = builder.lastModifiedAt;
this.name = builder.name;
this.pipeline = builder.pipeline;
this.repositoryConnectionArn = builder.repositoryConnectionArn;
this.repositoryId = builder.repositoryId;
this.spec = builder.spec;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.templateName = builder.templateName;
}
/**
*
* The Amazon Resource Name (ARN) of the service.
*
*
* @return The Amazon Resource Name (ARN) of the service.
*/
public final String arn() {
return arn;
}
/**
*
* The name of the code repository branch that holds the code that's deployed in Proton.
*
*
* @return The name of the code repository branch that holds the code that's deployed in Proton.
*/
public final String branchName() {
return branchName;
}
/**
*
* The time when the service was created.
*
*
* @return The time when the service was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* A description of the service.
*
*
* @return A description of the service.
*/
public final String description() {
return description;
}
/**
*
* The time when the service was last modified.
*
*
* @return The time when the service was last modified.
*/
public final Instant lastModifiedAt() {
return lastModifiedAt;
}
/**
*
* The name of the service.
*
*
* @return The name of the service.
*/
public final String name() {
return name;
}
/**
*
* The service pipeline detail data.
*
*
* @return The service pipeline detail data.
*/
public final ServicePipeline pipeline() {
return pipeline;
}
/**
*
* The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide.
*
*
* @return The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide.
*/
public final String repositoryConnectionArn() {
return repositoryConnectionArn;
}
/**
*
* The ID of the source code repository.
*
*
* @return The ID of the source code repository.
*/
public final String repositoryId() {
return repositoryId;
}
/**
*
* The formatted specification that defines the service.
*
*
* @return The formatted specification that defines the service.
*/
public final String spec() {
return spec;
}
/**
*
* The status of the service.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ServiceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the service.
* @see ServiceStatus
*/
public final ServiceStatus status() {
return ServiceStatus.fromValue(status);
}
/**
*
* The status of the service.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ServiceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the service.
* @see ServiceStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A service status message.
*
*
* @return A service status message.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* The name of the service template.
*
*
* @return The name of the service template.
*/
public final String templateName() {
return templateName;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(branchName());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedAt());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(pipeline());
hashCode = 31 * hashCode + Objects.hashCode(repositoryConnectionArn());
hashCode = 31 * hashCode + Objects.hashCode(repositoryId());
hashCode = 31 * hashCode + Objects.hashCode(spec());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(templateName());
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 Service)) {
return false;
}
Service other = (Service) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(branchName(), other.branchName())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(description(), other.description())
&& Objects.equals(lastModifiedAt(), other.lastModifiedAt()) && Objects.equals(name(), other.name())
&& Objects.equals(pipeline(), other.pipeline())
&& Objects.equals(repositoryConnectionArn(), other.repositoryConnectionArn())
&& Objects.equals(repositoryId(), other.repositoryId()) && Objects.equals(spec(), other.spec())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(templateName(), other.templateName());
}
/**
* 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("Service").add("Arn", arn()).add("BranchName", branchName()).add("CreatedAt", createdAt())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("LastModifiedAt", lastModifiedAt()).add("Name", name()).add("Pipeline", pipeline())
.add("RepositoryConnectionArn", repositoryConnectionArn()).add("RepositoryId", repositoryId())
.add("Spec", spec() == null ? null : "*** Sensitive Data Redacted ***").add("Status", statusAsString())
.add("StatusMessage", statusMessage() == null ? null : "*** Sensitive Data Redacted ***")
.add("TemplateName", templateName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "branchName":
return Optional.ofNullable(clazz.cast(branchName()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "lastModifiedAt":
return Optional.ofNullable(clazz.cast(lastModifiedAt()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "pipeline":
return Optional.ofNullable(clazz.cast(pipeline()));
case "repositoryConnectionArn":
return Optional.ofNullable(clazz.cast(repositoryConnectionArn()));
case "repositoryId":
return Optional.ofNullable(clazz.cast(repositoryId()));
case "spec":
return Optional.ofNullable(clazz.cast(spec()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "templateName":
return Optional.ofNullable(clazz.cast(templateName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function