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

software.amazon.awssdk.services.transfer.model.CreateAgreementRequest 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.transfer.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 CreateAgreementRequest extends TransferRequest implements
        ToCopyableBuilder {
    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Description").getter(getter(CreateAgreementRequest::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();

    private static final SdkField SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ServerId").getter(getter(CreateAgreementRequest::serverId)).setter(setter(Builder::serverId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerId").build()).build();

    private static final SdkField LOCAL_PROFILE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("LocalProfileId").getter(getter(CreateAgreementRequest::localProfileId))
            .setter(setter(Builder::localProfileId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalProfileId").build()).build();

    private static final SdkField PARTNER_PROFILE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("PartnerProfileId").getter(getter(CreateAgreementRequest::partnerProfileId))
            .setter(setter(Builder::partnerProfileId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PartnerProfileId").build()).build();

    private static final SdkField BASE_DIRECTORY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("BaseDirectory").getter(getter(CreateAgreementRequest::baseDirectory))
            .setter(setter(Builder::baseDirectory))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BaseDirectory").build()).build();

    private static final SdkField ACCESS_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("AccessRole").getter(getter(CreateAgreementRequest::accessRole)).setter(setter(Builder::accessRole))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccessRole").build()).build();

    private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
            .getter(getter(CreateAgreementRequest::statusAsString)).setter(setter(Builder::status))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Tags")
            .getter(getter(CreateAgreementRequest::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESCRIPTION_FIELD,
            SERVER_ID_FIELD, LOCAL_PROFILE_ID_FIELD, PARTNER_PROFILE_ID_FIELD, BASE_DIRECTORY_FIELD, ACCESS_ROLE_FIELD,
            STATUS_FIELD, TAGS_FIELD));

    private final String description;

    private final String serverId;

    private final String localProfileId;

    private final String partnerProfileId;

    private final String baseDirectory;

    private final String accessRole;

    private final String status;

    private final List tags;

    private CreateAgreementRequest(BuilderImpl builder) {
        super(builder);
        this.description = builder.description;
        this.serverId = builder.serverId;
        this.localProfileId = builder.localProfileId;
        this.partnerProfileId = builder.partnerProfileId;
        this.baseDirectory = builder.baseDirectory;
        this.accessRole = builder.accessRole;
        this.status = builder.status;
        this.tags = builder.tags;
    }

    /**
     * 

* A name or short description to identify the agreement. *

* * @return A name or short description to identify the agreement. */ public final String description() { return description; } /** *

* A system-assigned unique identifier for a server instance. This is the specific server that the agreement uses. *

* * @return A system-assigned unique identifier for a server instance. This is the specific server that the agreement * uses. */ public final String serverId() { return serverId; } /** *

* A unique identifier for the AS2 local profile. *

* * @return A unique identifier for the AS2 local profile. */ public final String localProfileId() { return localProfileId; } /** *

* A unique identifier for the partner profile used in the agreement. *

* * @return A unique identifier for the partner profile used in the agreement. */ public final String partnerProfileId() { return partnerProfileId; } /** *

* The landing directory (folder) for files transferred by using the AS2 protocol. *

*

* A BaseDirectory example is /DOC-EXAMPLE-BUCKET/home/mydirectory. *

* * @return The landing directory (folder) for files transferred by using the AS2 protocol.

*

* A BaseDirectory example is /DOC-EXAMPLE-BUCKET/home/mydirectory. */ public final String baseDirectory() { return baseDirectory; } /** *

* Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide the Amazon * Resource Name (ARN) of the Identity and Access Management role to use. *

*

* For AS2 connectors *

*

* With AS2, you can send files by calling StartFileTransfer and specifying the file paths in the * request parameter, SendFilePaths. We use the file’s parent directory (for example, for * --send-file-paths /bucket/dir/file.txt, parent directory is /bucket/dir/) to * temporarily store a processed AS2 message file, store the MDN when we receive them from the partner, and write a * final JSON file containing relevant metadata of the transmission. So, the AccessRole needs to * provide read and write access to the parent directory of the file location used in the * StartFileTransfer request. Additionally, you need to provide read and write access to the parent * directory of the files that you intend to send with StartFileTransfer. *

*

* If you are using Basic authentication for your AS2 connector, the access role requires the * secretsmanager:GetSecretValue permission for the secret. If the secret is encrypted using a * customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the role also needs * the kms:Decrypt permission for that key. *

*

* For SFTP connectors *

*

* Make sure that the access role provides read and write access to the parent directory of the file location that's * used in the StartFileTransfer request. Additionally, make sure that the role provides * secretsmanager:GetSecretValue permission to Secrets Manager. *

* * @return Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide the * Amazon Resource Name (ARN) of the Identity and Access Management role to use.

*

* For AS2 connectors *

*

* With AS2, you can send files by calling StartFileTransfer and specifying the file paths in * the request parameter, SendFilePaths. We use the file’s parent directory (for example, for * --send-file-paths /bucket/dir/file.txt, parent directory is /bucket/dir/) to * temporarily store a processed AS2 message file, store the MDN when we receive them from the partner, and * write a final JSON file containing relevant metadata of the transmission. So, the AccessRole * needs to provide read and write access to the parent directory of the file location used in the * StartFileTransfer request. Additionally, you need to provide read and write access to the * parent directory of the files that you intend to send with StartFileTransfer. *

*

* If you are using Basic authentication for your AS2 connector, the access role requires the * secretsmanager:GetSecretValue permission for the secret. If the secret is encrypted using a * customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the role * also needs the kms:Decrypt permission for that key. *

*

* For SFTP connectors *

*

* Make sure that the access role provides read and write access to the parent directory of the file * location that's used in the StartFileTransfer request. Additionally, make sure that the role * provides secretsmanager:GetSecretValue permission to Secrets Manager. */ public final String accessRole() { return accessRole; } /** *

* The status of the agreement. The agreement can be either ACTIVE or INACTIVE. *

*

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

* * @return The status of the agreement. The agreement can be either ACTIVE or INACTIVE. * @see AgreementStatusType */ public final AgreementStatusType status() { return AgreementStatusType.fromValue(status); } /** *

* The status of the agreement. The agreement can be either ACTIVE or INACTIVE. *

*

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

* * @return The status of the agreement. The agreement can be either ACTIVE or INACTIVE. * @see AgreementStatusType */ public final String statusAsString() { return status; } /** * 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 SdkAutoConstructList); } /** *

* Key-value pairs that can be used to group and search for agreements. *

*

* 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 Key-value pairs that can be used to group and search for agreements. */ public final List tags() { return tags; } @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(description()); hashCode = 31 * hashCode + Objects.hashCode(serverId()); hashCode = 31 * hashCode + Objects.hashCode(localProfileId()); hashCode = 31 * hashCode + Objects.hashCode(partnerProfileId()); hashCode = 31 * hashCode + Objects.hashCode(baseDirectory()); hashCode = 31 * hashCode + Objects.hashCode(accessRole()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); 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 CreateAgreementRequest)) { return false; } CreateAgreementRequest other = (CreateAgreementRequest) obj; return Objects.equals(description(), other.description()) && Objects.equals(serverId(), other.serverId()) && Objects.equals(localProfileId(), other.localProfileId()) && Objects.equals(partnerProfileId(), other.partnerProfileId()) && Objects.equals(baseDirectory(), other.baseDirectory()) && Objects.equals(accessRole(), other.accessRole()) && Objects.equals(statusAsString(), other.statusAsString()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * 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("CreateAgreementRequest").add("Description", description()).add("ServerId", serverId()) .add("LocalProfileId", localProfileId()).add("PartnerProfileId", partnerProfileId()) .add("BaseDirectory", baseDirectory()).add("AccessRole", accessRole()).add("Status", statusAsString()) .add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Description": return Optional.ofNullable(clazz.cast(description())); case "ServerId": return Optional.ofNullable(clazz.cast(serverId())); case "LocalProfileId": return Optional.ofNullable(clazz.cast(localProfileId())); case "PartnerProfileId": return Optional.ofNullable(clazz.cast(partnerProfileId())); case "BaseDirectory": return Optional.ofNullable(clazz.cast(baseDirectory())); case "AccessRole": return Optional.ofNullable(clazz.cast(accessRole())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateAgreementRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends TransferRequest.Builder, SdkPojo, CopyableBuilder { /** *

* A name or short description to identify the agreement. *

* * @param description * A name or short description to identify the agreement. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* A system-assigned unique identifier for a server instance. This is the specific server that the agreement * uses. *

* * @param serverId * A system-assigned unique identifier for a server instance. This is the specific server that the * agreement uses. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serverId(String serverId); /** *

* A unique identifier for the AS2 local profile. *

* * @param localProfileId * A unique identifier for the AS2 local profile. * @return Returns a reference to this object so that method calls can be chained together. */ Builder localProfileId(String localProfileId); /** *

* A unique identifier for the partner profile used in the agreement. *

* * @param partnerProfileId * A unique identifier for the partner profile used in the agreement. * @return Returns a reference to this object so that method calls can be chained together. */ Builder partnerProfileId(String partnerProfileId); /** *

* The landing directory (folder) for files transferred by using the AS2 protocol. *

*

* A BaseDirectory example is /DOC-EXAMPLE-BUCKET/home/mydirectory. *

* * @param baseDirectory * The landing directory (folder) for files transferred by using the AS2 protocol.

*

* A BaseDirectory example is /DOC-EXAMPLE-BUCKET/home/mydirectory. * @return Returns a reference to this object so that method calls can be chained together. */ Builder baseDirectory(String baseDirectory); /** *

* Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide the * Amazon Resource Name (ARN) of the Identity and Access Management role to use. *

*

* For AS2 connectors *

*

* With AS2, you can send files by calling StartFileTransfer and specifying the file paths in the * request parameter, SendFilePaths. We use the file’s parent directory (for example, for * --send-file-paths /bucket/dir/file.txt, parent directory is /bucket/dir/) to * temporarily store a processed AS2 message file, store the MDN when we receive them from the partner, and * write a final JSON file containing relevant metadata of the transmission. So, the AccessRole * needs to provide read and write access to the parent directory of the file location used in the * StartFileTransfer request. Additionally, you need to provide read and write access to the parent * directory of the files that you intend to send with StartFileTransfer. *

*

* If you are using Basic authentication for your AS2 connector, the access role requires the * secretsmanager:GetSecretValue permission for the secret. If the secret is encrypted using a * customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the role also * needs the kms:Decrypt permission for that key. *

*

* For SFTP connectors *

*

* Make sure that the access role provides read and write access to the parent directory of the file location * that's used in the StartFileTransfer request. Additionally, make sure that the role provides * secretsmanager:GetSecretValue permission to Secrets Manager. *

* * @param accessRole * Connectors are used to send files using either the AS2 or SFTP protocol. For the access role, provide * the Amazon Resource Name (ARN) of the Identity and Access Management role to use.

*

* For AS2 connectors *

*

* With AS2, you can send files by calling StartFileTransfer and specifying the file paths * in the request parameter, SendFilePaths. We use the file’s parent directory (for example, * for --send-file-paths /bucket/dir/file.txt, parent directory is /bucket/dir/ * ) to temporarily store a processed AS2 message file, store the MDN when we receive them from the * partner, and write a final JSON file containing relevant metadata of the transmission. So, the * AccessRole needs to provide read and write access to the parent directory of the file * location used in the StartFileTransfer request. Additionally, you need to provide read * and write access to the parent directory of the files that you intend to send with * StartFileTransfer. *

*

* If you are using Basic authentication for your AS2 connector, the access role requires the * secretsmanager:GetSecretValue permission for the secret. If the secret is encrypted using * a customer-managed key instead of the Amazon Web Services managed key in Secrets Manager, then the * role also needs the kms:Decrypt permission for that key. *

*

* For SFTP connectors *

*

* Make sure that the access role provides read and write access to the parent directory of the file * location that's used in the StartFileTransfer request. Additionally, make sure that the * role provides secretsmanager:GetSecretValue permission to Secrets Manager. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accessRole(String accessRole); /** *

* The status of the agreement. The agreement can be either ACTIVE or INACTIVE. *

* * @param status * The status of the agreement. The agreement can be either ACTIVE or INACTIVE. * @see AgreementStatusType * @return Returns a reference to this object so that method calls can be chained together. * @see AgreementStatusType */ Builder status(String status); /** *

* The status of the agreement. The agreement can be either ACTIVE or INACTIVE. *

* * @param status * The status of the agreement. The agreement can be either ACTIVE or INACTIVE. * @see AgreementStatusType * @return Returns a reference to this object so that method calls can be chained together. * @see AgreementStatusType */ Builder status(AgreementStatusType status); /** *

* Key-value pairs that can be used to group and search for agreements. *

* * @param tags * Key-value pairs that can be used to group and search for agreements. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* Key-value pairs that can be used to group and search for agreements. *

* * @param tags * Key-value pairs that can be used to group and search for agreements. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* Key-value pairs that can be used to group and search for agreements. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.transfer.model.Tag.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.transfer.model.Tag#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.transfer.model.Tag.Builder#build()} is called immediately and its * result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on * {@link software.amazon.awssdk.services.transfer.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(java.util.Collection) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends TransferRequest.BuilderImpl implements Builder { private String description; private String serverId; private String localProfileId; private String partnerProfileId; private String baseDirectory; private String accessRole; private String status; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateAgreementRequest model) { super(model); description(model.description); serverId(model.serverId); localProfileId(model.localProfileId); partnerProfileId(model.partnerProfileId); baseDirectory(model.baseDirectory); accessRole(model.accessRole); status(model.status); tags(model.tags); } 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 String getServerId() { return serverId; } public final void setServerId(String serverId) { this.serverId = serverId; } @Override public final Builder serverId(String serverId) { this.serverId = serverId; return this; } public final String getLocalProfileId() { return localProfileId; } public final void setLocalProfileId(String localProfileId) { this.localProfileId = localProfileId; } @Override public final Builder localProfileId(String localProfileId) { this.localProfileId = localProfileId; return this; } public final String getPartnerProfileId() { return partnerProfileId; } public final void setPartnerProfileId(String partnerProfileId) { this.partnerProfileId = partnerProfileId; } @Override public final Builder partnerProfileId(String partnerProfileId) { this.partnerProfileId = partnerProfileId; return this; } public final String getBaseDirectory() { return baseDirectory; } public final void setBaseDirectory(String baseDirectory) { this.baseDirectory = baseDirectory; } @Override public final Builder baseDirectory(String baseDirectory) { this.baseDirectory = baseDirectory; return this; } public final String getAccessRole() { return accessRole; } public final void setAccessRole(String accessRole) { this.accessRole = accessRole; } @Override public final Builder accessRole(String accessRole) { this.accessRole = accessRole; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(AgreementStatusType status) { this.status(status == null ? null : status.toString()); return this; } public final List getTags() { List result = TagsCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagsCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagsCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); 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 CreateAgreementRequest build() { return new CreateAgreementRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy