software.amazon.awssdk.services.databasemigration.model.ImportCertificateRequest Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2012-2017 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.databasemigration.model;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AwsRequestOverrideConfig;
import software.amazon.awssdk.core.runtime.StandardMemberCopier;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public class ImportCertificateRequest extends DatabaseMigrationRequest implements
ToCopyableBuilder {
private final String certificateIdentifier;
private final String certificatePem;
private final ByteBuffer certificateWallet;
private final List tags;
private ImportCertificateRequest(BuilderImpl builder) {
super(builder);
this.certificateIdentifier = builder.certificateIdentifier;
this.certificatePem = builder.certificatePem;
this.certificateWallet = builder.certificateWallet;
this.tags = builder.tags;
}
/**
*
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*
*
* @return The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*/
public String certificateIdentifier() {
return certificateIdentifier;
}
/**
*
* The contents of the .pem X.509 certificate file for the certificate.
*
*
* @return The contents of the .pem X.509 certificate file for the certificate.
*/
public String certificatePem() {
return certificatePem;
}
/**
*
* The location of the imported Oracle Wallet certificate for use with SSL.
*
*
* This method will return a new read-only {@code ByteBuffer} each time it is invoked.
*
*
* @return The location of the imported Oracle Wallet certificate for use with SSL.
*/
public ByteBuffer certificateWallet() {
return certificateWallet == null ? null : certificateWallet.asReadOnlyBuffer();
}
/**
*
* The tags associated with the certificate.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The tags associated with the certificate.
*/
public List tags() {
return tags;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(certificateIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(certificatePem());
hashCode = 31 * hashCode + Objects.hashCode(certificateWallet());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ImportCertificateRequest)) {
return false;
}
ImportCertificateRequest other = (ImportCertificateRequest) obj;
return Objects.equals(certificateIdentifier(), other.certificateIdentifier())
&& Objects.equals(certificatePem(), other.certificatePem())
&& Objects.equals(certificateWallet(), other.certificateWallet()) && Objects.equals(tags(), other.tags());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (certificateIdentifier() != null) {
sb.append("CertificateIdentifier: ").append(certificateIdentifier()).append(",");
}
if (certificatePem() != null) {
sb.append("CertificatePem: ").append(certificatePem()).append(",");
}
if (certificateWallet() != null) {
sb.append("CertificateWallet: ").append(certificateWallet()).append(",");
}
if (tags() != null) {
sb.append("Tags: ").append(tags()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateIdentifier":
return Optional.of(clazz.cast(certificateIdentifier()));
case "CertificatePem":
return Optional.of(clazz.cast(certificatePem()));
case "CertificateWallet":
return Optional.of(clazz.cast(certificateWallet()));
case "Tags":
return Optional.of(clazz.cast(tags()));
default:
return Optional.empty();
}
}
public interface Builder extends DatabaseMigrationRequest.Builder, CopyableBuilder {
/**
*
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*
*
* @param certificateIdentifier
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateIdentifier(String certificateIdentifier);
/**
*
* The contents of the .pem X.509 certificate file for the certificate.
*
*
* @param certificatePem
* The contents of the .pem X.509 certificate file for the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificatePem(String certificatePem);
/**
*
* The location of the imported Oracle Wallet certificate for use with SSL.
*
*
* To preserve immutability, the remaining bytes in the provided buffer will be copied into a new buffer when
* set.
*
*
* @param certificateWallet
* The location of the imported Oracle Wallet certificate for use with SSL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateWallet(ByteBuffer certificateWallet);
/**
*
* The tags associated with the certificate.
*
*
* @param tags
* The tags associated with the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Collection tags);
/**
*
* The tags associated with the certificate.
*
*
* @param tags
* The tags associated with the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Tag... tags);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends DatabaseMigrationRequest.BuilderImpl implements Builder {
private String certificateIdentifier;
private String certificatePem;
private ByteBuffer certificateWallet;
private List tags;
private BuilderImpl() {
}
private BuilderImpl(ImportCertificateRequest model) {
certificateIdentifier(model.certificateIdentifier);
certificatePem(model.certificatePem);
certificateWallet(model.certificateWallet);
tags(model.tags);
}
public final String getCertificateIdentifier() {
return certificateIdentifier;
}
@Override
public final Builder certificateIdentifier(String certificateIdentifier) {
this.certificateIdentifier = certificateIdentifier;
return this;
}
public final void setCertificateIdentifier(String certificateIdentifier) {
this.certificateIdentifier = certificateIdentifier;
}
public final String getCertificatePem() {
return certificatePem;
}
@Override
public final Builder certificatePem(String certificatePem) {
this.certificatePem = certificatePem;
return this;
}
public final void setCertificatePem(String certificatePem) {
this.certificatePem = certificatePem;
}
public final ByteBuffer getCertificateWallet() {
return certificateWallet;
}
@Override
public final Builder certificateWallet(ByteBuffer certificateWallet) {
this.certificateWallet = StandardMemberCopier.copy(certificateWallet);
return this;
}
public final void setCertificateWallet(ByteBuffer certificateWallet) {
this.certificateWallet = StandardMemberCopier.copy(certificateWallet);
}
public final Collection getTags() {
return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder tags(Collection tags) {
this.tags = TagListCopier.copy(tags);
return this;
}
@Override
@SafeVarargs
public final Builder tags(Tag... tags) {
tags(Arrays.asList(tags));
return this;
}
public final void setTags(Collection tags) {
this.tags = TagListCopier.copyFromBuilder(tags);
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public ImportCertificateRequest build() {
return new ImportCertificateRequest(this);
}
}
}