Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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.sns.model;
 
 
Container for the parameters to the AddPermission operation.

Adds a statement to a topic's access control policy, granting access for the specified AWS accounts to the specified actions.

 
 public class AddPermissionRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The ARN of the topic whose access control policy you wish to modify.
 
     private String topicArn;

    
A unique identifier for the new policy statement.
 
     private String label;

    
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
 
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

 
Default constructor for a new AddPermissionRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public AddPermissionRequest() {}
    
    
Constructs a new AddPermissionRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
topicArn The ARN of the topic whose access control policy you wish to modify.
label A unique identifier for the new policy statement.
aWSAccountIds The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
actionNames The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

 
     public AddPermissionRequest(String topicArnString labeljava.util.List<StringaWSAccountIdsjava.util.List<StringactionNames) {
         setTopicArn(topicArn);
         setLabel(label);
         setAWSAccountIds(aWSAccountIds);
         setActionNames(actionNames);
     }

    
The ARN of the topic whose access control policy you wish to modify.

Returns:
The ARN of the topic whose access control policy you wish to modify.
 
     public String getTopicArn() {
         return ;
     }
    
    
The ARN of the topic whose access control policy you wish to modify.

Parameters:
topicArn The ARN of the topic whose access control policy you wish to modify.
 
     public void setTopicArn(String topicArn) {
         this. = topicArn;
     }
    
    
The ARN of the topic whose access control policy you wish to modify.

Returns a reference to this object so that method calls can be chained together.

Parameters:
topicArn The ARN of the topic whose access control policy you wish to modify.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withTopicArn(String topicArn) {
        this. = topicArn;
        return this;
    }

    
A unique identifier for the new policy statement.

Returns:
A unique identifier for the new policy statement.
    public String getLabel() {
        return ;
    }
    
    
A unique identifier for the new policy statement.

Parameters:
label A unique identifier for the new policy statement.
    public void setLabel(String label) {
        this. = label;
    }
    
    
A unique identifier for the new policy statement.

Returns a reference to this object so that method calls can be chained together.

Parameters:
label A unique identifier for the new policy statement.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withLabel(String label) {
        this. = label;
        return this;
    }

    
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.

Returns:
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
    public java.util.List<StringgetAWSAccountIds() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.

Parameters:
aWSAccountIds The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
    public void setAWSAccountIds(java.util.Collection<StringaWSAccountIds) {
        if (aWSAccountIds == null) {
            this. = null;
            return;
        }
        com.amazonaws.internal.ListWithAutoConstructFlag<StringaWSAccountIdsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(aWSAccountIds.size());
        aWSAccountIdsCopy.addAll(aWSAccountIds);
        this. = aWSAccountIdsCopy;
    }
    
    
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.

NOTE: This method appends the values to the existing list (if any). Use setAWSAccountIds(java.util.Collection) or withAWSAccountIds(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
aWSAccountIds The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withAWSAccountIds(String... aWSAccountIds) {
        if (getAWSAccountIds() == nullsetAWSAccountIds(new java.util.ArrayList<String>(aWSAccountIds.length));
        for (String value : aWSAccountIds) {
            getAWSAccountIds().add(value);
        }
        return this;
    }
    
    
The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.

Returns a reference to this object so that method calls can be chained together.

Parameters:
aWSAccountIds The AWS account IDs of the users (principals) who will be given access to the specified actions. The users must have AWS accounts, but do not need to be signed up for this service.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (aWSAccountIds == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringaWSAccountIdsCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(aWSAccountIds.size());
            aWSAccountIdsCopy.addAll(aWSAccountIds);
            this. = aWSAccountIdsCopy;
        }
        return this;
    }

    
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

Returns:
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

    public java.util.List<StringgetActionNames() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

Parameters:
actionNames The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

    public void setActionNames(java.util.Collection<StringactionNames) {
        if (actionNames == null) {
            this. = null;
            return;
        }
        actionNamesCopy.addAll(actionNames);
        this. = actionNamesCopy;
    }
    
    
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

NOTE: This method appends the values to the existing list (if any). Use setActionNames(java.util.Collection) or withActionNames(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
actionNames The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withActionNames(String... actionNames) {
        if (getActionNames() == nullsetActionNames(new java.util.ArrayList<String>(actionNames.length));
        for (String value : actionNames) {
            getActionNames().add(value);
        }
        return this;
    }
    
    
The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

Returns a reference to this object so that method calls can be chained together.

Parameters:
actionNames The action you want to allow for the specified principal(s).

Valid values: any Amazon SNS action name.

Returns:
A reference to this updated object so that method calls can be chained together.
        if (actionNames == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringactionNamesCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(actionNames.size());
            actionNamesCopy.addAll(actionNames);
            this. = actionNamesCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTopicArn() != nullsb.append("TopicArn: " + getTopicArn() + ",");
        if (getLabel() != nullsb.append("Label: " + getLabel() + ",");
        if (getAWSAccountIds() != nullsb.append("AWSAccountIds: " + getAWSAccountIds() + ",");
        if (getActionNames() != nullsb.append("ActionNames: " + getActionNames() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); 
        hashCode = prime * hashCode + ((getLabel() == null) ? 0 : getLabel().hashCode()); 
        hashCode = prime * hashCode + ((getAWSAccountIds() == null) ? 0 : getAWSAccountIds().hashCode()); 
        hashCode = prime * hashCode + ((getActionNames() == null) ? 0 : getActionNames().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof AddPermissionRequest == falsereturn false;
        AddPermissionRequest other = (AddPermissionRequest)obj;
        
        if (other.getTopicArn() == null ^ this.getTopicArn() == nullreturn false;
        if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == falsereturn false
        if (other.getLabel() == null ^ this.getLabel() == nullreturn false;
        if (other.getLabel() != null && other.getLabel().equals(this.getLabel()) == falsereturn false
        if (other.getAWSAccountIds() == null ^ this.getAWSAccountIds() == nullreturn false;
        if (other.getAWSAccountIds() != null && other.getAWSAccountIds().equals(this.getAWSAccountIds()) == falsereturn false
        if (other.getActionNames() == null ^ this.getActionNames() == nullreturn false;
        if (other.getActionNames() != null && other.getActionNames().equals(this.getActionNames()) == falsereturn false
        return true;
    }
    
    @Override
    public AddPermissionRequest clone() {
        
            return (AddPermissionRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X