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

software.amazon.awssdk.services.managedblockchain.model.CreateAccessorRequest 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.managedblockchain.model;

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.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.DefaultValueTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateAccessorRequest extends ManagedBlockchainRequest implements
        ToCopyableBuilder {
    private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("ClientRequestToken")
            .getter(getter(CreateAccessorRequest::clientRequestToken))
            .setter(setter(Builder::clientRequestToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientRequestToken").build(),
                    DefaultValueTrait.idempotencyToken()).build();

    private static final SdkField ACCESSOR_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("AccessorType").getter(getter(CreateAccessorRequest::accessorTypeAsString))
            .setter(setter(Builder::accessorType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccessorType").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(CreateAccessorRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField NETWORK_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("NetworkType").getter(getter(CreateAccessorRequest::networkTypeAsString))
            .setter(setter(Builder::networkType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkType").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLIENT_REQUEST_TOKEN_FIELD,
            ACCESSOR_TYPE_FIELD, TAGS_FIELD, NETWORK_TYPE_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();

    private final String clientRequestToken;

    private final String accessorType;

    private final Map tags;

    private final String networkType;

    private CreateAccessorRequest(BuilderImpl builder) {
        super(builder);
        this.clientRequestToken = builder.clientRequestToken;
        this.accessorType = builder.accessorType;
        this.tags = builder.tags;
        this.networkType = builder.networkType;
    }

    /**
     * 

* This is a unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An * idempotent operation completes no more than once. This identifier is required only if you make a service request * directly using an HTTP client. It is generated automatically if you use an Amazon Web Services SDK or the Amazon * Web Services CLI. *

* * @return This is a unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. * An idempotent operation completes no more than once. This identifier is required only if you make a * service request directly using an HTTP client. It is generated automatically if you use an Amazon Web * Services SDK or the Amazon Web Services CLI. */ public final String clientRequestToken() { return clientRequestToken; } /** *

* The type of accessor. *

* *

* Currently, accessor type is restricted to BILLING_TOKEN. *

*
*

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

* * @return The type of accessor.

*

* Currently, accessor type is restricted to BILLING_TOKEN. *

* @see AccessorType */ public final AccessorType accessorType() { return AccessorType.fromValue(accessorType); } /** *

* The type of accessor. *

* *

* Currently, accessor type is restricted to BILLING_TOKEN. *

*
*

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

* * @return The type of accessor.

*

* Currently, accessor type is restricted to BILLING_TOKEN. *

* @see AccessorType */ public final String accessorTypeAsString() { return accessorType; } /** * For responses, this returns true if the service returned a value for the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* Tags to assign to the Accessor. *

*

* Each tag consists of a key and an optional value. You can specify multiple key-value pairs in a single request * with an overall maximum of 50 tags allowed per resource. *

*

* For more information about tags, see Tagging * Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide. *

*

* 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 #hasTags} method. *

* * @return Tags to assign to the Accessor.

*

* Each tag consists of a key and an optional value. You can specify multiple key-value pairs in a single * request with an overall maximum of 50 tags allowed per resource. *

*

* For more information about tags, see Tagging * Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide. */ public final Map tags() { return tags; } /** *

* The blockchain network that the Accessor token is created for. *

* *
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will remain * unchanged. *

    *
  • *
*
*

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

* * @return The blockchain network that the Accessor token is created for.

*
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will * remain unchanged. *

    *
  • *
* @see AccessorNetworkType */ public final AccessorNetworkType networkType() { return AccessorNetworkType.fromValue(networkType); } /** *

* The blockchain network that the Accessor token is created for. *

* *
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will remain * unchanged. *

    *
  • *
*
*

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

* * @return The blockchain network that the Accessor token is created for.

*
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will * remain unchanged. *

    *
  • *
* @see AccessorNetworkType */ public final String networkTypeAsString() { return networkType; } @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(clientRequestToken()); hashCode = 31 * hashCode + Objects.hashCode(accessorTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(networkTypeAsString()); 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 CreateAccessorRequest)) { return false; } CreateAccessorRequest other = (CreateAccessorRequest) obj; return Objects.equals(clientRequestToken(), other.clientRequestToken()) && Objects.equals(accessorTypeAsString(), other.accessorTypeAsString()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(networkTypeAsString(), other.networkTypeAsString()); } /** * 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("CreateAccessorRequest").add("ClientRequestToken", clientRequestToken()) .add("AccessorType", accessorTypeAsString()).add("Tags", hasTags() ? tags() : null) .add("NetworkType", networkTypeAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ClientRequestToken": return Optional.ofNullable(clazz.cast(clientRequestToken())); case "AccessorType": return Optional.ofNullable(clazz.cast(accessorTypeAsString())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "NetworkType": return Optional.ofNullable(clazz.cast(networkTypeAsString())); 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("ClientRequestToken", CLIENT_REQUEST_TOKEN_FIELD); map.put("AccessorType", ACCESSOR_TYPE_FIELD); map.put("Tags", TAGS_FIELD); map.put("NetworkType", NETWORK_TYPE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((CreateAccessorRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ManagedBlockchainRequest.Builder, SdkPojo, CopyableBuilder { /** *

* This is a unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An * idempotent operation completes no more than once. This identifier is required only if you make a service * request directly using an HTTP client. It is generated automatically if you use an Amazon Web Services SDK or * the Amazon Web Services CLI. *

* * @param clientRequestToken * This is a unique, case-sensitive identifier that you provide to ensure the idempotency of the * operation. An idempotent operation completes no more than once. This identifier is required only if * you make a service request directly using an HTTP client. It is generated automatically if you use an * Amazon Web Services SDK or the Amazon Web Services CLI. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientRequestToken(String clientRequestToken); /** *

* The type of accessor. *

* *

* Currently, accessor type is restricted to BILLING_TOKEN. *

*
* * @param accessorType * The type of accessor.

*

* Currently, accessor type is restricted to BILLING_TOKEN. *

* @see AccessorType * @return Returns a reference to this object so that method calls can be chained together. * @see AccessorType */ Builder accessorType(String accessorType); /** *

* The type of accessor. *

* *

* Currently, accessor type is restricted to BILLING_TOKEN. *

*
* * @param accessorType * The type of accessor.

*

* Currently, accessor type is restricted to BILLING_TOKEN. *

* @see AccessorType * @return Returns a reference to this object so that method calls can be chained together. * @see AccessorType */ Builder accessorType(AccessorType accessorType); /** *

* Tags to assign to the Accessor. *

*

* Each tag consists of a key and an optional value. You can specify multiple key-value pairs in a single * request with an overall maximum of 50 tags allowed per resource. *

*

* For more information about tags, see Tagging * Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide. *

* * @param tags * Tags to assign to the Accessor.

*

* Each tag consists of a key and an optional value. You can specify multiple key-value pairs in a single * request with an overall maximum of 50 tags allowed per resource. *

*

* For more information about tags, see Tagging Resources in the Amazon Managed Blockchain Ethereum Developer Guide, or Tagging Resources in the Amazon Managed Blockchain Hyperledger Fabric Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The blockchain network that the Accessor token is created for. *

* *
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will remain * unchanged. *

    *
  • *
*
* * @param networkType * The blockchain network that the Accessor token is created for.

*
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the * following networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will * remain unchanged. *

    *
  • *
* @see AccessorNetworkType * @return Returns a reference to this object so that method calls can be chained together. * @see AccessorNetworkType */ Builder networkType(String networkType); /** *

* The blockchain network that the Accessor token is created for. *

* *
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the following * networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will remain * unchanged. *

    *
  • *
*
* * @param networkType * The blockchain network that the Accessor token is created for.

*
    *
  • *

    * Use the actual networkType value for the blockchain network that you are creating the * Accessor token for. *

    *
  • *
  • *

    * With the shut down of the Ethereum Goerli and Polygon Mumbai Testnet networks the * following networkType values are no longer available for selection and use. *

    *
      *
    • *

      * ETHEREUM_MAINNET_AND_GOERLI *

      *
    • *
    • *

      * ETHEREUM_GOERLI *

      *
    • *
    • *

      * POLYGON_MUMBAI *

      *
    • *
    *

    * However, your existing Accessor tokens with these networkType values will * remain unchanged. *

    *
  • *
* @see AccessorNetworkType * @return Returns a reference to this object so that method calls can be chained together. * @see AccessorNetworkType */ Builder networkType(AccessorNetworkType networkType); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ManagedBlockchainRequest.BuilderImpl implements Builder { private String clientRequestToken; private String accessorType; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private String networkType; private BuilderImpl() { } private BuilderImpl(CreateAccessorRequest model) { super(model); clientRequestToken(model.clientRequestToken); accessorType(model.accessorType); tags(model.tags); networkType(model.networkType); } public final String getClientRequestToken() { return clientRequestToken; } public final void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } @Override public final Builder clientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; return this; } public final String getAccessorType() { return accessorType; } public final void setAccessorType(String accessorType) { this.accessorType = accessorType; } @Override public final Builder accessorType(String accessorType) { this.accessorType = accessorType; return this; } @Override public final Builder accessorType(AccessorType accessorType) { this.accessorType(accessorType == null ? null : accessorType.toString()); return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = InputTagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = InputTagMapCopier.copy(tags); return this; } public final String getNetworkType() { return networkType; } public final void setNetworkType(String networkType) { this.networkType = networkType; } @Override public final Builder networkType(String networkType) { this.networkType = networkType; return this; } @Override public final Builder networkType(AccessorNetworkType networkType) { this.networkType(networkType == null ? null : networkType.toString()); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateAccessorRequest build() { return new CreateAccessorRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy