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

software.amazon.awssdk.services.iot.model.DescribeProvisioningTemplateResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Iot Service module holds the client classes that are used for communicating with AWS IoT Service

There is a newer version: 2.30.1
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.iot.model;

import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class DescribeProvisioningTemplateResponse extends IotResponse implements
        ToCopyableBuilder {
    private static final SdkField TEMPLATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("templateArn").getter(getter(DescribeProvisioningTemplateResponse::templateArn))
            .setter(setter(Builder::templateArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateArn").build()).build();

    private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("templateName").getter(getter(DescribeProvisioningTemplateResponse::templateName))
            .setter(setter(Builder::templateName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateName").build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("description").getter(getter(DescribeProvisioningTemplateResponse::description))
            .setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();

    private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("creationDate").getter(getter(DescribeProvisioningTemplateResponse::creationDate))
            .setter(setter(Builder::creationDate))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationDate").build()).build();

    private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("lastModifiedDate").getter(getter(DescribeProvisioningTemplateResponse::lastModifiedDate))
            .setter(setter(Builder::lastModifiedDate))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedDate").build()).build();

    private static final SdkField DEFAULT_VERSION_ID_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .memberName("defaultVersionId").getter(getter(DescribeProvisioningTemplateResponse::defaultVersionId))
            .setter(setter(Builder::defaultVersionId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultVersionId").build()).build();

    private static final SdkField TEMPLATE_BODY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("templateBody").getter(getter(DescribeProvisioningTemplateResponse::templateBody))
            .setter(setter(Builder::templateBody))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateBody").build()).build();

    private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
            .memberName("enabled").getter(getter(DescribeProvisioningTemplateResponse::enabled)).setter(setter(Builder::enabled))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enabled").build()).build();

    private static final SdkField PROVISIONING_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("provisioningRoleArn").getter(getter(DescribeProvisioningTemplateResponse::provisioningRoleArn))
            .setter(setter(Builder::provisioningRoleArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("provisioningRoleArn").build())
            .build();

    private static final SdkField PRE_PROVISIONING_HOOK_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("preProvisioningHook")
            .getter(getter(DescribeProvisioningTemplateResponse::preProvisioningHook))
            .setter(setter(Builder::preProvisioningHook)).constructor(ProvisioningHook::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("preProvisioningHook").build())
            .build();

    private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
            .getter(getter(DescribeProvisioningTemplateResponse::typeAsString)).setter(setter(Builder::type))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TEMPLATE_ARN_FIELD,
            TEMPLATE_NAME_FIELD, DESCRIPTION_FIELD, CREATION_DATE_FIELD, LAST_MODIFIED_DATE_FIELD, DEFAULT_VERSION_ID_FIELD,
            TEMPLATE_BODY_FIELD, ENABLED_FIELD, PROVISIONING_ROLE_ARN_FIELD, PRE_PROVISIONING_HOOK_FIELD, TYPE_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();

    private final String templateArn;

    private final String templateName;

    private final String description;

    private final Instant creationDate;

    private final Instant lastModifiedDate;

    private final Integer defaultVersionId;

    private final String templateBody;

    private final Boolean enabled;

    private final String provisioningRoleArn;

    private final ProvisioningHook preProvisioningHook;

    private final String type;

    private DescribeProvisioningTemplateResponse(BuilderImpl builder) {
        super(builder);
        this.templateArn = builder.templateArn;
        this.templateName = builder.templateName;
        this.description = builder.description;
        this.creationDate = builder.creationDate;
        this.lastModifiedDate = builder.lastModifiedDate;
        this.defaultVersionId = builder.defaultVersionId;
        this.templateBody = builder.templateBody;
        this.enabled = builder.enabled;
        this.provisioningRoleArn = builder.provisioningRoleArn;
        this.preProvisioningHook = builder.preProvisioningHook;
        this.type = builder.type;
    }

    /**
     * 

* The ARN of the provisioning template. *

* * @return The ARN of the provisioning template. */ public final String templateArn() { return templateArn; } /** *

* The name of the provisioning template. *

* * @return The name of the provisioning template. */ public final String templateName() { return templateName; } /** *

* The description of the provisioning template. *

* * @return The description of the provisioning template. */ public final String description() { return description; } /** *

* The date when the provisioning template was created. *

* * @return The date when the provisioning template was created. */ public final Instant creationDate() { return creationDate; } /** *

* The date when the provisioning template was last modified. *

* * @return The date when the provisioning template was last modified. */ public final Instant lastModifiedDate() { return lastModifiedDate; } /** *

* The default fleet template version ID. *

* * @return The default fleet template version ID. */ public final Integer defaultVersionId() { return defaultVersionId; } /** *

* The JSON formatted contents of the provisioning template. *

* * @return The JSON formatted contents of the provisioning template. */ public final String templateBody() { return templateBody; } /** *

* True if the provisioning template is enabled, otherwise false. *

* * @return True if the provisioning template is enabled, otherwise false. */ public final Boolean enabled() { return enabled; } /** *

* The ARN of the role associated with the provisioning template. This IoT role grants permission to provision a * device. *

* * @return The ARN of the role associated with the provisioning template. This IoT role grants permission to * provision a device. */ public final String provisioningRoleArn() { return provisioningRoleArn; } /** *

* Gets information about a pre-provisioned hook. *

* * @return Gets information about a pre-provisioned hook. */ public final ProvisioningHook preProvisioningHook() { return preProvisioningHook; } /** *

* The type you define in a provisioning template. You can create a template with only one type. You can't change * the template type after its creation. The default value is FLEET_PROVISIONING. For more information * about provisioning template, see: Provisioning template. *

*

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

* * @return The type you define in a provisioning template. You can create a template with only one type. You can't * change the template type after its creation. The default value is FLEET_PROVISIONING. For * more information about provisioning template, see: Provisioning * template. * @see TemplateType */ public final TemplateType type() { return TemplateType.fromValue(type); } /** *

* The type you define in a provisioning template. You can create a template with only one type. You can't change * the template type after its creation. The default value is FLEET_PROVISIONING. For more information * about provisioning template, see: Provisioning template. *

*

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

* * @return The type you define in a provisioning template. You can create a template with only one type. You can't * change the template type after its creation. The default value is FLEET_PROVISIONING. For * more information about provisioning template, see: Provisioning * template. * @see TemplateType */ public final String typeAsString() { return type; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(templateArn()); hashCode = 31 * hashCode + Objects.hashCode(templateName()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(creationDate()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate()); hashCode = 31 * hashCode + Objects.hashCode(defaultVersionId()); hashCode = 31 * hashCode + Objects.hashCode(templateBody()); hashCode = 31 * hashCode + Objects.hashCode(enabled()); hashCode = 31 * hashCode + Objects.hashCode(provisioningRoleArn()); hashCode = 31 * hashCode + Objects.hashCode(preProvisioningHook()); hashCode = 31 * hashCode + Objects.hashCode(typeAsString()); 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 DescribeProvisioningTemplateResponse)) { return false; } DescribeProvisioningTemplateResponse other = (DescribeProvisioningTemplateResponse) obj; return Objects.equals(templateArn(), other.templateArn()) && Objects.equals(templateName(), other.templateName()) && Objects.equals(description(), other.description()) && Objects.equals(creationDate(), other.creationDate()) && Objects.equals(lastModifiedDate(), other.lastModifiedDate()) && Objects.equals(defaultVersionId(), other.defaultVersionId()) && Objects.equals(templateBody(), other.templateBody()) && Objects.equals(enabled(), other.enabled()) && Objects.equals(provisioningRoleArn(), other.provisioningRoleArn()) && Objects.equals(preProvisioningHook(), other.preProvisioningHook()) && Objects.equals(typeAsString(), other.typeAsString()); } /** * 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("DescribeProvisioningTemplateResponse").add("TemplateArn", templateArn()) .add("TemplateName", templateName()).add("Description", description()).add("CreationDate", creationDate()) .add("LastModifiedDate", lastModifiedDate()).add("DefaultVersionId", defaultVersionId()) .add("TemplateBody", templateBody()).add("Enabled", enabled()).add("ProvisioningRoleArn", provisioningRoleArn()) .add("PreProvisioningHook", preProvisioningHook()).add("Type", typeAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "templateArn": return Optional.ofNullable(clazz.cast(templateArn())); case "templateName": return Optional.ofNullable(clazz.cast(templateName())); case "description": return Optional.ofNullable(clazz.cast(description())); case "creationDate": return Optional.ofNullable(clazz.cast(creationDate())); case "lastModifiedDate": return Optional.ofNullable(clazz.cast(lastModifiedDate())); case "defaultVersionId": return Optional.ofNullable(clazz.cast(defaultVersionId())); case "templateBody": return Optional.ofNullable(clazz.cast(templateBody())); case "enabled": return Optional.ofNullable(clazz.cast(enabled())); case "provisioningRoleArn": return Optional.ofNullable(clazz.cast(provisioningRoleArn())); case "preProvisioningHook": return Optional.ofNullable(clazz.cast(preProvisioningHook())); case "type": return Optional.ofNullable(clazz.cast(typeAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("templateArn", TEMPLATE_ARN_FIELD); map.put("templateName", TEMPLATE_NAME_FIELD); map.put("description", DESCRIPTION_FIELD); map.put("creationDate", CREATION_DATE_FIELD); map.put("lastModifiedDate", LAST_MODIFIED_DATE_FIELD); map.put("defaultVersionId", DEFAULT_VERSION_ID_FIELD); map.put("templateBody", TEMPLATE_BODY_FIELD); map.put("enabled", ENABLED_FIELD); map.put("provisioningRoleArn", PROVISIONING_ROLE_ARN_FIELD); map.put("preProvisioningHook", PRE_PROVISIONING_HOOK_FIELD); map.put("type", TYPE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((DescribeProvisioningTemplateResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends IotResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The ARN of the provisioning template. *

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

* The name of the provisioning template. *

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

* The description of the provisioning template. *

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

* The date when the provisioning template was created. *

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

* The date when the provisioning template was last modified. *

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

* The default fleet template version ID. *

* * @param defaultVersionId * The default fleet template version ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultVersionId(Integer defaultVersionId); /** *

* The JSON formatted contents of the provisioning template. *

* * @param templateBody * The JSON formatted contents of the provisioning template. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateBody(String templateBody); /** *

* True if the provisioning template is enabled, otherwise false. *

* * @param enabled * True if the provisioning template is enabled, otherwise false. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enabled(Boolean enabled); /** *

* The ARN of the role associated with the provisioning template. This IoT role grants permission to provision a * device. *

* * @param provisioningRoleArn * The ARN of the role associated with the provisioning template. This IoT role grants permission to * provision a device. * @return Returns a reference to this object so that method calls can be chained together. */ Builder provisioningRoleArn(String provisioningRoleArn); /** *

* Gets information about a pre-provisioned hook. *

* * @param preProvisioningHook * Gets information about a pre-provisioned hook. * @return Returns a reference to this object so that method calls can be chained together. */ Builder preProvisioningHook(ProvisioningHook preProvisioningHook); /** *

* Gets information about a pre-provisioned hook. *

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

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

* The type you define in a provisioning template. You can create a template with only one type. You can't * change the template type after its creation. The default value is FLEET_PROVISIONING. For more * information about provisioning template, see: Provisioning * template. *

* * @param type * The type you define in a provisioning template. You can create a template with only one type. You * can't change the template type after its creation. The default value is * FLEET_PROVISIONING. For more information about provisioning template, see: Provisioning * template. * @see TemplateType * @return Returns a reference to this object so that method calls can be chained together. * @see TemplateType */ Builder type(String type); /** *

* The type you define in a provisioning template. You can create a template with only one type. You can't * change the template type after its creation. The default value is FLEET_PROVISIONING. For more * information about provisioning template, see: Provisioning * template. *

* * @param type * The type you define in a provisioning template. You can create a template with only one type. You * can't change the template type after its creation. The default value is * FLEET_PROVISIONING. For more information about provisioning template, see: Provisioning * template. * @see TemplateType * @return Returns a reference to this object so that method calls can be chained together. * @see TemplateType */ Builder type(TemplateType type); } static final class BuilderImpl extends IotResponse.BuilderImpl implements Builder { private String templateArn; private String templateName; private String description; private Instant creationDate; private Instant lastModifiedDate; private Integer defaultVersionId; private String templateBody; private Boolean enabled; private String provisioningRoleArn; private ProvisioningHook preProvisioningHook; private String type; private BuilderImpl() { } private BuilderImpl(DescribeProvisioningTemplateResponse model) { super(model); templateArn(model.templateArn); templateName(model.templateName); description(model.description); creationDate(model.creationDate); lastModifiedDate(model.lastModifiedDate); defaultVersionId(model.defaultVersionId); templateBody(model.templateBody); enabled(model.enabled); provisioningRoleArn(model.provisioningRoleArn); preProvisioningHook(model.preProvisioningHook); type(model.type); } public final String getTemplateArn() { return templateArn; } public final void setTemplateArn(String templateArn) { this.templateArn = templateArn; } @Override public final Builder templateArn(String templateArn) { this.templateArn = templateArn; 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; } 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 getCreationDate() { return creationDate; } public final void setCreationDate(Instant creationDate) { this.creationDate = creationDate; } @Override public final Builder creationDate(Instant creationDate) { this.creationDate = creationDate; return this; } public final Instant getLastModifiedDate() { return lastModifiedDate; } public final void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } @Override public final Builder lastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; return this; } public final Integer getDefaultVersionId() { return defaultVersionId; } public final void setDefaultVersionId(Integer defaultVersionId) { this.defaultVersionId = defaultVersionId; } @Override public final Builder defaultVersionId(Integer defaultVersionId) { this.defaultVersionId = defaultVersionId; return this; } public final String getTemplateBody() { return templateBody; } public final void setTemplateBody(String templateBody) { this.templateBody = templateBody; } @Override public final Builder templateBody(String templateBody) { this.templateBody = templateBody; return this; } public final Boolean getEnabled() { return enabled; } public final void setEnabled(Boolean enabled) { this.enabled = enabled; } @Override public final Builder enabled(Boolean enabled) { this.enabled = enabled; return this; } public final String getProvisioningRoleArn() { return provisioningRoleArn; } public final void setProvisioningRoleArn(String provisioningRoleArn) { this.provisioningRoleArn = provisioningRoleArn; } @Override public final Builder provisioningRoleArn(String provisioningRoleArn) { this.provisioningRoleArn = provisioningRoleArn; return this; } public final ProvisioningHook.Builder getPreProvisioningHook() { return preProvisioningHook != null ? preProvisioningHook.toBuilder() : null; } public final void setPreProvisioningHook(ProvisioningHook.BuilderImpl preProvisioningHook) { this.preProvisioningHook = preProvisioningHook != null ? preProvisioningHook.build() : null; } @Override public final Builder preProvisioningHook(ProvisioningHook preProvisioningHook) { this.preProvisioningHook = preProvisioningHook; return this; } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(TemplateType type) { this.type(type == null ? null : type.toString()); return this; } @Override public DescribeProvisioningTemplateResponse build() { return new DescribeProvisioningTemplateResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy