/* * Copyright 2018-2023 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.lambda.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AddPermissionRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *
* The name of the Lambda function, version, or alias. *
** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the full * ARN. If you specify only the function name, it is limited to 64 characters in length. *
*/ private String functionName; /** ** A statement identifier that differentiates the statement from others in the same policy. *
*/ private String statementId; /** *
* The action that the principal can use on the function. For example, lambda:InvokeFunction
or
* lambda:GetFunction
.
*
* The Amazon Web Service or Amazon Web Services account that invokes the function. If you specify a service, use
* SourceArn
or SourceAccount
to limit who can invoke the function through that service.
*
* For Amazon Web Services, the ARN of the Amazon Web Services resource that invokes the function. For example, an * Amazon S3 bucket or Amazon SNS topic. *
*
* Note that Lambda configures the comparison using the StringLike
operator.
*
* For Amazon Web Service, the ID of the Amazon Web Services account that owns the resource. Use this together with
* SourceArn
to ensure that the specified account owns the resource. It is possible for an Amazon S3
* bucket to be deleted by its owner and recreated by another account.
*
* For Alexa Smart Home functions, a token that the invoker must supply. *
*/ private String eventSourceToken; /** ** Specify a version or alias to add permissions to a published version of the function. *
*/ private String qualifier; /** ** Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a * policy that has changed since you last read it. *
*/ private String revisionId; /** ** The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. *
*/ private String principalOrgID; /** *
* The type of authentication that your function URL uses. Set to AWS_IAM
if you want to restrict
* access to authenticated users only. Set to NONE
if you want to bypass IAM authentication to create a
* public endpoint. For more information, see Security and auth model for Lambda function
* URLs.
*
* The name of the Lambda function, version, or alias. *
** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the full * ARN. If you specify only the function name, it is limited to 64 characters in length. *
* * @param functionName * The name of the Lambda function, version, or alias. ** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the * full ARN. If you specify only the function name, it is limited to 64 characters in length. */ public void setFunctionName(String functionName) { this.functionName = functionName; } /** *
* The name of the Lambda function, version, or alias. *
** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the full * ARN. If you specify only the function name, it is limited to 64 characters in length. *
* * @return The name of the Lambda function, version, or alias. ** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the * full ARN. If you specify only the function name, it is limited to 64 characters in length. */ public String getFunctionName() { return this.functionName; } /** *
* The name of the Lambda function, version, or alias. *
** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the full * ARN. If you specify only the function name, it is limited to 64 characters in length. *
* * @param functionName * The name of the Lambda function, version, or alias. ** Name formats *
*
* Function name – my-function
(name-only), my-function:v1
(with alias).
*
* Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function
.
*
* Partial ARN – 123456789012:function:my-function
.
*
* You can append a version number or alias to any of the formats. The length constraint applies only to the * full ARN. If you specify only the function name, it is limited to 64 characters in length. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withFunctionName(String functionName) { setFunctionName(functionName); return this; } /** *
* A statement identifier that differentiates the statement from others in the same policy. *
* * @param statementId * A statement identifier that differentiates the statement from others in the same policy. */ public void setStatementId(String statementId) { this.statementId = statementId; } /** ** A statement identifier that differentiates the statement from others in the same policy. *
* * @return A statement identifier that differentiates the statement from others in the same policy. */ public String getStatementId() { return this.statementId; } /** ** A statement identifier that differentiates the statement from others in the same policy. *
* * @param statementId * A statement identifier that differentiates the statement from others in the same policy. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withStatementId(String statementId) { setStatementId(statementId); return this; } /** *
* The action that the principal can use on the function. For example, lambda:InvokeFunction
or
* lambda:GetFunction
.
*
lambda:InvokeFunction
or
* lambda:GetFunction
.
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* The action that the principal can use on the function. For example, lambda:InvokeFunction
or
* lambda:GetFunction
.
*
lambda:InvokeFunction
or
* lambda:GetFunction
.
*/
public String getAction() {
return this.action;
}
/**
*
* The action that the principal can use on the function. For example, lambda:InvokeFunction
or
* lambda:GetFunction
.
*
lambda:InvokeFunction
or
* lambda:GetFunction
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AddPermissionRequest withAction(String action) {
setAction(action);
return this;
}
/**
*
* The Amazon Web Service or Amazon Web Services account that invokes the function. If you specify a service, use
* SourceArn
or SourceAccount
to limit who can invoke the function through that service.
*
SourceArn
or SourceAccount
to limit who can invoke the function through that
* service.
*/
public void setPrincipal(String principal) {
this.principal = principal;
}
/**
*
* The Amazon Web Service or Amazon Web Services account that invokes the function. If you specify a service, use
* SourceArn
or SourceAccount
to limit who can invoke the function through that service.
*
SourceArn
or SourceAccount
to limit who can invoke the function
* through that service.
*/
public String getPrincipal() {
return this.principal;
}
/**
*
* The Amazon Web Service or Amazon Web Services account that invokes the function. If you specify a service, use
* SourceArn
or SourceAccount
to limit who can invoke the function through that service.
*
SourceArn
or SourceAccount
to limit who can invoke the function through that
* service.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AddPermissionRequest withPrincipal(String principal) {
setPrincipal(principal);
return this;
}
/**
* * For Amazon Web Services, the ARN of the Amazon Web Services resource that invokes the function. For example, an * Amazon S3 bucket or Amazon SNS topic. *
*
* Note that Lambda configures the comparison using the StringLike
operator.
*
* Note that Lambda configures the comparison using the StringLike
operator.
*/
public void setSourceArn(String sourceArn) {
this.sourceArn = sourceArn;
}
/**
*
* For Amazon Web Services, the ARN of the Amazon Web Services resource that invokes the function. For example, an * Amazon S3 bucket or Amazon SNS topic. *
*
* Note that Lambda configures the comparison using the StringLike
operator.
*
* Note that Lambda configures the comparison using the StringLike
operator.
*/
public String getSourceArn() {
return this.sourceArn;
}
/**
*
* For Amazon Web Services, the ARN of the Amazon Web Services resource that invokes the function. For example, an * Amazon S3 bucket or Amazon SNS topic. *
*
* Note that Lambda configures the comparison using the StringLike
operator.
*
* Note that Lambda configures the comparison using the StringLike
operator.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AddPermissionRequest withSourceArn(String sourceArn) {
setSourceArn(sourceArn);
return this;
}
/**
*
* For Amazon Web Service, the ID of the Amazon Web Services account that owns the resource. Use this together with
* SourceArn
to ensure that the specified account owns the resource. It is possible for an Amazon S3
* bucket to be deleted by its owner and recreated by another account.
*
SourceArn
to ensure that the specified account owns the resource. It is
* possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.
*/
public void setSourceAccount(String sourceAccount) {
this.sourceAccount = sourceAccount;
}
/**
*
* For Amazon Web Service, the ID of the Amazon Web Services account that owns the resource. Use this together with
* SourceArn
to ensure that the specified account owns the resource. It is possible for an Amazon S3
* bucket to be deleted by its owner and recreated by another account.
*
SourceArn
to ensure that the specified account owns the resource. It is
* possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.
*/
public String getSourceAccount() {
return this.sourceAccount;
}
/**
*
* For Amazon Web Service, the ID of the Amazon Web Services account that owns the resource. Use this together with
* SourceArn
to ensure that the specified account owns the resource. It is possible for an Amazon S3
* bucket to be deleted by its owner and recreated by another account.
*
SourceArn
to ensure that the specified account owns the resource. It is
* possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public AddPermissionRequest withSourceAccount(String sourceAccount) {
setSourceAccount(sourceAccount);
return this;
}
/**
* * For Alexa Smart Home functions, a token that the invoker must supply. *
* * @param eventSourceToken * For Alexa Smart Home functions, a token that the invoker must supply. */ public void setEventSourceToken(String eventSourceToken) { this.eventSourceToken = eventSourceToken; } /** ** For Alexa Smart Home functions, a token that the invoker must supply. *
* * @return For Alexa Smart Home functions, a token that the invoker must supply. */ public String getEventSourceToken() { return this.eventSourceToken; } /** ** For Alexa Smart Home functions, a token that the invoker must supply. *
* * @param eventSourceToken * For Alexa Smart Home functions, a token that the invoker must supply. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withEventSourceToken(String eventSourceToken) { setEventSourceToken(eventSourceToken); return this; } /** ** Specify a version or alias to add permissions to a published version of the function. *
* * @param qualifier * Specify a version or alias to add permissions to a published version of the function. */ public void setQualifier(String qualifier) { this.qualifier = qualifier; } /** ** Specify a version or alias to add permissions to a published version of the function. *
* * @return Specify a version or alias to add permissions to a published version of the function. */ public String getQualifier() { return this.qualifier; } /** ** Specify a version or alias to add permissions to a published version of the function. *
* * @param qualifier * Specify a version or alias to add permissions to a published version of the function. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withQualifier(String qualifier) { setQualifier(qualifier); return this; } /** ** Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a * policy that has changed since you last read it. *
* * @param revisionId * Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid * modifying a policy that has changed since you last read it. */ public void setRevisionId(String revisionId) { this.revisionId = revisionId; } /** ** Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a * policy that has changed since you last read it. *
* * @return Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid * modifying a policy that has changed since you last read it. */ public String getRevisionId() { return this.revisionId; } /** ** Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid modifying a * policy that has changed since you last read it. *
* * @param revisionId * Update the policy only if the revision ID matches the ID that's specified. Use this option to avoid * modifying a policy that has changed since you last read it. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withRevisionId(String revisionId) { setRevisionId(revisionId); return this; } /** ** The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. *
* * @param principalOrgID * The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. */ public void setPrincipalOrgID(String principalOrgID) { this.principalOrgID = principalOrgID; } /** ** The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. *
* * @return The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon * Web Services accounts under this organization. */ public String getPrincipalOrgID() { return this.principalOrgID; } /** ** The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. *
* * @param principalOrgID * The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web * Services accounts under this organization. * @return Returns a reference to this object so that method calls can be chained together. */ public AddPermissionRequest withPrincipalOrgID(String principalOrgID) { setPrincipalOrgID(principalOrgID); return this; } /** *
* The type of authentication that your function URL uses. Set to AWS_IAM
if you want to restrict
* access to authenticated users only. Set to NONE
if you want to bypass IAM authentication to create a
* public endpoint. For more information, see Security and auth model for Lambda function
* URLs.
*
AWS_IAM
if you want to
* restrict access to authenticated users only. Set to NONE
if you want to bypass IAM
* authentication to create a public endpoint. For more information, see Security and auth model for Lambda
* function URLs.
* @see FunctionUrlAuthType
*/
public void setFunctionUrlAuthType(String functionUrlAuthType) {
this.functionUrlAuthType = functionUrlAuthType;
}
/**
*
* The type of authentication that your function URL uses. Set to AWS_IAM
if you want to restrict
* access to authenticated users only. Set to NONE
if you want to bypass IAM authentication to create a
* public endpoint. For more information, see Security and auth model for Lambda function
* URLs.
*
AWS_IAM
if you want to
* restrict access to authenticated users only. Set to NONE
if you want to bypass IAM
* authentication to create a public endpoint. For more information, see Security and auth model for Lambda
* function URLs.
* @see FunctionUrlAuthType
*/
public String getFunctionUrlAuthType() {
return this.functionUrlAuthType;
}
/**
*
* The type of authentication that your function URL uses. Set to AWS_IAM
if you want to restrict
* access to authenticated users only. Set to NONE
if you want to bypass IAM authentication to create a
* public endpoint. For more information, see Security and auth model for Lambda function
* URLs.
*
AWS_IAM
if you want to
* restrict access to authenticated users only. Set to NONE
if you want to bypass IAM
* authentication to create a public endpoint. For more information, see Security and auth model for Lambda
* function URLs.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FunctionUrlAuthType
*/
public AddPermissionRequest withFunctionUrlAuthType(String functionUrlAuthType) {
setFunctionUrlAuthType(functionUrlAuthType);
return this;
}
/**
*
* The type of authentication that your function URL uses. Set to AWS_IAM
if you want to restrict
* access to authenticated users only. Set to NONE
if you want to bypass IAM authentication to create a
* public endpoint. For more information, see Security and auth model for Lambda function
* URLs.
*
AWS_IAM
if you want to
* restrict access to authenticated users only. Set to NONE
if you want to bypass IAM
* authentication to create a public endpoint. For more information, see Security and auth model for Lambda
* function URLs.
* @return Returns a reference to this object so that method calls can be chained together.
* @see FunctionUrlAuthType
*/
public AddPermissionRequest withFunctionUrlAuthType(FunctionUrlAuthType functionUrlAuthType) {
this.functionUrlAuthType = functionUrlAuthType.toString();
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 (getFunctionName() != null)
sb.append("FunctionName: ").append(getFunctionName()).append(",");
if (getStatementId() != null)
sb.append("StatementId: ").append(getStatementId()).append(",");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getPrincipal() != null)
sb.append("Principal: ").append(getPrincipal()).append(",");
if (getSourceArn() != null)
sb.append("SourceArn: ").append(getSourceArn()).append(",");
if (getSourceAccount() != null)
sb.append("SourceAccount: ").append(getSourceAccount()).append(",");
if (getEventSourceToken() != null)
sb.append("EventSourceToken: ").append(getEventSourceToken()).append(",");
if (getQualifier() != null)
sb.append("Qualifier: ").append(getQualifier()).append(",");
if (getRevisionId() != null)
sb.append("RevisionId: ").append(getRevisionId()).append(",");
if (getPrincipalOrgID() != null)
sb.append("PrincipalOrgID: ").append(getPrincipalOrgID()).append(",");
if (getFunctionUrlAuthType() != null)
sb.append("FunctionUrlAuthType: ").append(getFunctionUrlAuthType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof AddPermissionRequest == false)
return false;
AddPermissionRequest other = (AddPermissionRequest) obj;
if (other.getFunctionName() == null ^ this.getFunctionName() == null)
return false;
if (other.getFunctionName() != null && other.getFunctionName().equals(this.getFunctionName()) == false)
return false;
if (other.getStatementId() == null ^ this.getStatementId() == null)
return false;
if (other.getStatementId() != null && other.getStatementId().equals(this.getStatementId()) == false)
return false;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getPrincipal() == null ^ this.getPrincipal() == null)
return false;
if (other.getPrincipal() != null && other.getPrincipal().equals(this.getPrincipal()) == false)
return false;
if (other.getSourceArn() == null ^ this.getSourceArn() == null)
return false;
if (other.getSourceArn() != null && other.getSourceArn().equals(this.getSourceArn()) == false)
return false;
if (other.getSourceAccount() == null ^ this.getSourceAccount() == null)
return false;
if (other.getSourceAccount() != null && other.getSourceAccount().equals(this.getSourceAccount()) == false)
return false;
if (other.getEventSourceToken() == null ^ this.getEventSourceToken() == null)
return false;
if (other.getEventSourceToken() != null && other.getEventSourceToken().equals(this.getEventSourceToken()) == false)
return false;
if (other.getQualifier() == null ^ this.getQualifier() == null)
return false;
if (other.getQualifier() != null && other.getQualifier().equals(this.getQualifier()) == false)
return false;
if (other.getRevisionId() == null ^ this.getRevisionId() == null)
return false;
if (other.getRevisionId() != null && other.getRevisionId().equals(this.getRevisionId()) == false)
return false;
if (other.getPrincipalOrgID() == null ^ this.getPrincipalOrgID() == null)
return false;
if (other.getPrincipalOrgID() != null && other.getPrincipalOrgID().equals(this.getPrincipalOrgID()) == false)
return false;
if (other.getFunctionUrlAuthType() == null ^ this.getFunctionUrlAuthType() == null)
return false;
if (other.getFunctionUrlAuthType() != null && other.getFunctionUrlAuthType().equals(this.getFunctionUrlAuthType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFunctionName() == null) ? 0 : getFunctionName().hashCode());
hashCode = prime * hashCode + ((getStatementId() == null) ? 0 : getStatementId().hashCode());
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getPrincipal() == null) ? 0 : getPrincipal().hashCode());
hashCode = prime * hashCode + ((getSourceArn() == null) ? 0 : getSourceArn().hashCode());
hashCode = prime * hashCode + ((getSourceAccount() == null) ? 0 : getSourceAccount().hashCode());
hashCode = prime * hashCode + ((getEventSourceToken() == null) ? 0 : getEventSourceToken().hashCode());
hashCode = prime * hashCode + ((getQualifier() == null) ? 0 : getQualifier().hashCode());
hashCode = prime * hashCode + ((getRevisionId() == null) ? 0 : getRevisionId().hashCode());
hashCode = prime * hashCode + ((getPrincipalOrgID() == null) ? 0 : getPrincipalOrgID().hashCode());
hashCode = prime * hashCode + ((getFunctionUrlAuthType() == null) ? 0 : getFunctionUrlAuthType().hashCode());
return hashCode;
}
@Override
public AddPermissionRequest clone() {
return (AddPermissionRequest) super.clone();
}
}