
software.amazon.awssdk.services.backup.model.DescribeFrameworkResponse 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.backup.model;
import java.beans.Transient;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeFrameworkResponse extends BackupResponse implements
ToCopyableBuilder {
private static final SdkField FRAMEWORK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FrameworkName").getter(getter(DescribeFrameworkResponse::frameworkName))
.setter(setter(Builder::frameworkName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameworkName").build()).build();
private static final SdkField FRAMEWORK_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FrameworkArn").getter(getter(DescribeFrameworkResponse::frameworkArn))
.setter(setter(Builder::frameworkArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameworkArn").build()).build();
private static final SdkField FRAMEWORK_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FrameworkDescription").getter(getter(DescribeFrameworkResponse::frameworkDescription))
.setter(setter(Builder::frameworkDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameworkDescription").build())
.build();
private static final SdkField> FRAMEWORK_CONTROLS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("FrameworkControls")
.getter(getter(DescribeFrameworkResponse::frameworkControls))
.setter(setter(Builder::frameworkControls))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameworkControls").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(FrameworkControl::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeFrameworkResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField DEPLOYMENT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DeploymentStatus").getter(getter(DescribeFrameworkResponse::deploymentStatus))
.setter(setter(Builder::deploymentStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeploymentStatus").build()).build();
private static final SdkField FRAMEWORK_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FrameworkStatus").getter(getter(DescribeFrameworkResponse::frameworkStatus))
.setter(setter(Builder::frameworkStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameworkStatus").build()).build();
private static final SdkField IDEMPOTENCY_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IdempotencyToken").getter(getter(DescribeFrameworkResponse::idempotencyToken))
.setter(setter(Builder::idempotencyToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IdempotencyToken").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FRAMEWORK_NAME_FIELD,
FRAMEWORK_ARN_FIELD, FRAMEWORK_DESCRIPTION_FIELD, FRAMEWORK_CONTROLS_FIELD, CREATION_TIME_FIELD,
DEPLOYMENT_STATUS_FIELD, FRAMEWORK_STATUS_FIELD, IDEMPOTENCY_TOKEN_FIELD));
private final String frameworkName;
private final String frameworkArn;
private final String frameworkDescription;
private final List frameworkControls;
private final Instant creationTime;
private final String deploymentStatus;
private final String frameworkStatus;
private final String idempotencyToken;
private DescribeFrameworkResponse(BuilderImpl builder) {
super(builder);
this.frameworkName = builder.frameworkName;
this.frameworkArn = builder.frameworkArn;
this.frameworkDescription = builder.frameworkDescription;
this.frameworkControls = builder.frameworkControls;
this.creationTime = builder.creationTime;
this.deploymentStatus = builder.deploymentStatus;
this.frameworkStatus = builder.frameworkStatus;
this.idempotencyToken = builder.idempotencyToken;
}
/**
*
* The unique name of a framework.
*
*
* @return The unique name of a framework.
*/
public final String frameworkName() {
return frameworkName;
}
/**
*
* An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the resource
* type.
*
*
* @return An Amazon Resource Name (ARN) that uniquely identifies a resource. The format of the ARN depends on the
* resource type.
*/
public final String frameworkArn() {
return frameworkArn;
}
/**
*
* An optional description of the framework.
*
*
* @return An optional description of the framework.
*/
public final String frameworkDescription() {
return frameworkDescription;
}
/**
* For responses, this returns true if the service returned a value for the FrameworkControls property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasFrameworkControls() {
return frameworkControls != null && !(frameworkControls instanceof SdkAutoConstructList);
}
/**
*
* A list of the controls that make up the framework. Each control in the list has a name, input parameters, and
* scope.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasFrameworkControls} method.
*
*
* @return A list of the controls that make up the framework. Each control in the list has a name, input parameters,
* and scope.
*/
public final List frameworkControls() {
return frameworkControls;
}
/**
*
* The date and time that a framework is created, in Unix format and Coordinated Universal Time (UTC). The value of
* CreationTime
is accurate to milliseconds. For example, the value 1516925490.087 represents Friday,
* January 26, 2018 12:11:30.087 AM.
*
*
* @return The date and time that a framework is created, in Unix format and Coordinated Universal Time (UTC). The
* value of CreationTime
is accurate to milliseconds. For example, the value 1516925490.087
* represents Friday, January 26, 2018 12:11:30.087 AM.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The deployment status of a framework. The statuses are:
*
*
* CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED | FAILED
*
*
* @return The deployment status of a framework. The statuses are:
*
* CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED | FAILED
*/
public final String deploymentStatus() {
return deploymentStatus;
}
/**
*
* A framework consists of one or more controls. Each control governs a resource, such as backup plans, backup
* selections, backup vaults, or recovery points. You can also turn Config recording on or off for each resource.
* The statuses are:
*
*
* -
*
* ACTIVE
when recording is turned on for all resources governed by the framework.
*
*
* -
*
* PARTIALLY_ACTIVE
when recording is turned off for at least one resource governed by the framework.
*
*
* -
*
* INACTIVE
when recording is turned off for all resources governed by the framework.
*
*
* -
*
* UNAVAILABLE
when Backup is unable to validate recording status at this time.
*
*
*
*
* @return A framework consists of one or more controls. Each control governs a resource, such as backup plans,
* backup selections, backup vaults, or recovery points. You can also turn Config recording on or off for
* each resource. The statuses are:
*
* -
*
* ACTIVE
when recording is turned on for all resources governed by the framework.
*
*
* -
*
* PARTIALLY_ACTIVE
when recording is turned off for at least one resource governed by the
* framework.
*
*
* -
*
* INACTIVE
when recording is turned off for all resources governed by the framework.
*
*
* -
*
* UNAVAILABLE
when Backup is unable to validate recording status at this time.
*
*
*/
public final String frameworkStatus() {
return frameworkStatus;
}
/**
*
* A customer-chosen string that you can use to distinguish between otherwise identical calls to
* DescribeFrameworkOutput
. Retrying a successful request with the same idempotency token results in a
* success message with no action taken.
*
*
* @return A customer-chosen string that you can use to distinguish between otherwise identical calls to
* DescribeFrameworkOutput
. Retrying a successful request with the same idempotency token
* results in a success message with no action taken.
*/
public final String idempotencyToken() {
return idempotencyToken;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(frameworkName());
hashCode = 31 * hashCode + Objects.hashCode(frameworkArn());
hashCode = 31 * hashCode + Objects.hashCode(frameworkDescription());
hashCode = 31 * hashCode + Objects.hashCode(hasFrameworkControls() ? frameworkControls() : null);
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(deploymentStatus());
hashCode = 31 * hashCode + Objects.hashCode(frameworkStatus());
hashCode = 31 * hashCode + Objects.hashCode(idempotencyToken());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeFrameworkResponse)) {
return false;
}
DescribeFrameworkResponse other = (DescribeFrameworkResponse) obj;
return Objects.equals(frameworkName(), other.frameworkName()) && Objects.equals(frameworkArn(), other.frameworkArn())
&& Objects.equals(frameworkDescription(), other.frameworkDescription())
&& hasFrameworkControls() == other.hasFrameworkControls()
&& Objects.equals(frameworkControls(), other.frameworkControls())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(deploymentStatus(), other.deploymentStatus())
&& Objects.equals(frameworkStatus(), other.frameworkStatus())
&& Objects.equals(idempotencyToken(), other.idempotencyToken());
}
/**
* 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("DescribeFrameworkResponse").add("FrameworkName", frameworkName())
.add("FrameworkArn", frameworkArn()).add("FrameworkDescription", frameworkDescription())
.add("FrameworkControls", hasFrameworkControls() ? frameworkControls() : null)
.add("CreationTime", creationTime()).add("DeploymentStatus", deploymentStatus())
.add("FrameworkStatus", frameworkStatus()).add("IdempotencyToken", idempotencyToken()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FrameworkName":
return Optional.ofNullable(clazz.cast(frameworkName()));
case "FrameworkArn":
return Optional.ofNullable(clazz.cast(frameworkArn()));
case "FrameworkDescription":
return Optional.ofNullable(clazz.cast(frameworkDescription()));
case "FrameworkControls":
return Optional.ofNullable(clazz.cast(frameworkControls()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "DeploymentStatus":
return Optional.ofNullable(clazz.cast(deploymentStatus()));
case "FrameworkStatus":
return Optional.ofNullable(clazz.cast(frameworkStatus()));
case "IdempotencyToken":
return Optional.ofNullable(clazz.cast(idempotencyToken()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function