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

software.amazon.awssdk.services.apigatewayv2.model.Deployment Maven / Gradle / Ivy

/*
 * Copyright 2014-2019 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.apigatewayv2.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.core.traits.TimestampFormatTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An immutable representation of an API that can be called by users. A Deployment must be associated with a Stage for * it to be callable over the internet. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Deployment implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CREATED_DATE_FIELD = SdkField . builder(MarshallingType.INSTANT) .getter(getter(Deployment::createdDate)) .setter(setter(Builder::createdDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdDate").build(), TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build(); private static final SdkField DEPLOYMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Deployment::deploymentId)).setter(setter(Builder::deploymentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentId").build()).build(); private static final SdkField DEPLOYMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Deployment::deploymentStatusAsString)).setter(setter(Builder::deploymentStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentStatus").build()).build(); private static final SdkField DEPLOYMENT_STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Deployment::deploymentStatusMessage)).setter(setter(Builder::deploymentStatusMessage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentStatusMessage").build()) .build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Deployment::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATED_DATE_FIELD, DEPLOYMENT_ID_FIELD, DEPLOYMENT_STATUS_FIELD, DEPLOYMENT_STATUS_MESSAGE_FIELD, DESCRIPTION_FIELD)); private static final long serialVersionUID = 1L; private final Instant createdDate; private final String deploymentId; private final String deploymentStatus; private final String deploymentStatusMessage; private final String description; private Deployment(BuilderImpl builder) { this.createdDate = builder.createdDate; this.deploymentId = builder.deploymentId; this.deploymentStatus = builder.deploymentStatus; this.deploymentStatusMessage = builder.deploymentStatusMessage; this.description = builder.description; } /** *

* The date and time when the Deployment resource was created. *

* * @return The date and time when the Deployment resource was created. */ public Instant createdDate() { return createdDate; } /** *

* The identifier for the deployment. *

* * @return The identifier for the deployment. */ public String deploymentId() { return deploymentId; } /** *

* The status of the deployment: PENDING, FAILED, or SUCCEEDED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentStatus} * will return {@link DeploymentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #deploymentStatusAsString}. *

* * @return The status of the deployment: PENDING, FAILED, or SUCCEEDED. * @see DeploymentStatus */ public DeploymentStatus deploymentStatus() { return DeploymentStatus.fromValue(deploymentStatus); } /** *

* The status of the deployment: PENDING, FAILED, or SUCCEEDED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentStatus} * will return {@link DeploymentStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #deploymentStatusAsString}. *

* * @return The status of the deployment: PENDING, FAILED, or SUCCEEDED. * @see DeploymentStatus */ public String deploymentStatusAsString() { return deploymentStatus; } /** *

* May contain additional feedback on the status of an API deployment. *

* * @return May contain additional feedback on the status of an API deployment. */ public String deploymentStatusMessage() { return deploymentStatusMessage; } /** *

* The description for the deployment. *

* * @return The description for the deployment. */ public String description() { return description; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(createdDate()); hashCode = 31 * hashCode + Objects.hashCode(deploymentId()); hashCode = 31 * hashCode + Objects.hashCode(deploymentStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(deploymentStatusMessage()); hashCode = 31 * hashCode + Objects.hashCode(description()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Deployment)) { return false; } Deployment other = (Deployment) obj; return Objects.equals(createdDate(), other.createdDate()) && Objects.equals(deploymentId(), other.deploymentId()) && Objects.equals(deploymentStatusAsString(), other.deploymentStatusAsString()) && Objects.equals(deploymentStatusMessage(), other.deploymentStatusMessage()) && Objects.equals(description(), other.description()); } /** * 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 String toString() { return ToString.builder("Deployment").add("CreatedDate", createdDate()).add("DeploymentId", deploymentId()) .add("DeploymentStatus", deploymentStatusAsString()).add("DeploymentStatusMessage", deploymentStatusMessage()) .add("Description", description()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "CreatedDate": return Optional.ofNullable(clazz.cast(createdDate())); case "DeploymentId": return Optional.ofNullable(clazz.cast(deploymentId())); case "DeploymentStatus": return Optional.ofNullable(clazz.cast(deploymentStatusAsString())); case "DeploymentStatusMessage": return Optional.ofNullable(clazz.cast(deploymentStatusMessage())); case "Description": return Optional.ofNullable(clazz.cast(description())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Deployment) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The date and time when the Deployment resource was created. *

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

* The identifier for the deployment. *

* * @param deploymentId * The identifier for the deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deploymentId(String deploymentId); /** *

* The status of the deployment: PENDING, FAILED, or SUCCEEDED. *

* * @param deploymentStatus * The status of the deployment: PENDING, FAILED, or SUCCEEDED. * @see DeploymentStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentStatus */ Builder deploymentStatus(String deploymentStatus); /** *

* The status of the deployment: PENDING, FAILED, or SUCCEEDED. *

* * @param deploymentStatus * The status of the deployment: PENDING, FAILED, or SUCCEEDED. * @see DeploymentStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentStatus */ Builder deploymentStatus(DeploymentStatus deploymentStatus); /** *

* May contain additional feedback on the status of an API deployment. *

* * @param deploymentStatusMessage * May contain additional feedback on the status of an API deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deploymentStatusMessage(String deploymentStatusMessage); /** *

* The description for the deployment. *

* * @param description * The description for the deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); } static final class BuilderImpl implements Builder { private Instant createdDate; private String deploymentId; private String deploymentStatus; private String deploymentStatusMessage; private String description; private BuilderImpl() { } private BuilderImpl(Deployment model) { createdDate(model.createdDate); deploymentId(model.deploymentId); deploymentStatus(model.deploymentStatus); deploymentStatusMessage(model.deploymentStatusMessage); description(model.description); } public final Instant getCreatedDate() { return createdDate; } @Override public final Builder createdDate(Instant createdDate) { this.createdDate = createdDate; return this; } public final void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } public final String getDeploymentId() { return deploymentId; } @Override public final Builder deploymentId(String deploymentId) { this.deploymentId = deploymentId; return this; } public final void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } public final String getDeploymentStatusAsString() { return deploymentStatus; } @Override public final Builder deploymentStatus(String deploymentStatus) { this.deploymentStatus = deploymentStatus; return this; } @Override public final Builder deploymentStatus(DeploymentStatus deploymentStatus) { this.deploymentStatus(deploymentStatus.toString()); return this; } public final void setDeploymentStatus(String deploymentStatus) { this.deploymentStatus = deploymentStatus; } public final String getDeploymentStatusMessage() { return deploymentStatusMessage; } @Override public final Builder deploymentStatusMessage(String deploymentStatusMessage) { this.deploymentStatusMessage = deploymentStatusMessage; return this; } public final void setDeploymentStatusMessage(String deploymentStatusMessage) { this.deploymentStatusMessage = deploymentStatusMessage; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } @Override public Deployment build() { return new Deployment(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy