com.amazonaws.services.securitytoken.model

## クラス GetSessionTokenRequest

- java.lang.Object
- - com.amazonaws.AmazonWebServiceRequest
  - - com.amazonaws.services.securitytoken.model.GetSessionTokenRequest

- すべての実装されたインタフェース:
    java.io.Serializable

      public class GetSessionTokenRequest
      extends AmazonWebServiceRequest
      implements java.io.Serializable

  Container for the parameters to the `GetSessionToken operation`.

  Returns a set of temporary credentials for an AWS account or IAM user. The credentials consist of an access key ID, a secret access key, and a security token. Typically, you use `GetSessionToken` if you want use MFA to protect programmatic calls to specific AWS APIs like Amazon EC2 `StopInstances` . MFA-enabled IAM users would need to call `GetSessionToken` and submit an MFA code that is associated with their MFA device. Using the temporary security credentials that are returned from the call, IAM users can then make programmatic calls to APIs that require MFA authentication.

  The `GetSessionToken` action must be called by using the long-term AWS security credentials of the AWS account or an IAM user. Credentials that are created by IAM users are valid for the duration that you specify, between 900 seconds (15 minutes) and 129600 seconds (36 hours); credentials that are created by using account credentials have a maximum duration of 3600 seconds (1 hour).

  The permissions that are granted to the federated user are the intersection of the policy that is passed with the `GetSessionToken` request and policies that are associated with of the entity making the `GetSessionToken` call.

  For more information about using `GetSessionToken` to create temporary credentials, go to Creating Temporary Credentials to Enable Access for IAM Users in Using IAM .

  関連項目:
    `AWSSecurityTokenService.getSessionToken(GetSessionTokenRequest)`, 直列化された形式

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

    コンストラクタ
    コンストラクタと説明
    `GetSessionTokenRequest()` Default constructor for a new GetSessionTokenRequest object.

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `java.lang.Integer` | `getDurationSeconds()` The duration, in seconds, that the credentials should remain valid.
    `java.lang.String` | `getSerialNumber()` The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call.
    `java.lang.String` | `getTokenCode()` The value provided by the MFA device, if MFA is required.
    `int` | `hashCode()`
    `void` | `setDurationSeconds(java.lang.Integer durationSeconds)` The duration, in seconds, that the credentials should remain valid.
    `void` | `setSerialNumber(java.lang.String serialNumber)` The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call.
    `void` | `setTokenCode(java.lang.String tokenCode)` The value provided by the MFA device, if MFA is required.
    `java.lang.String` | `toString()` Returns a string representation of this object; useful for testing and debugging.
    `GetSessionTokenRequest` | `withDurationSeconds(java.lang.Integer durationSeconds)` The duration, in seconds, that the credentials should remain valid.
    `GetSessionTokenRequest` | `withSerialNumber(java.lang.String serialNumber)` The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call.
    `GetSessionTokenRequest` | `withTokenCode(java.lang.String tokenCode)` The value provided by the MFA device, if MFA is required.

    - ### クラスから継承されたメソッド com.amazonaws.AmazonWebServiceRequest

      `copyPrivateRequestParameters, getRequestClientOptions, getRequestCredentials, setRequestCredentials`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

    - #### GetSessionTokenRequest

          public GetSessionTokenRequest()

      Default constructor for a new GetSessionTokenRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.

  - ### メソッドの詳細

    - #### getDurationSeconds

          public java.lang.Integer getDurationSeconds()

      The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

      Constraints:
      Range: 900 - 129600

      戻り値:
        The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

    - #### setDurationSeconds

          public void setDurationSeconds(java.lang.Integer durationSeconds)

      The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

      Constraints:
      Range: 900 - 129600

      パラメータ:
        `durationSeconds` - The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

    - #### withDurationSeconds

          public GetSessionTokenRequest withDurationSeconds(java.lang.Integer durationSeconds)

      The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

      Returns a reference to this object so that method calls can be chained together.

      Constraints:
      Range: 900 - 129600

      パラメータ:
        `durationSeconds` - The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600 seconds (one hour). If the duration is longer than one hour, the session for AWS account owners defaults to one hour.

    - #### getSerialNumber

          public java.lang.String getSerialNumber()

      The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

      Constraints:
      Length: 9 - 256
      Pattern: [\w+=/:,.@-]*

      戻り値:
        The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

    - #### setSerialNumber

          public void setSerialNumber(java.lang.String serialNumber)

      The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

      Constraints:
      Length: 9 - 256
      Pattern: [\w+=/:,.@-]*

      パラメータ:
        `serialNumber` - The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

    - #### withSerialNumber

          public GetSessionTokenRequest withSerialNumber(java.lang.String serialNumber)

      The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

      Returns a reference to this object so that method calls can be chained together.

      Constraints:
      Length: 9 - 256
      Pattern: [\w+=/:,.@-]*

      パラメータ:
        `serialNumber` - The identification number of the MFA device that is associated with the IAM user who is making the `GetSessionToken` call. Specify this value if the IAM user has a policy that requires MFA authentication. The value is either the serial number for a hardware device (such as `GAHT12345678`) or an Amazon Resource Name (ARN) for a virtual device (such as `arn:aws:iam::123456789012:mfa/user`). You can find the device for an IAM user by going to the AWS Management Console and viewing the user's security credentials.

    - #### getTokenCode

          public java.lang.String getTokenCode()

      The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

      Constraints:
      Length: 6 - 6
      Pattern: [\d]*

      戻り値:
        The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

    - #### setTokenCode

          public void setTokenCode(java.lang.String tokenCode)

      The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

      Constraints:
      Length: 6 - 6
      Pattern: [\d]*

      パラメータ:
        `tokenCode` - The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

    - #### withTokenCode

          public GetSessionTokenRequest withTokenCode(java.lang.String tokenCode)

      The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

      Returns a reference to this object so that method calls can be chained together.

      Constraints:
      Length: 6 - 6
      Pattern: [\d]*

      パラメータ:
        `tokenCode` - The value provided by the MFA device, if MFA is required. If any policy requires the IAM user to submit an MFA code, specify this value. If MFA authentication is required, and the user does not provide a code when requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA authentication.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this object; useful for testing and debugging.
      オーバーライド:
        `toString` クラス内 `java.lang.Object`
      戻り値:
        A string representation of this object.
      関連項目:
        `Object.toString()`

    - #### hashCode

          public int hashCode()

      オーバーライド:
        `hashCode` クラス内 `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      オーバーライド:
        `equals` クラス内 `java.lang.Object`