Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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

The AddPermission action adds a permission to a queue for a specific principal. This allows for sharing access to the queue.

When you create a queue, you have full control access rights for the queue. Only you (as owner of the queue) can grant or deny permissions to the queue. For more information about these permissions, see Shared Queues in the Amazon SQS Developer Guide.

 
 public class AddPermissionRequest extends AmazonWebServiceRequest {

    
 
     private String queueUrl;

    
 
     private String label;

    
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
 
     private java.util.List<StringaWSAccountIds;

    
The action the client wants to allow for the specified principal.
 
     private java.util.List<Stringactions;

    
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:
queueUrl
label
aWSAccountIds The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
actions The action the client wants to allow for the specified principal.
 
     public AddPermissionRequest(String queueUrlString labeljava.util.List<StringaWSAccountIdsjava.util.List<Stringactions) {
         this. = queueUrl;
         this. = label;
         this. = aWSAccountIds;
         this. = actions;
     }
    
    

Returns:
 
     public String getQueueUrl() {
         return ;
     }
    
    

Parameters:
queueUrl
 
     public void setQueueUrl(String queueUrl) {
         this. = queueUrl;
     }
    
    

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

Parameters:
queueUrl
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withQueueUrl(String queueUrl) {
        this. = queueUrl;
        return this;
    }
    
    
    

Returns:
    public String getLabel() {
        return ;
    }
    
    

Parameters:
label
    public void setLabel(String label) {
        this. = label;
    }
    
    

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

Parameters:
label
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 number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.

Returns:
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
    public java.util.List<StringgetAWSAccountIds() {
        if ( == null) {
             = new java.util.ArrayList<String>();
        }
        return ;
    }
    
    
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.

Parameters:
aWSAccountIds The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
    public void setAWSAccountIds(java.util.Collection<StringaWSAccountIds) {
        java.util.List<StringaWSAccountIdsCopy = new java.util.ArrayList<String>();
        if (aWSAccountIds != null) {
            aWSAccountIdsCopy.addAll(aWSAccountIds);
        }
        this. = aWSAccountIdsCopy;
    }
    
    
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.

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

Parameters:
aWSAccountIds The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withAWSAccountIds(String... aWSAccountIds) {
        for (String value : aWSAccountIds) {
            getAWSAccountIds().add(value);
        }
        return this;
    }
    
    
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.

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

Parameters:
aWSAccountIds The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS.
Returns:
A reference to this updated object so that method calls can be chained together.
        java.util.List<StringaWSAccountIdsCopy = new java.util.ArrayList<String>();
        if (aWSAccountIds != null) {
            aWSAccountIdsCopy.addAll(aWSAccountIds);
        }
        this. = aWSAccountIdsCopy;
        return this;
    }
    
    
The action the client wants to allow for the specified principal.

Returns:
The action the client wants to allow for the specified principal.
    public java.util.List<StringgetActions() {
        if ( == null) {
             = new java.util.ArrayList<String>();
        }
        return ;
    }
    
    
The action the client wants to allow for the specified principal.

Parameters:
actions The action the client wants to allow for the specified principal.
    public void setActions(java.util.Collection<Stringactions) {
        java.util.List<StringactionsCopy = new java.util.ArrayList<String>();
        if (actions != null) {
            actionsCopy.addAll(actions);
        }
        this. = actionsCopy;
    }
    
    
The action the client wants to allow for the specified principal.

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

Parameters:
actions The action the client wants to allow for the specified principal.
Returns:
A reference to this updated object so that method calls can be chained together.
    public AddPermissionRequest withActions(String... actions) {
        for (String value : actions) {
            getActions().add(value);
        }
        return this;
    }
    
    
The action the client wants to allow for the specified principal.

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

Parameters:
actions The action the client wants to allow for the specified principal.
Returns:
A reference to this updated object so that method calls can be chained together.
        java.util.List<StringactionsCopy = new java.util.ArrayList<String>();
        if (actions != null) {
            actionsCopy.addAll(actions);
        }
        this. = actionsCopy;
        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("{");
        sb.append("QueueUrl: " +  + ", ");
        sb.append("Label: " +  + ", ");
        sb.append("AWSAccountIds: " +  + ", ");
        sb.append("Actions: " +  + ", ");
        sb.append("}");
        return sb.toString();
    }
    
}
    
New to GrepCode? Check out our FAQ X