com.amazonaws.services.secretsmanager.model.PutResourcePolicyRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-secretsmanager Show documentation
/*
* Copyright 2019-2024 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.secretsmanager.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 PutResourcePolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
*
* The ARN or name of the secret to attach the resource-based policy.
*
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding
* a secret from a partial ARN.
*
*/
private String secretId;
/**
*
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*
*/
private String resourcePolicy;
/**
*
* Specifies whether to block resource-based policies that allow broad access to the secret, for example those that
* use a wildcard for the principal. By default, public policies aren't blocked.
*
*
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public
* access from being granted through the resource policies that are directly attached to your secrets. In addition
* to using these features, carefully inspect the following policies to confirm that they do not grant public
* access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service
* (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*
*/
private Boolean blockPublicPolicy;
/**
*
* The ARN or name of the secret to attach the resource-based policy.
*
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding
* a secret from a partial ARN.
*
*
* @param secretId
* The ARN or name of the secret to attach the resource-based policy.
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
*/
public void setSecretId(String secretId) {
this.secretId = secretId;
}
/**
*
* The ARN or name of the secret to attach the resource-based policy.
*
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding
* a secret from a partial ARN.
*
*
* @return The ARN or name of the secret to attach the resource-based policy.
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
*/
public String getSecretId() {
return this.secretId;
}
/**
*
* The ARN or name of the secret to attach the resource-based policy.
*
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding
* a secret from a partial ARN.
*
*
* @param secretId
* The ARN or name of the secret to attach the resource-based policy.
*
* For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutResourcePolicyRequest withSecretId(String secretId) {
setSecretId(secretId);
return this;
}
/**
*
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*
*
* @param resourcePolicy
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*/
public void setResourcePolicy(String resourcePolicy) {
this.resourcePolicy = resourcePolicy;
}
/**
*
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*
*
* @return A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*/
public String getResourcePolicy() {
return this.resourcePolicy;
}
/**
*
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
*
*
* @param resourcePolicy
* A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see Permissions
* policy examples.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutResourcePolicyRequest withResourcePolicy(String resourcePolicy) {
setResourcePolicy(resourcePolicy);
return this;
}
/**
*
* Specifies whether to block resource-based policies that allow broad access to the secret, for example those that
* use a wildcard for the principal. By default, public policies aren't blocked.
*
*
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public
* access from being granted through the resource policies that are directly attached to your secrets. In addition
* to using these features, carefully inspect the following policies to confirm that they do not grant public
* access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service
* (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*
*
* @param blockPublicPolicy
* Specifies whether to block resource-based policies that allow broad access to the secret, for example
* those that use a wildcard for the principal. By default, public policies aren't blocked.
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing
* public access from being granted through the resource policies that are directly attached to your secrets.
* In addition to using these features, carefully inspect the following policies to confirm that they do not
* grant public access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management
* Service (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*/
public void setBlockPublicPolicy(Boolean blockPublicPolicy) {
this.blockPublicPolicy = blockPublicPolicy;
}
/**
*
* Specifies whether to block resource-based policies that allow broad access to the secret, for example those that
* use a wildcard for the principal. By default, public policies aren't blocked.
*
*
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public
* access from being granted through the resource policies that are directly attached to your secrets. In addition
* to using these features, carefully inspect the following policies to confirm that they do not grant public
* access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service
* (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*
*
* @return Specifies whether to block resource-based policies that allow broad access to the secret, for example
* those that use a wildcard for the principal. By default, public policies aren't blocked.
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing
* public access from being granted through the resource policies that are directly attached to your
* secrets. In addition to using these features, carefully inspect the following policies to confirm that
* they do not grant public access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management
* Service (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*/
public Boolean getBlockPublicPolicy() {
return this.blockPublicPolicy;
}
/**
*
* Specifies whether to block resource-based policies that allow broad access to the secret, for example those that
* use a wildcard for the principal. By default, public policies aren't blocked.
*
*
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public
* access from being granted through the resource policies that are directly attached to your secrets. In addition
* to using these features, carefully inspect the following policies to confirm that they do not grant public
* access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service
* (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*
*
* @param blockPublicPolicy
* Specifies whether to block resource-based policies that allow broad access to the secret, for example
* those that use a wildcard for the principal. By default, public policies aren't blocked.
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing
* public access from being granted through the resource policies that are directly attached to your secrets.
* In addition to using these features, carefully inspect the following policies to confirm that they do not
* grant public access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management
* Service (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PutResourcePolicyRequest withBlockPublicPolicy(Boolean blockPublicPolicy) {
setBlockPublicPolicy(blockPublicPolicy);
return this;
}
/**
*
* Specifies whether to block resource-based policies that allow broad access to the secret, for example those that
* use a wildcard for the principal. By default, public policies aren't blocked.
*
*
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public
* access from being granted through the resource policies that are directly attached to your secrets. In addition
* to using these features, carefully inspect the following policies to confirm that they do not grant public
* access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service
* (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*
*
* @return Specifies whether to block resource-based policies that allow broad access to the secret, for example
* those that use a wildcard for the principal. By default, public policies aren't blocked.
*
* Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing
* public access from being granted through the resource policies that are directly attached to your
* secrets. In addition to using these features, carefully inspect the following policies to confirm that
* they do not grant public access:
*
*
* -
*
* Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)
*
*
* -
*
* Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management
* Service (KMS) keys)
*
*
*
*
* To review permissions to your secrets, see Determine who has permissions to your secrets.
*
*/
public Boolean isBlockPublicPolicy() {
return this.blockPublicPolicy;
}
/**
* 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 (getSecretId() != null)
sb.append("SecretId: ").append(getSecretId()).append(",");
if (getResourcePolicy() != null)
sb.append("ResourcePolicy: ").append(getResourcePolicy()).append(",");
if (getBlockPublicPolicy() != null)
sb.append("BlockPublicPolicy: ").append(getBlockPublicPolicy());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PutResourcePolicyRequest == false)
return false;
PutResourcePolicyRequest other = (PutResourcePolicyRequest) obj;
if (other.getSecretId() == null ^ this.getSecretId() == null)
return false;
if (other.getSecretId() != null && other.getSecretId().equals(this.getSecretId()) == false)
return false;
if (other.getResourcePolicy() == null ^ this.getResourcePolicy() == null)
return false;
if (other.getResourcePolicy() != null && other.getResourcePolicy().equals(this.getResourcePolicy()) == false)
return false;
if (other.getBlockPublicPolicy() == null ^ this.getBlockPublicPolicy() == null)
return false;
if (other.getBlockPublicPolicy() != null && other.getBlockPublicPolicy().equals(this.getBlockPublicPolicy()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSecretId() == null) ? 0 : getSecretId().hashCode());
hashCode = prime * hashCode + ((getResourcePolicy() == null) ? 0 : getResourcePolicy().hashCode());
hashCode = prime * hashCode + ((getBlockPublicPolicy() == null) ? 0 : getBlockPublicPolicy().hashCode());
return hashCode;
}
@Override
public PutResourcePolicyRequest clone() {
return (PutResourcePolicyRequest) super.clone();
}
}