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

software.amazon.awssdk.services.iotthingsgraph.model.AssociateEntityToThingRequest 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.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.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.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 AssociateEntityToThingRequest extends IoTThingsGraphRequest implements
        ToCopyableBuilder {
    private static final SdkField THING_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("thingName").getter(getter(AssociateEntityToThingRequest::thingName)).setter(setter(Builder::thingName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("thingName").build()).build();

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

    private static final SdkField NAMESPACE_VERSION_FIELD = SdkField. builder(MarshallingType.LONG)
            .memberName("namespaceVersion").getter(getter(AssociateEntityToThingRequest::namespaceVersion))
            .setter(setter(Builder::namespaceVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("namespaceVersion").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(THING_NAME_FIELD,
            ENTITY_ID_FIELD, NAMESPACE_VERSION_FIELD));

    private final String thingName;

    private final String entityId;

    private final Long namespaceVersion;

    private AssociateEntityToThingRequest(BuilderImpl builder) {
        super(builder);
        this.thingName = builder.thingName;
        this.entityId = builder.entityId;
        this.namespaceVersion = builder.namespaceVersion;
    }

    /**
     * 

* The name of the thing to which the entity is to be associated. *

* * @return The name of the thing to which the entity is to be associated. */ public final String thingName() { return thingName; } /** *

* The ID of the device to be associated with the thing. *

*

* The ID should be in the following format. *

*

* urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME *

* * @return The ID of the device to be associated with the thing.

*

* The ID should be in the following format. *

*

* urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME */ public final String entityId() { return entityId; } /** *

* The version of the user's namespace. Defaults to the latest version of the user's namespace. *

* * @return The version of the user's namespace. Defaults to the latest version of the user's namespace. */ public final Long namespaceVersion() { return namespaceVersion; } @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(thingName()); hashCode = 31 * hashCode + Objects.hashCode(entityId()); hashCode = 31 * hashCode + Objects.hashCode(namespaceVersion()); 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 AssociateEntityToThingRequest)) { return false; } AssociateEntityToThingRequest other = (AssociateEntityToThingRequest) obj; return Objects.equals(thingName(), other.thingName()) && Objects.equals(entityId(), other.entityId()) && Objects.equals(namespaceVersion(), other.namespaceVersion()); } /** * 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("AssociateEntityToThingRequest").add("ThingName", thingName()).add("EntityId", entityId()) .add("NamespaceVersion", namespaceVersion()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "thingName": return Optional.ofNullable(clazz.cast(thingName())); case "entityId": return Optional.ofNullable(clazz.cast(entityId())); case "namespaceVersion": return Optional.ofNullable(clazz.cast(namespaceVersion())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AssociateEntityToThingRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends IoTThingsGraphRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the thing to which the entity is to be associated. *

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

* The ID of the device to be associated with the thing. *

*

* The ID should be in the following format. *

*

* urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME *

* * @param entityId * The ID of the device to be associated with the thing.

*

* The ID should be in the following format. *

*

* urn:tdm:REGION/ACCOUNT ID/default:device:DEVICENAME * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityId(String entityId); /** *

* The version of the user's namespace. Defaults to the latest version of the user's namespace. *

* * @param namespaceVersion * The version of the user's namespace. Defaults to the latest version of the user's namespace. * @return Returns a reference to this object so that method calls can be chained together. */ Builder namespaceVersion(Long namespaceVersion); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends IoTThingsGraphRequest.BuilderImpl implements Builder { private String thingName; private String entityId; private Long namespaceVersion; private BuilderImpl() { } private BuilderImpl(AssociateEntityToThingRequest model) { super(model); thingName(model.thingName); entityId(model.entityId); namespaceVersion(model.namespaceVersion); } public final String getThingName() { return thingName; } @Override public final Builder thingName(String thingName) { this.thingName = thingName; return this; } public final void setThingName(String thingName) { this.thingName = thingName; } public final String getEntityId() { return entityId; } @Override public final Builder entityId(String entityId) { this.entityId = entityId; return this; } public final void setEntityId(String entityId) { this.entityId = entityId; } public final Long getNamespaceVersion() { return namespaceVersion; } @Override public final Builder namespaceVersion(Long namespaceVersion) { this.namespaceVersion = namespaceVersion; return this; } public final void setNamespaceVersion(Long namespaceVersion) { this.namespaceVersion = namespaceVersion; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public AssociateEntityToThingRequest build() { return new AssociateEntityToThingRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy