/* * 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.logs.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 PutAccountPolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** *

* A name for the policy. This must be unique within the account. *

*/ private String policyName; /** *

* Specify the data protection policy, in JSON. *

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports audit * findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. *

*/ private String policyDocument; /** *

* Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. *

*/ private String policyType; /** *

* Currently the only valid value for this parameter is ALL, which specifies that the data protection * policy applies to all log groups in the account. If you omit this parameter, the default of ALL is * used. *

*/ private String scope; /** *

* A name for the policy. This must be unique within the account. *

* * @param policyName * A name for the policy. This must be unique within the account. */ public void setPolicyName(String policyName) { this.policyName = policyName; } /** *

* A name for the policy. This must be unique within the account. *

* * @return A name for the policy. This must be unique within the account. */ public String getPolicyName() { return this.policyName; } /** *

* A name for the policy. This must be unique within the account. *

* * @param policyName * A name for the policy. This must be unique within the account. * @return Returns a reference to this object so that method calls can be chained together. */ public PutAccountPolicyRequest withPolicyName(String policyName) { setPolicyName(policyName); return this; } /** *

* Specify the data protection policy, in JSON. *

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports audit * findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. *

* * @param policyDocument * Specify the data protection policy, in JSON.

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports * audit findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. */ public void setPolicyDocument(String policyDocument) { this.policyDocument = policyDocument; } /** *

* Specify the data protection policy, in JSON. *

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports audit * findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. *

* * @return Specify the data protection policy, in JSON.

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports * audit findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. */ public String getPolicyDocument() { return this.policyDocument; } /** *

* Specify the data protection policy, in JSON. *

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports audit * findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. *

* * @param policyDocument * Specify the data protection policy, in JSON.

*

* This policy must include two JSON blocks: *

* *

* For an example data protection policy, see the Examples section on this page. *

* *

* The contents of the two DataIdentifer arrays must match exactly. *

*
*

* In addition to the two JSON blocks, the policyDocument can also include Name, * Description, and Version fields. The Name is different than the * operation's policyName parameter, and is used as a dimension when CloudWatch Logs reports * audit findings metrics to CloudWatch. *

*

* The JSON specified in policyDocument can be up to 30,720 characters. * @return Returns a reference to this object so that method calls can be chained together. */ public PutAccountPolicyRequest withPolicyDocument(String policyDocument) { setPolicyDocument(policyDocument); return this; } /** *

* Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. *

* * @param policyType * Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. * @see PolicyType */ public void setPolicyType(String policyType) { this.policyType = policyType; } /** *

* Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. *

* * @return Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. * @see PolicyType */ public String getPolicyType() { return this.policyType; } /** *

* Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. *

* * @param policyType * Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. * @return Returns a reference to this object so that method calls can be chained together. * @see PolicyType */ public PutAccountPolicyRequest withPolicyType(String policyType) { setPolicyType(policyType); return this; } /** *

* Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. *

* * @param policyType * Currently the only valid value for this parameter is DATA_PROTECTION_POLICY. * @return Returns a reference to this object so that method calls can be chained together. * @see PolicyType */ public PutAccountPolicyRequest withPolicyType(PolicyType policyType) { this.policyType = policyType.toString(); return this; } /** *

* Currently the only valid value for this parameter is ALL, which specifies that the data protection * policy applies to all log groups in the account. If you omit this parameter, the default of ALL is * used. *

* * @param scope * Currently the only valid value for this parameter is ALL, which specifies that the data * protection policy applies to all log groups in the account. If you omit this parameter, the default of * ALL is used. * @see Scope */ public void setScope(String scope) { this.scope = scope; } /** *

* Currently the only valid value for this parameter is ALL, which specifies that the data protection * policy applies to all log groups in the account. If you omit this parameter, the default of ALL is * used. *

* * @return Currently the only valid value for this parameter is ALL, which specifies that the data * protection policy applies to all log groups in the account. If you omit this parameter, the default of * ALL is used. * @see Scope */ public String getScope() { return this.scope; } /** *

* Currently the only valid value for this parameter is ALL, which specifies that the data protection * policy applies to all log groups in the account. If you omit this parameter, the default of ALL is * used. *

* * @param scope * Currently the only valid value for this parameter is ALL, which specifies that the data * protection policy applies to all log groups in the account. If you omit this parameter, the default of * ALL is used. * @return Returns a reference to this object so that method calls can be chained together. * @see Scope */ public PutAccountPolicyRequest withScope(String scope) { setScope(scope); return this; } /** *

* Currently the only valid value for this parameter is ALL, which specifies that the data protection * policy applies to all log groups in the account. If you omit this parameter, the default of ALL is * used. *

* * @param scope * Currently the only valid value for this parameter is ALL, which specifies that the data * protection policy applies to all log groups in the account. If you omit this parameter, the default of * ALL is used. * @return Returns a reference to this object so that method calls can be chained together. * @see Scope */ public PutAccountPolicyRequest withScope(Scope scope) { this.scope = scope.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 (getPolicyName() != null) sb.append("PolicyName: ").append(getPolicyName()).append(","); if (getPolicyDocument() != null) sb.append("PolicyDocument: ").append(getPolicyDocument()).append(","); if (getPolicyType() != null) sb.append("PolicyType: ").append(getPolicyType()).append(","); if (getScope() != null) sb.append("Scope: ").append(getScope()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PutAccountPolicyRequest == false) return false; PutAccountPolicyRequest other = (PutAccountPolicyRequest) obj; if (other.getPolicyName() == null ^ this.getPolicyName() == null) return false; if (other.getPolicyName() != null && other.getPolicyName().equals(this.getPolicyName()) == false) return false; if (other.getPolicyDocument() == null ^ this.getPolicyDocument() == null) return false; if (other.getPolicyDocument() != null && other.getPolicyDocument().equals(this.getPolicyDocument()) == false) return false; if (other.getPolicyType() == null ^ this.getPolicyType() == null) return false; if (other.getPolicyType() != null && other.getPolicyType().equals(this.getPolicyType()) == false) return false; if (other.getScope() == null ^ this.getScope() == null) return false; if (other.getScope() != null && other.getScope().equals(this.getScope()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPolicyName() == null) ? 0 : getPolicyName().hashCode()); hashCode = prime * hashCode + ((getPolicyDocument() == null) ? 0 : getPolicyDocument().hashCode()); hashCode = prime * hashCode + ((getPolicyType() == null) ? 0 : getPolicyType().hashCode()); hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode()); return hashCode; } @Override public PutAccountPolicyRequest clone() { return (PutAccountPolicyRequest) super.clone(); } }