
com.amazonaws.services.kms.model.CreateGrantRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kms Show documentation
/*
* Copyright 2010-2016 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.kms.model;
import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
*/
public class CreateGrantRequest extends AmazonWebServiceRequest implements
Serializable, Cloneable {
/**
*
* The unique identifier for the customer master key (CMK) that the grant
* applies to.
*
*
* To specify this value, use the globally unique key ID or the Amazon
* Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-
* 123456789012
*
*
*
*/
private String keyId;
/**
*
* The principal that is given permission to perform the operations that the
* grant permits.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*/
private String granteePrincipal;
/**
*
* The principal that is given permission to retire the grant by using
* RetireGrant operation.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*/
private String retiringPrincipal;
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*/
private com.amazonaws.internal.SdkInternalList operations;
/**
*
* The conditions under which the operations permitted by the grant are
* allowed.
*
*
* You can use this value to allow the operations permitted by the grant
* only when a specified encryption context is present. For more
* information, see Encryption Context in the AWS Key Management Service Developer
* Guide.
*
*/
private GrantConstraints constraints;
/**
*
* A list of grant tokens.
*
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*
*/
private com.amazonaws.internal.SdkInternalList grantTokens;
/**
*
* A friendly name for identifying the grant. Use this value to prevent
* unintended creation of duplicate grants when retrying this request.
*
*
* When this value is absent, all CreateGrant
requests result
* in a new grant with a unique GrantId
even if all the
* supplied parameters are identical. This can result in unintended
* duplicates when you retry the CreateGrant
request.
*
*
* When this value is present, you can retry a CreateGrant
* request with identical parameters; if the grant already exists, the
* original GrantId
is returned without creating a new grant.
* Note that the returned grant token is unique with every
* CreateGrant
request, even when a duplicate
* GrantId
is returned. All grant tokens obtained in this way
* can be used interchangeably.
*
*/
private String name;
/**
*
* The unique identifier for the customer master key (CMK) that the grant
* applies to.
*
*
* To specify this value, use the globally unique key ID or the Amazon
* Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-
* 123456789012
*
*
*
*
* @param keyId
* The unique identifier for the customer master key (CMK) that the
* grant applies to.
*
* To specify this value, use the globally unique key ID or the
* Amazon Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN:
* arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-
* 1234-123456789012
*
*
*/
public void setKeyId(String keyId) {
this.keyId = keyId;
}
/**
*
* The unique identifier for the customer master key (CMK) that the grant
* applies to.
*
*
* To specify this value, use the globally unique key ID or the Amazon
* Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-
* 123456789012
*
*
*
*
* @return The unique identifier for the customer master key (CMK) that the
* grant applies to.
*
* To specify this value, use the globally unique key ID or the
* Amazon Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN:
* arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234
* -1234-123456789012
*
*
*/
public String getKeyId() {
return this.keyId;
}
/**
*
* The unique identifier for the customer master key (CMK) that the grant
* applies to.
*
*
* To specify this value, use the globally unique key ID or the Amazon
* Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN: arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-
* 123456789012
*
*
*
*
* @param keyId
* The unique identifier for the customer master key (CMK) that the
* grant applies to.
*
* To specify this value, use the globally unique key ID or the
* Amazon Resource Name (ARN) of the key. Examples:
*
*
* -
*
* Globally unique key ID: 12345678-1234-1234-1234-123456789012
*
*
* -
*
* Key ARN:
* arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-
* 1234-123456789012
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withKeyId(String keyId) {
setKeyId(keyId);
return this;
}
/**
*
* The principal that is given permission to perform the operations that the
* grant permits.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @param granteePrincipal
* The principal that is given permission to perform the operations
* that the grant permits.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
*/
public void setGranteePrincipal(String granteePrincipal) {
this.granteePrincipal = granteePrincipal;
}
/**
*
* The principal that is given permission to perform the operations that the
* grant permits.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @return The principal that is given permission to perform the operations
* that the grant permits.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
*/
public String getGranteePrincipal() {
return this.granteePrincipal;
}
/**
*
* The principal that is given permission to perform the operations that the
* grant permits.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @param granteePrincipal
* The principal that is given permission to perform the operations
* that the grant permits.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withGranteePrincipal(String granteePrincipal) {
setGranteePrincipal(granteePrincipal);
return this;
}
/**
*
* The principal that is given permission to retire the grant by using
* RetireGrant operation.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @param retiringPrincipal
* The principal that is given permission to retire the grant by
* using RetireGrant operation.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
*/
public void setRetiringPrincipal(String retiringPrincipal) {
this.retiringPrincipal = retiringPrincipal;
}
/**
*
* The principal that is given permission to retire the grant by using
* RetireGrant operation.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @return The principal that is given permission to retire the grant by
* using RetireGrant operation.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
*/
public String getRetiringPrincipal() {
return this.retiringPrincipal;
}
/**
*
* The principal that is given permission to retire the grant by using
* RetireGrant operation.
*
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals
* include AWS accounts (root), IAM users, federated users, and assumed role
* users. For examples of the ARN syntax to use for specifying a principal,
* see AWS Identity and Access Management (IAM) in the Example ARNs section
* of the AWS General Reference.
*
*
* @param retiringPrincipal
* The principal that is given permission to retire the grant by
* using RetireGrant operation.
*
* To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS
* principals include AWS accounts (root), IAM users, federated
* users, and assumed role users. For examples of the ARN syntax to
* use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs
* section of the AWS General Reference.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withRetiringPrincipal(String retiringPrincipal) {
setRetiringPrincipal(retiringPrincipal);
return this;
}
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*
* @return A list of operations that the grant permits. The list can contain
* any combination of one or more of the following values:
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
* @see GrantOperation
*/
public java.util.List getOperations() {
if (operations == null) {
operations = new com.amazonaws.internal.SdkInternalList();
}
return operations;
}
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*
* @param operations
* A list of operations that the grant permits. The list can contain
* any combination of one or more of the following values:
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
* @see GrantOperation
*/
public void setOperations(java.util.Collection operations) {
if (operations == null) {
this.operations = null;
return;
}
this.operations = new com.amazonaws.internal.SdkInternalList(
operations);
}
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setOperations(java.util.Collection)} or
* {@link #withOperations(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param operations
* A list of operations that the grant permits. The list can contain
* any combination of one or more of the following values:
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see GrantOperation
*/
public CreateGrantRequest withOperations(String... operations) {
if (this.operations == null) {
setOperations(new com.amazonaws.internal.SdkInternalList(
operations.length));
}
for (String ele : operations) {
this.operations.add(ele);
}
return this;
}
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*
* @param operations
* A list of operations that the grant permits. The list can contain
* any combination of one or more of the following values:
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see GrantOperation
*/
public CreateGrantRequest withOperations(
java.util.Collection operations) {
setOperations(operations);
return this;
}
/**
*
* A list of operations that the grant permits. The list can contain any
* combination of one or more of the following values:
*
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
*
*
* @param operations
* A list of operations that the grant permits. The list can contain
* any combination of one or more of the following values:
*
* -
*
* Decrypt
*
*
* -
*
* Encrypt
*
*
* -
*
* GenerateDataKey
*
*
* -
*
*
* -
*
* ReEncryptFrom
*
*
* -
*
* ReEncryptTo
*
*
* -
*
* CreateGrant
*
*
* -
*
* RetireGrant
*
*
* -
*
* DescribeKey
*
*
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see GrantOperation
*/
public CreateGrantRequest withOperations(GrantOperation... operations) {
com.amazonaws.internal.SdkInternalList operationsCopy = new com.amazonaws.internal.SdkInternalList(
operations.length);
for (GrantOperation value : operations) {
operationsCopy.add(value.toString());
}
if (getOperations() == null) {
setOperations(operationsCopy);
} else {
getOperations().addAll(operationsCopy);
}
return this;
}
/**
*
* The conditions under which the operations permitted by the grant are
* allowed.
*
*
* You can use this value to allow the operations permitted by the grant
* only when a specified encryption context is present. For more
* information, see Encryption Context in the AWS Key Management Service Developer
* Guide.
*
*
* @param constraints
* The conditions under which the operations permitted by the grant
* are allowed.
*
* You can use this value to allow the operations permitted by the
* grant only when a specified encryption context is present. For
* more information, see Encryption Context in the AWS Key Management Service
* Developer Guide.
*/
public void setConstraints(GrantConstraints constraints) {
this.constraints = constraints;
}
/**
*
* The conditions under which the operations permitted by the grant are
* allowed.
*
*
* You can use this value to allow the operations permitted by the grant
* only when a specified encryption context is present. For more
* information, see Encryption Context in the AWS Key Management Service Developer
* Guide.
*
*
* @return The conditions under which the operations permitted by the grant
* are allowed.
*
* You can use this value to allow the operations permitted by the
* grant only when a specified encryption context is present. For
* more information, see Encryption Context in the AWS Key Management Service
* Developer Guide.
*/
public GrantConstraints getConstraints() {
return this.constraints;
}
/**
*
* The conditions under which the operations permitted by the grant are
* allowed.
*
*
* You can use this value to allow the operations permitted by the grant
* only when a specified encryption context is present. For more
* information, see Encryption Context in the AWS Key Management Service Developer
* Guide.
*
*
* @param constraints
* The conditions under which the operations permitted by the grant
* are allowed.
*
* You can use this value to allow the operations permitted by the
* grant only when a specified encryption context is present. For
* more information, see Encryption Context in the AWS Key Management Service
* Developer Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withConstraints(GrantConstraints constraints) {
setConstraints(constraints);
return this;
}
/**
*
* A list of grant tokens.
*
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*
*
* @return A list of grant tokens.
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*/
public java.util.List getGrantTokens() {
if (grantTokens == null) {
grantTokens = new com.amazonaws.internal.SdkInternalList();
}
return grantTokens;
}
/**
*
* A list of grant tokens.
*
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*
*
* @param grantTokens
* A list of grant tokens.
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*/
public void setGrantTokens(java.util.Collection grantTokens) {
if (grantTokens == null) {
this.grantTokens = null;
return;
}
this.grantTokens = new com.amazonaws.internal.SdkInternalList(
grantTokens);
}
/**
*
* A list of grant tokens.
*
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setGrantTokens(java.util.Collection)} or
* {@link #withGrantTokens(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param grantTokens
* A list of grant tokens.
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withGrantTokens(String... grantTokens) {
if (this.grantTokens == null) {
setGrantTokens(new com.amazonaws.internal.SdkInternalList(
grantTokens.length));
}
for (String ele : grantTokens) {
this.grantTokens.add(ele);
}
return this;
}
/**
*
* A list of grant tokens.
*
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
*
*
* @param grantTokens
* A list of grant tokens.
*
* For more information, see Grant Tokens in the AWS Key Management Service Developer
* Guide.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withGrantTokens(
java.util.Collection grantTokens) {
setGrantTokens(grantTokens);
return this;
}
/**
*
* A friendly name for identifying the grant. Use this value to prevent
* unintended creation of duplicate grants when retrying this request.
*
*
* When this value is absent, all CreateGrant
requests result
* in a new grant with a unique GrantId
even if all the
* supplied parameters are identical. This can result in unintended
* duplicates when you retry the CreateGrant
request.
*
*
* When this value is present, you can retry a CreateGrant
* request with identical parameters; if the grant already exists, the
* original GrantId
is returned without creating a new grant.
* Note that the returned grant token is unique with every
* CreateGrant
request, even when a duplicate
* GrantId
is returned. All grant tokens obtained in this way
* can be used interchangeably.
*
*
* @param name
* A friendly name for identifying the grant. Use this value to
* prevent unintended creation of duplicate grants when retrying this
* request.
*
* When this value is absent, all CreateGrant
requests
* result in a new grant with a unique GrantId
even if
* all the supplied parameters are identical. This can result in
* unintended duplicates when you retry the CreateGrant
* request.
*
*
* When this value is present, you can retry a
* CreateGrant
request with identical parameters; if the
* grant already exists, the original GrantId
is
* returned without creating a new grant. Note that the returned
* grant token is unique with every CreateGrant
request,
* even when a duplicate GrantId
is returned. All grant
* tokens obtained in this way can be used interchangeably.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* A friendly name for identifying the grant. Use this value to prevent
* unintended creation of duplicate grants when retrying this request.
*
*
* When this value is absent, all CreateGrant
requests result
* in a new grant with a unique GrantId
even if all the
* supplied parameters are identical. This can result in unintended
* duplicates when you retry the CreateGrant
request.
*
*
* When this value is present, you can retry a CreateGrant
* request with identical parameters; if the grant already exists, the
* original GrantId
is returned without creating a new grant.
* Note that the returned grant token is unique with every
* CreateGrant
request, even when a duplicate
* GrantId
is returned. All grant tokens obtained in this way
* can be used interchangeably.
*
*
* @return A friendly name for identifying the grant. Use this value to
* prevent unintended creation of duplicate grants when retrying
* this request.
*
* When this value is absent, all CreateGrant
requests
* result in a new grant with a unique GrantId
even if
* all the supplied parameters are identical. This can result in
* unintended duplicates when you retry the CreateGrant
* request.
*
*
* When this value is present, you can retry a
* CreateGrant
request with identical parameters; if
* the grant already exists, the original GrantId
is
* returned without creating a new grant. Note that the returned
* grant token is unique with every CreateGrant
* request, even when a duplicate GrantId
is returned.
* All grant tokens obtained in this way can be used
* interchangeably.
*/
public String getName() {
return this.name;
}
/**
*
* A friendly name for identifying the grant. Use this value to prevent
* unintended creation of duplicate grants when retrying this request.
*
*
* When this value is absent, all CreateGrant
requests result
* in a new grant with a unique GrantId
even if all the
* supplied parameters are identical. This can result in unintended
* duplicates when you retry the CreateGrant
request.
*
*
* When this value is present, you can retry a CreateGrant
* request with identical parameters; if the grant already exists, the
* original GrantId
is returned without creating a new grant.
* Note that the returned grant token is unique with every
* CreateGrant
request, even when a duplicate
* GrantId
is returned. All grant tokens obtained in this way
* can be used interchangeably.
*
*
* @param name
* A friendly name for identifying the grant. Use this value to
* prevent unintended creation of duplicate grants when retrying this
* request.
*
* When this value is absent, all CreateGrant
requests
* result in a new grant with a unique GrantId
even if
* all the supplied parameters are identical. This can result in
* unintended duplicates when you retry the CreateGrant
* request.
*
*
* When this value is present, you can retry a
* CreateGrant
request with identical parameters; if the
* grant already exists, the original GrantId
is
* returned without creating a new grant. Note that the returned
* grant token is unique with every CreateGrant
request,
* even when a duplicate GrantId
is returned. All grant
* tokens obtained in this way can be used interchangeably.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public CreateGrantRequest withName(String name) {
setName(name);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKeyId() != null)
sb.append("KeyId: " + getKeyId() + ",");
if (getGranteePrincipal() != null)
sb.append("GranteePrincipal: " + getGranteePrincipal() + ",");
if (getRetiringPrincipal() != null)
sb.append("RetiringPrincipal: " + getRetiringPrincipal() + ",");
if (getOperations() != null)
sb.append("Operations: " + getOperations() + ",");
if (getConstraints() != null)
sb.append("Constraints: " + getConstraints() + ",");
if (getGrantTokens() != null)
sb.append("GrantTokens: " + getGrantTokens() + ",");
if (getName() != null)
sb.append("Name: " + 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 CreateGrantRequest == false)
return false;
CreateGrantRequest other = (CreateGrantRequest) obj;
if (other.getKeyId() == null ^ this.getKeyId() == null)
return false;
if (other.getKeyId() != null
&& other.getKeyId().equals(this.getKeyId()) == false)
return false;
if (other.getGranteePrincipal() == null
^ this.getGranteePrincipal() == null)
return false;
if (other.getGranteePrincipal() != null
&& other.getGranteePrincipal().equals(
this.getGranteePrincipal()) == false)
return false;
if (other.getRetiringPrincipal() == null
^ this.getRetiringPrincipal() == null)
return false;
if (other.getRetiringPrincipal() != null
&& other.getRetiringPrincipal().equals(
this.getRetiringPrincipal()) == false)
return false;
if (other.getOperations() == null ^ this.getOperations() == null)
return false;
if (other.getOperations() != null
&& other.getOperations().equals(this.getOperations()) == false)
return false;
if (other.getConstraints() == null ^ this.getConstraints() == null)
return false;
if (other.getConstraints() != null
&& other.getConstraints().equals(this.getConstraints()) == false)
return false;
if (other.getGrantTokens() == null ^ this.getGrantTokens() == null)
return false;
if (other.getGrantTokens() != null
&& other.getGrantTokens().equals(this.getGrantTokens()) == 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
+ ((getKeyId() == null) ? 0 : getKeyId().hashCode());
hashCode = prime
* hashCode
+ ((getGranteePrincipal() == null) ? 0 : getGranteePrincipal()
.hashCode());
hashCode = prime
* hashCode
+ ((getRetiringPrincipal() == null) ? 0
: getRetiringPrincipal().hashCode());
hashCode = prime * hashCode
+ ((getOperations() == null) ? 0 : getOperations().hashCode());
hashCode = prime
* hashCode
+ ((getConstraints() == null) ? 0 : getConstraints().hashCode());
hashCode = prime
* hashCode
+ ((getGrantTokens() == null) ? 0 : getGrantTokens().hashCode());
hashCode = prime * hashCode
+ ((getName() == null) ? 0 : getName().hashCode());
return hashCode;
}
@Override
public CreateGrantRequest clone() {
return (CreateGrantRequest) super.clone();
}
}