/* * 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.verifiedpermissions.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 CreatePolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *
* Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you * safely retry the request without accidentally performing the same operation a second time. Passing the same value * to a later call to an operation requires that you also pass the same value for all other parameters. We recommend * that you use a UUID type of value.. *
** If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the retry fails
* with an IdempotentParameterMismatch
error.
*
* Specifies the PolicyStoreId
of the policy store you want to store the policy in.
*
* A structure that specifies the policy type and content to use for the new policy. You must include either a * static or a templateLinked element. The policy content must be written in the Cedar policy language. *
*/ private PolicyDefinition definition; /** ** Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you * safely retry the request without accidentally performing the same operation a second time. Passing the same value * to a later call to an operation requires that you also pass the same value for all other parameters. We recommend * that you use a UUID type of value.. *
** If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the retry fails
* with an IdempotentParameterMismatch
error.
*
* If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the
* retry fails with an IdempotentParameterMismatch
error.
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
*
* Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you * safely retry the request without accidentally performing the same operation a second time. Passing the same value * to a later call to an operation requires that you also pass the same value for all other parameters. We recommend * that you use a UUID type of value.. *
** If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the retry fails
* with an IdempotentParameterMismatch
error.
*
* If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the
* retry fails with an IdempotentParameterMismatch
error.
*/
public String getClientToken() {
return this.clientToken;
}
/**
*
* Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you * safely retry the request without accidentally performing the same operation a second time. Passing the same value * to a later call to an operation requires that you also pass the same value for all other parameters. We recommend * that you use a UUID type of value.. *
** If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the retry fails
* with an IdempotentParameterMismatch
error.
*
* If you don't provide this value, then Amazon Web Services generates a random one for you. *
*
* If you retry the operation with the same ClientToken
, but with different parameters, the
* retry fails with an IdempotentParameterMismatch
error.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreatePolicyRequest withClientToken(String clientToken) {
setClientToken(clientToken);
return this;
}
/**
*
* Specifies the PolicyStoreId
of the policy store you want to store the policy in.
*
PolicyStoreId
of the policy store you want to store the policy in.
*/
public void setPolicyStoreId(String policyStoreId) {
this.policyStoreId = policyStoreId;
}
/**
*
* Specifies the PolicyStoreId
of the policy store you want to store the policy in.
*
PolicyStoreId
of the policy store you want to store the policy in.
*/
public String getPolicyStoreId() {
return this.policyStoreId;
}
/**
*
* Specifies the PolicyStoreId
of the policy store you want to store the policy in.
*
PolicyStoreId
of the policy store you want to store the policy in.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CreatePolicyRequest withPolicyStoreId(String policyStoreId) {
setPolicyStoreId(policyStoreId);
return this;
}
/**
* * A structure that specifies the policy type and content to use for the new policy. You must include either a * static or a templateLinked element. The policy content must be written in the Cedar policy language. *
* * @param definition * A structure that specifies the policy type and content to use for the new policy. You must include either * a static or a templateLinked element. The policy content must be written in the Cedar policy language. */ public void setDefinition(PolicyDefinition definition) { this.definition = definition; } /** ** A structure that specifies the policy type and content to use for the new policy. You must include either a * static or a templateLinked element. The policy content must be written in the Cedar policy language. *
* * @return A structure that specifies the policy type and content to use for the new policy. You must include either * a static or a templateLinked element. The policy content must be written in the Cedar policy language. */ public PolicyDefinition getDefinition() { return this.definition; } /** ** A structure that specifies the policy type and content to use for the new policy. You must include either a * static or a templateLinked element. The policy content must be written in the Cedar policy language. *
* * @param definition * A structure that specifies the policy type and content to use for the new policy. You must include either * a static or a templateLinked element. The policy content must be written in the Cedar policy language. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePolicyRequest withDefinition(PolicyDefinition definition) { setDefinition(definition); 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 (getClientToken() != null) sb.append("ClientToken: ").append(getClientToken()).append(","); if (getPolicyStoreId() != null) sb.append("PolicyStoreId: ").append(getPolicyStoreId()).append(","); if (getDefinition() != null) sb.append("Definition: ").append(getDefinition()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreatePolicyRequest == false) return false; CreatePolicyRequest other = (CreatePolicyRequest) obj; if (other.getClientToken() == null ^ this.getClientToken() == null) return false; if (other.getClientToken() != null && other.getClientToken().equals(this.getClientToken()) == false) return false; if (other.getPolicyStoreId() == null ^ this.getPolicyStoreId() == null) return false; if (other.getPolicyStoreId() != null && other.getPolicyStoreId().equals(this.getPolicyStoreId()) == false) return false; if (other.getDefinition() == null ^ this.getDefinition() == null) return false; if (other.getDefinition() != null && other.getDefinition().equals(this.getDefinition()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); hashCode = prime * hashCode + ((getPolicyStoreId() == null) ? 0 : getPolicyStoreId().hashCode()); hashCode = prime * hashCode + ((getDefinition() == null) ? 0 : getDefinition().hashCode()); return hashCode; } @Override public CreatePolicyRequest clone() { return (CreatePolicyRequest) super.clone(); } }