
software.amazon.awssdk.services.transfer.model.UpdateAgreementRequest 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.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 UpdateAgreementRequest extends TransferRequest implements
ToCopyableBuilder {
private static final SdkField AGREEMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AgreementId").getter(getter(UpdateAgreementRequest::agreementId)).setter(setter(Builder::agreementId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AgreementId").build()).build();
private static final SdkField SERVER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServerId").getter(getter(UpdateAgreementRequest::serverId)).setter(setter(Builder::serverId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerId").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(UpdateAgreementRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(UpdateAgreementRequest::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField LOCAL_PROFILE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LocalProfileId").getter(getter(UpdateAgreementRequest::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(UpdateAgreementRequest::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(UpdateAgreementRequest::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(UpdateAgreementRequest::accessRole)).setter(setter(Builder::accessRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AccessRole").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AGREEMENT_ID_FIELD,
SERVER_ID_FIELD, DESCRIPTION_FIELD, STATUS_FIELD, LOCAL_PROFILE_ID_FIELD, PARTNER_PROFILE_ID_FIELD,
BASE_DIRECTORY_FIELD, ACCESS_ROLE_FIELD));
private final String agreementId;
private final String serverId;
private final String description;
private final String status;
private final String localProfileId;
private final String partnerProfileId;
private final String baseDirectory;
private final String accessRole;
private UpdateAgreementRequest(BuilderImpl builder) {
super(builder);
this.agreementId = builder.agreementId;
this.serverId = builder.serverId;
this.description = builder.description;
this.status = builder.status;
this.localProfileId = builder.localProfileId;
this.partnerProfileId = builder.partnerProfileId;
this.baseDirectory = builder.baseDirectory;
this.accessRole = builder.accessRole;
}
/**
*
* A unique identifier for the agreement. This identifier is returned when you create an agreement.
*
*
* @return A unique identifier for the agreement. This identifier is returned when you create an agreement.
*/
public final String agreementId() {
return agreementId;
}
/**
*
* 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;
}
/**
*
* To replace the existing description, provide a short description for the agreement.
*
*
* @return To replace the existing description, provide a short description for the agreement.
*/
public final String description() {
return description;
}
/**
*
* You can update the status for the agreement, either activating an inactive agreement or the reverse.
*
*
* 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 You can update the status for the agreement, either activating an inactive agreement or the reverse.
* @see AgreementStatusType
*/
public final AgreementStatusType status() {
return AgreementStatusType.fromValue(status);
}
/**
*
* You can update the status for the agreement, either activating an inactive agreement or the reverse.
*
*
* 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 You can update the status for the agreement, either activating an inactive agreement or the reverse.
* @see AgreementStatusType
*/
public final String statusAsString() {
return status;
}
/**
*
* A unique identifier for the AS2 local profile.
*
*
* To change the local profile identifier, provide a new value here.
*
*
* @return A unique identifier for the AS2 local profile.
*
* To change the local profile identifier, provide a new value here.
*/
public final String localProfileId() {
return localProfileId;
}
/**
*
* A unique identifier for the partner profile. To change the partner profile identifier, provide a new value here.
*
*
* @return A unique identifier for the partner profile. To change the partner profile identifier, provide a new
* value here.
*/
public final String partnerProfileId() {
return partnerProfileId;
}
/**
*
* To change the landing directory (folder) for files that are transferred, provide the bucket folder that you want
* to use; for example, /DOC-EXAMPLE-BUCKET/home/mydirectory
.
*
*
* @return To change the landing directory (folder) for files that are transferred, provide the bucket folder that
* you want to use; for example, /DOC-EXAMPLE-BUCKET/home/mydirectory
.
*/
public final String baseDirectory() {
return baseDirectory;
}
/**
*
* 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
.
*
*
* @return 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
.
*/
public final String accessRole() {
return accessRole;
}
@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(agreementId());
hashCode = 31 * hashCode + Objects.hashCode(serverId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(localProfileId());
hashCode = 31 * hashCode + Objects.hashCode(partnerProfileId());
hashCode = 31 * hashCode + Objects.hashCode(baseDirectory());
hashCode = 31 * hashCode + Objects.hashCode(accessRole());
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 UpdateAgreementRequest)) {
return false;
}
UpdateAgreementRequest other = (UpdateAgreementRequest) obj;
return Objects.equals(agreementId(), other.agreementId()) && Objects.equals(serverId(), other.serverId())
&& Objects.equals(description(), other.description()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(localProfileId(), other.localProfileId())
&& Objects.equals(partnerProfileId(), other.partnerProfileId())
&& Objects.equals(baseDirectory(), other.baseDirectory()) && Objects.equals(accessRole(), other.accessRole());
}
/**
* 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("UpdateAgreementRequest").add("AgreementId", agreementId()).add("ServerId", serverId())
.add("Description", description()).add("Status", statusAsString()).add("LocalProfileId", localProfileId())
.add("PartnerProfileId", partnerProfileId()).add("BaseDirectory", baseDirectory())
.add("AccessRole", accessRole()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AgreementId":
return Optional.ofNullable(clazz.cast(agreementId()));
case "ServerId":
return Optional.ofNullable(clazz.cast(serverId()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
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()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function