software.amazon.awssdk.services.organizations.model.HandshakeResource Maven / Gradle / Ivy
Show all versions of organizations 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.organizations.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import javax.annotation.Generated;
import software.amazon.awssdk.annotation.SdkInternalApi;
import software.amazon.awssdk.protocol.ProtocolMarshaller;
import software.amazon.awssdk.protocol.StructuredPojo;
import software.amazon.awssdk.services.organizations.transform.HandshakeResourceMarshaller;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains additional data that is needed to process a handshake.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class HandshakeResource implements StructuredPojo, ToCopyableBuilder {
private final String value;
private final String type;
private final List resources;
private HandshakeResource(BuilderImpl builder) {
this.value = builder.value;
this.type = builder.type;
this.resources = builder.resources;
}
/**
*
* The information that is passed to the other party in the handshake. The format of the value string must match the
* requirements of the specified type.
*
*
* @return The information that is passed to the other party in the handshake. The format of the value string must
* match the requirements of the specified type.
*/
public String value() {
return value;
}
/**
*
* The type of information being passed, specifying how the value is to be interpreted by the other party:
*
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as information about an
* organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the recipient to read.
*
*
*
*
* @return The type of information being passed, specifying how the value is to be interpreted by the other
* party:
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the
* handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as information
* about an organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the recipient
* to read.
*
*
* @see HandshakeResourceType
*/
public String type() {
return type;
}
/**
*
* When needed, contains an additional array of HandshakeResource
objects.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return When needed, contains an additional array of HandshakeResource
objects.
*/
public List resources() {
return resources;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + ((value() == null) ? 0 : value().hashCode());
hashCode = 31 * hashCode + ((type() == null) ? 0 : type().hashCode());
hashCode = 31 * hashCode + ((resources() == null) ? 0 : resources().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof HandshakeResource)) {
return false;
}
HandshakeResource other = (HandshakeResource) obj;
if (other.value() == null ^ this.value() == null) {
return false;
}
if (other.value() != null && !other.value().equals(this.value())) {
return false;
}
if (other.type() == null ^ this.type() == null) {
return false;
}
if (other.type() != null && !other.type().equals(this.type())) {
return false;
}
if (other.resources() == null ^ this.resources() == null) {
return false;
}
if (other.resources() != null && !other.resources().equals(this.resources())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (value() != null) {
sb.append("Value: ").append(value()).append(",");
}
if (type() != null) {
sb.append("Type: ").append(type()).append(",");
}
if (resources() != null) {
sb.append("Resources: ").append(resources()).append(",");
}
sb.append("}");
return sb.toString();
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
HandshakeResourceMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The information that is passed to the other party in the handshake. The format of the value string must match
* the requirements of the specified type.
*
*
* @param value
* The information that is passed to the other party in the handshake. The format of the value string
* must match the requirements of the specified type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder value(String value);
/**
*
* The type of information being passed, specifying how the value is to be interpreted by the other party:
*
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the
* handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as information
* about an organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the recipient to
* read.
*
*
*
*
* @param type
* The type of information being passed, specifying how the value is to be interpreted by the other
* party:
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the
* handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as
* information about an organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the
* recipient to read.
*
*
* @see HandshakeResourceType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HandshakeResourceType
*/
Builder type(String type);
/**
*
* The type of information being passed, specifying how the value is to be interpreted by the other party:
*
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the
* handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as information
* about an organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the recipient to
* read.
*
*
*
*
* @param type
* The type of information being passed, specifying how the value is to be interpreted by the other
* party:
*
* -
*
* ACCOUNT
- Specifies an AWS account ID number.
*
*
* -
*
* ORGANIZATION
- Specifies an organization ID number.
*
*
* -
*
* EMAIL
- Specifies the email address that is associated with the account that receives the
* handshake.
*
*
* -
*
* OWNER_EMAIL
- Specifies the email address associated with the master account. Included as
* information about an organization.
*
*
* -
*
* OWNER_NAME
- Specifies the name associated with the master account. Included as
* information about an organization.
*
*
* -
*
* NOTES
- Additional text provided by the handshake initiator and intended for the
* recipient to read.
*
*
* @see HandshakeResourceType
* @return Returns a reference to this object so that method calls can be chained together.
* @see HandshakeResourceType
*/
Builder type(HandshakeResourceType type);
/**
*
* When needed, contains an additional array of HandshakeResource
objects.
*
*
* @param resources
* When needed, contains an additional array of HandshakeResource
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resources(Collection resources);
/**
*
* When needed, contains an additional array of HandshakeResource
objects.
*
*
* @param resources
* When needed, contains an additional array of HandshakeResource
objects.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resources(HandshakeResource... resources);
}
private static final class BuilderImpl implements Builder {
private String value;
private String type;
private List resources;
private BuilderImpl() {
}
private BuilderImpl(HandshakeResource model) {
setValue(model.value);
setType(model.type);
setResources(model.resources);
}
public final String getValue() {
return value;
}
@Override
public final Builder value(String value) {
this.value = value;
return this;
}
public final void setValue(String value) {
this.value = value;
}
public final String getType() {
return type;
}
@Override
public final Builder type(String type) {
this.type = type;
return this;
}
@Override
public final Builder type(HandshakeResourceType type) {
this.type(type.toString());
return this;
}
public final void setType(String type) {
this.type = type;
}
public final Collection getResources() {
return resources;
}
@Override
public final Builder resources(Collection resources) {
this.resources = HandshakeResourcesCopier.copy(resources);
return this;
}
@Override
@SafeVarargs
public final Builder resources(HandshakeResource... resources) {
resources(Arrays.asList(resources));
return this;
}
public final void setResources(Collection resources) {
this.resources = HandshakeResourcesCopier.copy(resources);
}
@Override
public HandshakeResource build() {
return new HandshakeResource(this);
}
}
}