com.amazonaws.services.simplesystemsmanagement.model.AttachmentsSource Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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 com.amazonaws.services.simplesystemsmanagement.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Identifying information about a document attachment, including the file name and a key-value pair that identifies the
* location of an attachment to a document.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AttachmentsSource implements Serializable, Cloneable, StructuredPojo {
/**
*
* The key of a key-value pair that identifies the location of an attachment to a document.
*
*/
private String key;
/**
*
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in your
* account, a version number of that document, and a file attached to that document version that you want to reuse.
* For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be specified
* instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*
*/
private com.amazonaws.internal.SdkInternalList values;
/**
*
* The name of the document attachment file.
*
*/
private String name;
/**
*
* The key of a key-value pair that identifies the location of an attachment to a document.
*
*
* @param key
* The key of a key-value pair that identifies the location of an attachment to a document.
* @see AttachmentsSourceKey
*/
public void setKey(String key) {
this.key = key;
}
/**
*
* The key of a key-value pair that identifies the location of an attachment to a document.
*
*
* @return The key of a key-value pair that identifies the location of an attachment to a document.
* @see AttachmentsSourceKey
*/
public String getKey() {
return this.key;
}
/**
*
* The key of a key-value pair that identifies the location of an attachment to a document.
*
*
* @param key
* The key of a key-value pair that identifies the location of an attachment to a document.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AttachmentsSourceKey
*/
public AttachmentsSource withKey(String key) {
setKey(key);
return this;
}
/**
*
* The key of a key-value pair that identifies the location of an attachment to a document.
*
*
* @param key
* The key of a key-value pair that identifies the location of an attachment to a document.
* @return Returns a reference to this object so that method calls can be chained together.
* @see AttachmentsSourceKey
*/
public AttachmentsSource withKey(AttachmentsSourceKey key) {
this.key = key.toString();
return this;
}
/**
*
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in your
* account, a version number of that document, and a file attached to that document version that you want to reuse.
* For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be specified
* instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*
*
* @return The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in
* your account, a version number of that document, and a file attached to that document version that you
* want to reuse. For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be
* specified instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*/
public java.util.List getValues() {
if (values == null) {
values = new com.amazonaws.internal.SdkInternalList();
}
return values;
}
/**
*
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in your
* account, a version number of that document, and a file attached to that document version that you want to reuse.
* For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be specified
* instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*
*
* @param values
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in
* your account, a version number of that document, and a file attached to that document version that you
* want to reuse. For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be
* specified instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*/
public void setValues(java.util.Collection values) {
if (values == null) {
this.values = null;
return;
}
this.values = new com.amazonaws.internal.SdkInternalList(values);
}
/**
*
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in your
* account, a version number of that document, and a file attached to that document version that you want to reuse.
* For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be specified
* instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setValues(java.util.Collection)} or {@link #withValues(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param values
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in
* your account, a version number of that document, and a file attached to that document version that you
* want to reuse. For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be
* specified instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AttachmentsSource withValues(String... values) {
if (this.values == null) {
setValues(new com.amazonaws.internal.SdkInternalList(values.length));
}
for (String ele : values) {
this.values.add(ele);
}
return this;
}
/**
*
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in your
* account, a version number of that document, and a file attached to that document version that you want to reuse.
* For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be specified
* instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
*
*
* @param values
* The value of a key-value pair that identifies the location of an attachment to a document. The format for
* Value depends on the type of key you specify.
*
* -
*
* For the key SourceUrl, the value is an S3 bucket location. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder" ]
*
*
* -
*
* For the key S3FileUrl, the value is a file in an S3 bucket. For example:
*
*
* "Values": [ "s3://doc-example-bucket/my-folder/my-file.py" ]
*
*
* -
*
* For the key AttachmentReference, the value is constructed from the name of another SSM document in
* your account, a version number of that document, and a file attached to that document version that you
* want to reuse. For example:
*
*
* "Values": [ "MyOtherDocument/3/my-other-file.py" ]
*
*
* However, if the SSM document is shared with you from another account, the full SSM document ARN must be
* specified instead of the document name only. For example:
*
*
* "Values": [ "arn:aws:ssm:us-east-2:111122223333:document/OtherAccountDocument/3/their-file.py" ]
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AttachmentsSource withValues(java.util.Collection values) {
setValues(values);
return this;
}
/**
*
* The name of the document attachment file.
*
*
* @param name
* The name of the document attachment file.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the document attachment file.
*
*
* @return The name of the document attachment file.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the document attachment file.
*
*
* @param name
* The name of the document attachment file.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AttachmentsSource withName(String name) {
setName(name);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKey() != null)
sb.append("Key: ").append(getKey()).append(",");
if (getValues() != null)
sb.append("Values: ").append(getValues()).append(",");
if (getName() != null)
sb.append("Name: ").append(getName());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AttachmentsSource == false)
return false;
AttachmentsSource other = (AttachmentsSource) obj;
if (other.getKey() == null ^ this.getKey() == null)
return false;
if (other.getKey() != null && other.getKey().equals(this.getKey()) == false)
return false;
if (other.getValues() == null ^ this.getValues() == null)
return false;
if (other.getValues() != null && other.getValues().equals(this.getValues()) == false)
return false;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null && other.getName().equals(this.getName()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode());
hashCode = prime * hashCode + ((getValues() == null) ? 0 : getValues().hashCode());
hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
return hashCode;
}
@Override
public AttachmentsSource clone() {
try {
return (AttachmentsSource) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.simplesystemsmanagement.model.transform.AttachmentsSourceMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}