/* * Copyright 2010-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.rekognition.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** *
* Attaches a project policy to a Amazon Rekognition Custom Labels project in a * trusting AWS account. A project policy specifies that a trusted AWS account * can copy a model version from a trusting AWS account to a project in the * trusted AWS account. To copy a model version you use the * CopyProjectVersion operation. *
** For more information about the format of a project policy document, see * Attaching a project policy (SDK) in the Amazon Rekognition Custom Labels * Developer Guide. *
*
* The response from PutProjectPolicy
is a revision ID for the
* project policy. You can attach multiple project policies to a project. You
* can also update an existing project policy by specifying the policy revision
* ID of the existing policy.
*
* To remove a project policy from a project, call DeleteProjectPolicy. * To get a list of project policies attached to a project, call * ListProjectPolicies. *
** You copy a model version by calling CopyProjectVersion. *
*
* This operation requires permissions to perform the
* rekognition:PutProjectPolicy
action.
*
* The Amazon Resource Name (ARN) of the project that the project policy is * attached to. *
*
* Constraints:
* Length: 20 - 2048
* Pattern:
* (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA
* -Z0-9_.\-]{1,255}\/[0-9]+$)
*/
private String projectArn;
/**
*
* A name for the policy. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.\-]+
*/
private String policyName;
/**
*
* The revision ID for the Project Policy. Each time you modify a policy,
* Amazon Rekognition Custom Labels generates and assigns a new
* PolicyRevisionId
and then deletes the previous version of
* the policy.
*
* Constraints:
* Length: - 64
* Pattern: [0-9A-Fa-f]+
*/
private String policyRevisionId;
/**
*
* A resource policy to add to the model. The policy is a JSON structure * that contains one or more statements that define the policy. The policy * must follow the IAM syntax. For more information about the contents of a * JSON policy document, see IAM JSON policy reference. *
*
* Constraints:
* Length: 1 - 2000
* Pattern: [ -\u00FF]+
*/
private String policyDocument;
/**
*
* The Amazon Resource Name (ARN) of the project that the project policy is * attached to. *
*
* Constraints:
* Length: 20 - 2048
* Pattern:
* (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA
* -Z0-9_.\-]{1,255}\/[0-9]+$)
*
* @return
* The Amazon Resource Name (ARN) of the project that the project * policy is attached to. *
*/ public String getProjectArn() { return projectArn; } /** ** The Amazon Resource Name (ARN) of the project that the project policy is * attached to. *
*
* Constraints:
* Length: 20 - 2048
* Pattern:
* (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA
* -Z0-9_.\-]{1,255}\/[0-9]+$)
*
* @param projectArn
* The Amazon Resource Name (ARN) of the project that the project * policy is attached to. *
*/ public void setProjectArn(String projectArn) { this.projectArn = projectArn; } /** ** The Amazon Resource Name (ARN) of the project that the project policy is * attached to. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 20 - 2048
* Pattern:
* (^arn:[a-z\d-]+:rekognition:[a-z\d-]+:\d{12}:project\/[a-zA
* -Z0-9_.\-]{1,255}\/[0-9]+$)
*
* @param projectArn
* The Amazon Resource Name (ARN) of the project that the project * policy is attached to. *
* @return A reference to this updated object so that method calls can be * chained together. */ public PutProjectPolicyRequest withProjectArn(String projectArn) { this.projectArn = projectArn; return this; } /** ** A name for the policy. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.\-]+
*
* @return
* A name for the policy. *
*/ public String getPolicyName() { return policyName; } /** ** A name for the policy. *
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.\-]+
*
* @param policyName
* A name for the policy. *
*/ public void setPolicyName(String policyName) { this.policyName = policyName; } /** ** A name for the policy. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9_.\-]+
*
* @param policyName
* A name for the policy. *
* @return A reference to this updated object so that method calls can be * chained together. */ public PutProjectPolicyRequest withPolicyName(String policyName) { this.policyName = policyName; return this; } /** *
* The revision ID for the Project Policy. Each time you modify a policy,
* Amazon Rekognition Custom Labels generates and assigns a new
* PolicyRevisionId
and then deletes the previous version of
* the policy.
*
* Constraints:
* Length: - 64
* Pattern: [0-9A-Fa-f]+
*
* @return
* The revision ID for the Project Policy. Each time you modify a
* policy, Amazon Rekognition Custom Labels generates and assigns a
* new PolicyRevisionId
and then deletes the previous
* version of the policy.
*
* The revision ID for the Project Policy. Each time you modify a policy,
* Amazon Rekognition Custom Labels generates and assigns a new
* PolicyRevisionId
and then deletes the previous version of
* the policy.
*
* Constraints:
* Length: - 64
* Pattern: [0-9A-Fa-f]+
*
* @param policyRevisionId
* The revision ID for the Project Policy. Each time you modify a
* policy, Amazon Rekognition Custom Labels generates and assigns
* a new PolicyRevisionId
and then deletes the
* previous version of the policy.
*
* The revision ID for the Project Policy. Each time you modify a policy,
* Amazon Rekognition Custom Labels generates and assigns a new
* PolicyRevisionId
and then deletes the previous version of
* the policy.
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: - 64
* Pattern: [0-9A-Fa-f]+
*
* @param policyRevisionId
* The revision ID for the Project Policy. Each time you modify a
* policy, Amazon Rekognition Custom Labels generates and assigns
* a new PolicyRevisionId
and then deletes the
* previous version of the policy.
*
* A resource policy to add to the model. The policy is a JSON structure * that contains one or more statements that define the policy. The policy * must follow the IAM syntax. For more information about the contents of a * JSON policy document, see IAM JSON policy reference. *
*
* Constraints:
* Length: 1 - 2000
* Pattern: [ -\u00FF]+
*
* @return
* A resource policy to add to the model. The policy is a JSON * structure that contains one or more statements that define the * policy. The policy must follow the IAM syntax. For more * information about the contents of a JSON policy document, see IAM JSON policy reference. *
*/ public String getPolicyDocument() { return policyDocument; } /** ** A resource policy to add to the model. The policy is a JSON structure * that contains one or more statements that define the policy. The policy * must follow the IAM syntax. For more information about the contents of a * JSON policy document, see IAM JSON policy reference. *
*
* Constraints:
* Length: 1 - 2000
* Pattern: [ -\u00FF]+
*
* @param policyDocument
* A resource policy to add to the model. The policy is a JSON * structure that contains one or more statements that define the * policy. The policy must follow the IAM syntax. For more * information about the contents of a JSON policy document, see * IAM JSON policy reference. *
*/ public void setPolicyDocument(String policyDocument) { this.policyDocument = policyDocument; } /** ** A resource policy to add to the model. The policy is a JSON structure * that contains one or more statements that define the policy. The policy * must follow the IAM syntax. For more information about the contents of a * JSON policy document, see IAM JSON policy reference. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 2000
* Pattern: [ -\u00FF]+
*
* @param policyDocument
* A resource policy to add to the model. The policy is a JSON * structure that contains one or more statements that define the * policy. The policy must follow the IAM syntax. For more * information about the contents of a JSON policy document, see * IAM JSON policy reference. *
* @return A reference to this updated object so that method calls can be * chained together. */ public PutProjectPolicyRequest withPolicyDocument(String policyDocument) { this.policyDocument = policyDocument; 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 (getProjectArn() != null) sb.append("ProjectArn: " + getProjectArn() + ","); if (getPolicyName() != null) sb.append("PolicyName: " + getPolicyName() + ","); if (getPolicyRevisionId() != null) sb.append("PolicyRevisionId: " + getPolicyRevisionId() + ","); if (getPolicyDocument() != null) sb.append("PolicyDocument: " + getPolicyDocument()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProjectArn() == null) ? 0 : getProjectArn().hashCode()); hashCode = prime * hashCode + ((getPolicyName() == null) ? 0 : getPolicyName().hashCode()); hashCode = prime * hashCode + ((getPolicyRevisionId() == null) ? 0 : getPolicyRevisionId().hashCode()); hashCode = prime * hashCode + ((getPolicyDocument() == null) ? 0 : getPolicyDocument().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutProjectPolicyRequest == false) return false; PutProjectPolicyRequest other = (PutProjectPolicyRequest) obj; if (other.getProjectArn() == null ^ this.getProjectArn() == null) return false; if (other.getProjectArn() != null && other.getProjectArn().equals(this.getProjectArn()) == false) return false; if (other.getPolicyName() == null ^ this.getPolicyName() == null) return false; if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == false) return false; if (other.getPolicyRevisionId() == null ^ this.getPolicyRevisionId() == null) return false; if (other.getPolicyRevisionId() != null && other.getPolicyRevisionId().equals(this.getPolicyRevisionId()) == false) return false; if (other.getPolicyDocument() == null ^ this.getPolicyDocument() == null) return false; if (other.getPolicyDocument() != null && other.getPolicyDocument().equals(this.getPolicyDocument()) == false) return false; return true; } }