com.amazonaws.auth.policy

## クラス Policy

- java.lang.Object
- - com.amazonaws.auth.policy.Policy

-     public class Policy
      extends java.lang.Object

  An AWS access control policy is a object that acts as a container for one or more statements, which specify fine grained rules for allowing or denying various types of actions from being performed on your AWS resources.

  By default, all requests to use your resource coming from anyone but you are denied. Access control polices can override that by allowing different types of access to your resources, or by explicitly denying different types of access.

  Each statement in an AWS access control policy takes the form: "A has permission to do B to C where D applies".

  - A is the principal - the AWS account that is making a request to access or modify one of your AWS resources.
  - B is the action - the way in which your AWS resource is being accessed or modified, such as sending a message to an Amazon SQS queue, or storing an object in an Amazon S3 bucket.
  - C is the resource - your AWS entity that the principal wants to access, such as an Amazon SQS queue, or an object stored in Amazon S3.
  - D is the set of conditions - optional constraints that specify when to allow or deny access for the principal to access your resource. Many expressive conditions are available, some specific to each service. For example you can use date conditions to allow access to your resources only after or before a specific time.

  Note that an AWS access control policy should not be confused with the similarly named "POST form policy" concept used in Amazon S3.

- - ### コンストラクタの概要

    コンストラクタ
    コンストラクタと説明
    `Policy()` Constructs an empty AWS access control policy ready to be populated with statements.
    `Policy(java.lang.String id)` Constructs a new AWS access control policy with the specified policy ID.
    `Policy(java.lang.String id, java.util.Collection<Statement> statements)` Constructs a new AWS access control policy with the specified policy ID and collection of statements.

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `static Policy` | `fromJson(java.lang.String jsonString)` Returns an AWS access control policy object generated from JSON string.
    `java.lang.String` | `getId()` Returns the policy ID for this policy.
    `java.util.Collection<Statement>` | `getStatements()` Returns the collection of statements contained by this policy.
    `java.lang.String` | `getVersion()` Returns the version of this AWS policy.
    `void` | `setId(java.lang.String id)` Sets the policy ID for this policy.
    `void` | `setStatements(java.util.Collection<Statement> statements)` Sets the collection of statements contained by this policy.
    `java.lang.String` | `toJson()` Returns a JSON string representation of this AWS access control policy, suitable to be sent to an AWS service as part of a request to set an access control policy.
    `Policy` | `withId(java.lang.String id)` Sets the policy ID for this policy and returns the updated policy so that multiple calls can be chained together.
    `Policy` | `withStatements(Statement... statements)` Sets the collection of statements contained by this policy and returns this policy object so that additional method calls can be chained together.

    - ### クラスから継承されたメソッド java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### コンストラクタの詳細

    - #### Policy

          public Policy()

      Constructs an empty AWS access control policy ready to be populated with statements.

    - #### Policy

          public Policy(java.lang.String id)

      Constructs a new AWS access control policy with the specified policy ID. The policy ID is a user specified string that serves to help developers keep track of multiple polices. Policy IDs are often used as a human readable name for a policy.
      パラメータ:
        `id` - The policy ID for the new policy object. Policy IDs serve to help developers keep track of multiple policies, and are often used to give the policy a meaningful, human readable name.

    - #### Policy

          public Policy(java.lang.String id,
                java.util.Collection<Statement> statements)

      Constructs a new AWS access control policy with the specified policy ID and collection of statements. The policy ID is a user specified string that serves to help developers keep track of multiple polices. Policy IDs are often used as a human readable name for a policy.

      Any statements that don't have a statement ID yet will automatically be assigned a unique ID within this policy.

      パラメータ:
        `id` - The policy ID for the new policy object. Policy IDs serve to help developers keep track of multiple policies, and are often used to give the policy a meaningful, human readable name.
        `statements` - The statements to include in the new policy.

  - ### メソッドの詳細

    - #### getId

          public java.lang.String getId()

      Returns the policy ID for this policy. Policy IDs serve to help developers keep track of multiple policies, and are often used as human readable name for a policy.
      戻り値:
        The policy ID for this policy.

    - #### setId

          public void setId(java.lang.String id)

      Sets the policy ID for this policy. Policy IDs serve to help developers keep track of multiple policies, and are often used as human readable name for a policy.
      パラメータ:
        `id` - The policy ID for this policy.

    - #### withId

          public Policy withId(java.lang.String id)

      Sets the policy ID for this policy and returns the updated policy so that multiple calls can be chained together.

      Policy IDs serve to help developers keep track of multiple policies, and are often used as human readable name for a policy.

      パラメータ:
        `id` - The policy ID for this policy.
      戻り値:
        The updated Policy object so that additional calls can be chained together.

    - #### getVersion

          public java.lang.String getVersion()

      Returns the version of this AWS policy.
      戻り値:
        The version of this AWS policy.

    - #### getStatements

          public java.util.Collection<Statement> getStatements()

      Returns the collection of statements contained by this policy. Individual statements in a policy are what specify the rules that enable or disable access to your AWS resources.
      戻り値:
        The collection of statements contained by this policy.

    - #### setStatements

          public void setStatements(java.util.Collection<Statement> statements)

      Sets the collection of statements contained by this policy. Individual statements in a policy are what specify the rules that enable or disable access to your AWS resources.

      Any statements that don't have a statement ID yet will automatically be assigned a unique ID within this policy.

      パラメータ:
        `statements` - The collection of statements included in this policy.

    - #### withStatements

          public Policy withStatements(Statement... statements)

      Sets the collection of statements contained by this policy and returns this policy object so that additional method calls can be chained together.

      Individual statements in a policy are what specify the rules that enable or disable access to your AWS resources.

      Any statements that don't have a statement ID yet will automatically be assigned a unique ID within this policy.

      パラメータ:
        `statements` - The collection of statements included in this policy.
      戻り値:
        The updated policy object, so that additional method calls can be chained together.

    - #### toJson

          public java.lang.String toJson()

      Returns a JSON string representation of this AWS access control policy, suitable to be sent to an AWS service as part of a request to set an access control policy.
      戻り値:
        A JSON string representation of this AWS access control policy.

    - #### fromJson

          public static Policy fromJson(java.lang.String jsonString)

      Returns an AWS access control policy object generated from JSON string.
      パラメータ:
        `jsonString` - The JSON string representation of this AWS access control policy.
      戻り値:
        An AWS access control policy object.
      例外:
        `java.lang.IllegalArgumentException` - If the specified JSON string is null or invalid and cannot be converted to an AWS policy object.