
software.amazon.awssdk.services.iotthingsgraph.model.CreateSystemInstanceRequest 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.iotthingsgraph.model;
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.awscore.AwsRequestOverrideConfiguration;
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 CreateSystemInstanceRequest extends IoTThingsGraphRequest implements
ToCopyableBuilder {
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tags")
.getter(getter(CreateSystemInstanceRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField DEFINITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("definition")
.getter(getter(CreateSystemInstanceRequest::definition)).setter(setter(Builder::definition))
.constructor(DefinitionDocument::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("definition").build()).build();
private static final SdkField TARGET_FIELD = SdkField. builder(MarshallingType.STRING).memberName("target")
.getter(getter(CreateSystemInstanceRequest::targetAsString)).setter(setter(Builder::target))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("target").build()).build();
private static final SdkField GREENGRASS_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("greengrassGroupName").getter(getter(CreateSystemInstanceRequest::greengrassGroupName))
.setter(setter(Builder::greengrassGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("greengrassGroupName").build())
.build();
private static final SdkField S3_BUCKET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("s3BucketName").getter(getter(CreateSystemInstanceRequest::s3BucketName))
.setter(setter(Builder::s3BucketName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("s3BucketName").build()).build();
private static final SdkField METRICS_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("metricsConfiguration")
.getter(getter(CreateSystemInstanceRequest::metricsConfiguration)).setter(setter(Builder::metricsConfiguration))
.constructor(MetricsConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricsConfiguration").build())
.build();
private static final SdkField FLOW_ACTIONS_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("flowActionsRoleArn").getter(getter(CreateSystemInstanceRequest::flowActionsRoleArn))
.setter(setter(Builder::flowActionsRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("flowActionsRoleArn").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TAGS_FIELD, DEFINITION_FIELD,
TARGET_FIELD, GREENGRASS_GROUP_NAME_FIELD, S3_BUCKET_NAME_FIELD, METRICS_CONFIGURATION_FIELD,
FLOW_ACTIONS_ROLE_ARN_FIELD));
private final List tags;
private final DefinitionDocument definition;
private final String target;
private final String greengrassGroupName;
private final String s3BucketName;
private final MetricsConfiguration metricsConfiguration;
private final String flowActionsRoleArn;
private CreateSystemInstanceRequest(BuilderImpl builder) {
super(builder);
this.tags = builder.tags;
this.definition = builder.definition;
this.target = builder.target;
this.greengrassGroupName = builder.greengrassGroupName;
this.s3BucketName = builder.s3BucketName;
this.metricsConfiguration = builder.metricsConfiguration;
this.flowActionsRoleArn = builder.flowActionsRoleArn;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Metadata, consisting of key-value pairs, that can be used to categorize your system instances.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return Metadata, consisting of key-value pairs, that can be used to categorize your system instances.
*/
public final List tags() {
return tags;
}
/**
* Returns the value of the Definition property for this object.
*
* @return The value of the Definition property for this object.
*/
public final DefinitionDocument definition() {
return definition;
}
/**
*
* The target type of the deployment. Valid values are GREENGRASS
and CLOUD
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #target} will
* return {@link DeploymentTarget#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #targetAsString}.
*
*
* @return The target type of the deployment. Valid values are GREENGRASS
and CLOUD
.
* @see DeploymentTarget
*/
public final DeploymentTarget target() {
return DeploymentTarget.fromValue(target);
}
/**
*
* The target type of the deployment. Valid values are GREENGRASS
and CLOUD
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #target} will
* return {@link DeploymentTarget#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #targetAsString}.
*
*
* @return The target type of the deployment. Valid values are GREENGRASS
and CLOUD
.
* @see DeploymentTarget
*/
public final String targetAsString() {
return target;
}
/**
*
* The name of the Greengrass group where the system instance will be deployed. This value is required if the value
* of the target
parameter is GREENGRASS
.
*
*
* @return The name of the Greengrass group where the system instance will be deployed. This value is required if
* the value of the target
parameter is GREENGRASS
.
*/
public final String greengrassGroupName() {
return greengrassGroupName;
}
/**
*
* The name of the Amazon Simple Storage Service bucket that will be used to store and deploy the system instance's
* resource file. This value is required if the value of the target
parameter is
* GREENGRASS
.
*
*
* @return The name of the Amazon Simple Storage Service bucket that will be used to store and deploy the system
* instance's resource file. This value is required if the value of the target
parameter is
* GREENGRASS
.
*/
public final String s3BucketName() {
return s3BucketName;
}
/**
* Returns the value of the MetricsConfiguration property for this object.
*
* @return The value of the MetricsConfiguration property for this object.
*/
public final MetricsConfiguration metricsConfiguration() {
return metricsConfiguration;
}
/**
*
* The ARN of the IAM role that AWS IoT Things Graph will assume when it executes the flow. This role must have read
* and write access to AWS Lambda and AWS IoT and any other AWS services that the flow uses when it executes. This
* value is required if the value of the target
parameter is CLOUD
.
*
*
* @return The ARN of the IAM role that AWS IoT Things Graph will assume when it executes the flow. This role must
* have read and write access to AWS Lambda and AWS IoT and any other AWS services that the flow uses when
* it executes. This value is required if the value of the target
parameter is
* CLOUD
.
*/
public final String flowActionsRoleArn() {
return flowActionsRoleArn;
}
@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(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(definition());
hashCode = 31 * hashCode + Objects.hashCode(targetAsString());
hashCode = 31 * hashCode + Objects.hashCode(greengrassGroupName());
hashCode = 31 * hashCode + Objects.hashCode(s3BucketName());
hashCode = 31 * hashCode + Objects.hashCode(metricsConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(flowActionsRoleArn());
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 CreateSystemInstanceRequest)) {
return false;
}
CreateSystemInstanceRequest other = (CreateSystemInstanceRequest) obj;
return hasTags() == other.hasTags() && Objects.equals(tags(), other.tags())
&& Objects.equals(definition(), other.definition()) && Objects.equals(targetAsString(), other.targetAsString())
&& Objects.equals(greengrassGroupName(), other.greengrassGroupName())
&& Objects.equals(s3BucketName(), other.s3BucketName())
&& Objects.equals(metricsConfiguration(), other.metricsConfiguration())
&& Objects.equals(flowActionsRoleArn(), other.flowActionsRoleArn());
}
/**
* 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("CreateSystemInstanceRequest").add("Tags", hasTags() ? tags() : null)
.add("Definition", definition()).add("Target", targetAsString())
.add("GreengrassGroupName", greengrassGroupName()).add("S3BucketName", s3BucketName())
.add("MetricsConfiguration", metricsConfiguration()).add("FlowActionsRoleArn", flowActionsRoleArn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "definition":
return Optional.ofNullable(clazz.cast(definition()));
case "target":
return Optional.ofNullable(clazz.cast(targetAsString()));
case "greengrassGroupName":
return Optional.ofNullable(clazz.cast(greengrassGroupName()));
case "s3BucketName":
return Optional.ofNullable(clazz.cast(s3BucketName()));
case "metricsConfiguration":
return Optional.ofNullable(clazz.cast(metricsConfiguration()));
case "flowActionsRoleArn":
return Optional.ofNullable(clazz.cast(flowActionsRoleArn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function