All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.proton.model.Service Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Proton module holds the client classes that are used for communicating with Proton.

There is a newer version: 2.28.3
Show newest version
/*
 * 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 getter(Function g) { return obj -> g.apply((Service) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the service. *

* * @param arn * The Amazon Resource Name (ARN) of the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The name of the code repository branch that holds the code that's deployed in Proton. *

* * @param branchName * The name of the code repository branch that holds the code that's deployed in Proton. * @return Returns a reference to this object so that method calls can be chained together. */ Builder branchName(String branchName); /** *

* The time when the service was created. *

* * @param createdAt * The time when the service was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdAt(Instant createdAt); /** *

* A description of the service. *

* * @param description * A description of the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The time when the service was last modified. *

* * @param lastModifiedAt * The time when the service was last modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedAt(Instant lastModifiedAt); /** *

* The name of the service. *

* * @param name * The name of the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The service pipeline detail data. *

* * @param pipeline * The service pipeline detail data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pipeline(ServicePipeline pipeline); /** *

* The service pipeline detail data. *

* This is a convenience method that creates an instance of the {@link ServicePipeline.Builder} avoiding the * need to create one manually via {@link ServicePipeline#builder()}. * *

* When the {@link Consumer} completes, {@link ServicePipeline.Builder#build()} is called immediately and its * result is passed to {@link #pipeline(ServicePipeline)}. * * @param pipeline * a consumer that will call methods on {@link ServicePipeline.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #pipeline(ServicePipeline) */ default Builder pipeline(Consumer pipeline) { return pipeline(ServicePipeline.builder().applyMutation(pipeline).build()); } /** *

* The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. *

* * @param repositoryConnectionArn * 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 Returns a reference to this object so that method calls can be chained together. */ Builder repositoryConnectionArn(String repositoryConnectionArn); /** *

* The ID of the source code repository. *

* * @param repositoryId * The ID of the source code repository. * @return Returns a reference to this object so that method calls can be chained together. */ Builder repositoryId(String repositoryId); /** *

* The formatted specification that defines the service. *

* * @param spec * The formatted specification that defines the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder spec(String spec); /** *

* The status of the service. *

* * @param status * The status of the service. * @see ServiceStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ServiceStatus */ Builder status(String status); /** *

* The status of the service. *

* * @param status * The status of the service. * @see ServiceStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ServiceStatus */ Builder status(ServiceStatus status); /** *

* A service status message. *

* * @param statusMessage * A service status message. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusMessage(String statusMessage); /** *

* The name of the service template. *

* * @param templateName * The name of the service template. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateName(String templateName); } static final class BuilderImpl implements Builder { private String arn; private String branchName; private Instant createdAt; private String description; private Instant lastModifiedAt; private String name; private ServicePipeline pipeline; private String repositoryConnectionArn; private String repositoryId; private String spec; private String status; private String statusMessage; private String templateName; private BuilderImpl() { } private BuilderImpl(Service model) { arn(model.arn); branchName(model.branchName); createdAt(model.createdAt); description(model.description); lastModifiedAt(model.lastModifiedAt); name(model.name); pipeline(model.pipeline); repositoryConnectionArn(model.repositoryConnectionArn); repositoryId(model.repositoryId); spec(model.spec); status(model.status); statusMessage(model.statusMessage); templateName(model.templateName); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getBranchName() { return branchName; } public final void setBranchName(String branchName) { this.branchName = branchName; } @Override public final Builder branchName(String branchName) { this.branchName = branchName; return this; } public final Instant getCreatedAt() { return createdAt; } public final void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } @Override public final Builder createdAt(Instant createdAt) { this.createdAt = createdAt; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final Instant getLastModifiedAt() { return lastModifiedAt; } public final void setLastModifiedAt(Instant lastModifiedAt) { this.lastModifiedAt = lastModifiedAt; } @Override public final Builder lastModifiedAt(Instant lastModifiedAt) { this.lastModifiedAt = lastModifiedAt; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final ServicePipeline.Builder getPipeline() { return pipeline != null ? pipeline.toBuilder() : null; } public final void setPipeline(ServicePipeline.BuilderImpl pipeline) { this.pipeline = pipeline != null ? pipeline.build() : null; } @Override public final Builder pipeline(ServicePipeline pipeline) { this.pipeline = pipeline; return this; } public final String getRepositoryConnectionArn() { return repositoryConnectionArn; } public final void setRepositoryConnectionArn(String repositoryConnectionArn) { this.repositoryConnectionArn = repositoryConnectionArn; } @Override public final Builder repositoryConnectionArn(String repositoryConnectionArn) { this.repositoryConnectionArn = repositoryConnectionArn; return this; } public final String getRepositoryId() { return repositoryId; } public final void setRepositoryId(String repositoryId) { this.repositoryId = repositoryId; } @Override public final Builder repositoryId(String repositoryId) { this.repositoryId = repositoryId; return this; } public final String getSpec() { return spec; } public final void setSpec(String spec) { this.spec = spec; } @Override public final Builder spec(String spec) { this.spec = spec; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(ServiceStatus status) { this.status(status == null ? null : status.toString()); return this; } public final String getStatusMessage() { return statusMessage; } public final void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } @Override public final Builder statusMessage(String statusMessage) { this.statusMessage = statusMessage; return this; } public final String getTemplateName() { return templateName; } public final void setTemplateName(String templateName) { this.templateName = templateName; } @Override public final Builder templateName(String templateName) { this.templateName = templateName; return this; } @Override public Service build() { return new Service(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy