/*
* 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
import com.amazonaws.Request;
import com.amazonaws.services.ec2.model.transform.ModifyInstanceMetadataOptionsRequestMarshaller;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ModifyInstanceMetadataOptionsRequest extends AmazonWebServiceRequest implements Serializable, Cloneable,
DryRunSupportedRequest
* The ID of the instance.
*
* IMDSv2 uses token-backed sessions. Set the use of HTTP tokens to
*
*
* Default:
* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further
* instance metadata requests can travel. If no parameter is specified, the existing state is maintained.
*
* Possible values: Integers from 1 to 64
*
* Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the
* existing state is maintained.
*
* If you specify a value of
* Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP
* metadata endpoint.
*
* Set to
* Default:
* The ID of the instance.
*
* The ID of the instance.
*
* The ID of the instance.
*
* IMDSv2 uses token-backed sessions. Set the use of HTTP tokens to
*
*
* Default: optional
(in other words, set the
* use of IMDSv2 to optional
) or required
(in other words, set the use of IMDSv2 to
* required
).
*
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or without a
* session token in your request. If you retrieve the IAM role credentials without a token, the IMDSv1 role
* credentials are returned. If you retrieve the IAM role credentials using a valid session token, the IMDSv2 role
* credentials are returned.
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1
* credentials are not available.
* optional
* disabled
, you cannot access your instance metadata.
* enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more information, see
* Work with
* instance tags using the instance metadata.
* disabled
* optional
(in other words, set the
* use of IMDSv2 to optional
) or required
(in other words, set the use of IMDSv2 to
* required
).
*
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or without a
* session token in your request. If you retrieve the IAM role credentials without a token, the IMDSv1 role
* credentials are returned. If you retrieve the IAM role credentials using a valid session token, the IMDSv2 role
* credentials are returned.
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1
* credentials are not available.
* optional
* optional
(in other words,
* set the use of IMDSv2 to optional
) or required
(in other words, set the use of
* IMDSv2 to required
).
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or
* without a session token in your request. If you retrieve the IAM role credentials without a token, the
* IMDSv1 role credentials are returned. If you retrieve the IAM role credentials using a valid session
* token, the IMDSv2 role credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials;
* IMDSv1 credentials are not available.
*
* Default: optional
* @see HttpTokensState
*/
public void setHttpTokens(String httpTokens) {
this.httpTokens = httpTokens;
}
/**
*
* IMDSv2 uses token-backed sessions. Set the use of HTTP tokens to optional
(in other words, set the
* use of IMDSv2 to optional
) or required
(in other words, set the use of IMDSv2 to
* required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or without a
* session token in your request. If you retrieve the IAM role credentials without a token, the IMDSv1 role
* credentials are returned. If you retrieve the IAM role credentials using a valid session token, the IMDSv2 role
* credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1
* credentials are not available.
*
* Default: optional
*
optional
(in other words,
* set the use of IMDSv2 to optional
) or required
(in other words, set the use of
* IMDSv2 to required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or
* without a session token in your request. If you retrieve the IAM role credentials without a token, the
* IMDSv1 role credentials are returned. If you retrieve the IAM role credentials using a valid session
* token, the IMDSv2 role credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials;
* IMDSv1 credentials are not available.
*
* Default: optional
* @see HttpTokensState
*/
public String getHttpTokens() {
return this.httpTokens;
}
/**
*
* IMDSv2 uses token-backed sessions. Set the use of HTTP tokens to optional
(in other words, set the
* use of IMDSv2 to optional
) or required
(in other words, set the use of IMDSv2 to
* required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or without a
* session token in your request. If you retrieve the IAM role credentials without a token, the IMDSv1 role
* credentials are returned. If you retrieve the IAM role credentials using a valid session token, the IMDSv2 role
* credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1
* credentials are not available.
*
* Default: optional
*
optional
(in other words,
* set the use of IMDSv2 to optional
) or required
(in other words, set the use of
* IMDSv2 to required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or
* without a session token in your request. If you retrieve the IAM role credentials without a token, the
* IMDSv1 role credentials are returned. If you retrieve the IAM role credentials using a valid session
* token, the IMDSv2 role credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials;
* IMDSv1 credentials are not available.
*
* Default: optional
* @return Returns a reference to this object so that method calls can be chained together.
* @see HttpTokensState
*/
public ModifyInstanceMetadataOptionsRequest withHttpTokens(String httpTokens) {
setHttpTokens(httpTokens);
return this;
}
/**
*
* IMDSv2 uses token-backed sessions. Set the use of HTTP tokens to optional
(in other words, set the
* use of IMDSv2 to optional
) or required
(in other words, set the use of IMDSv2 to
* required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or without a
* session token in your request. If you retrieve the IAM role credentials without a token, the IMDSv1 role
* credentials are returned. If you retrieve the IAM role credentials using a valid session token, the IMDSv2 role
* credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1
* credentials are not available.
*
* Default: optional
*
optional
(in other words,
* set the use of IMDSv2 to optional
) or required
(in other words, set the use of
* IMDSv2 to required
).
*
* optional
- When IMDSv2 is optional, you can choose to retrieve instance metadata with or
* without a session token in your request. If you retrieve the IAM role credentials without a token, the
* IMDSv1 role credentials are returned. If you retrieve the IAM role credentials using a valid session
* token, the IMDSv2 role credentials are returned.
*
* required
- When IMDSv2 is required, you must send a session token with any instance metadata
* retrieval requests. In this state, retrieving the IAM role credentials always returns IMDSv2 credentials;
* IMDSv1 credentials are not available.
*
* Default: optional
* @return Returns a reference to this object so that method calls can be chained together.
* @see HttpTokensState
*/
public ModifyInstanceMetadataOptionsRequest withHttpTokens(HttpTokensState httpTokens) {
this.httpTokens = httpTokens.toString();
return this;
}
/**
*
* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. If no parameter is specified, the existing state is maintained. *
** Possible values: Integers from 1 to 64 *
* * @param httpPutResponseHopLimit * The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. If no parameter is specified, the existing state is maintained. ** Possible values: Integers from 1 to 64 */ public void setHttpPutResponseHopLimit(Integer httpPutResponseHopLimit) { this.httpPutResponseHopLimit = httpPutResponseHopLimit; } /** *
* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. If no parameter is specified, the existing state is maintained. *
** Possible values: Integers from 1 to 64 *
* * @return The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the * further instance metadata requests can travel. If no parameter is specified, the existing state is * maintained. ** Possible values: Integers from 1 to 64 */ public Integer getHttpPutResponseHopLimit() { return this.httpPutResponseHopLimit; } /** *
* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. If no parameter is specified, the existing state is maintained. *
** Possible values: Integers from 1 to 64 *
* * @param httpPutResponseHopLimit * The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. If no parameter is specified, the existing state is maintained. ** Possible values: Integers from 1 to 64 * @return Returns a reference to this object so that method calls can be chained together. */ public ModifyInstanceMetadataOptionsRequest withHttpPutResponseHopLimit(Integer httpPutResponseHopLimit) { setHttpPutResponseHopLimit(httpPutResponseHopLimit); return this; } /** *
* Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the * existing state is maintained. *
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
* @see InstanceMetadataEndpointState
*/
public void setHttpEndpoint(String httpEndpoint) {
this.httpEndpoint = httpEndpoint;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the * existing state is maintained. *
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
* @see InstanceMetadataEndpointState
*/
public String getHttpEndpoint() {
return this.httpEndpoint;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the * existing state is maintained. *
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataEndpointState
*/
public ModifyInstanceMetadataOptionsRequest withHttpEndpoint(String httpEndpoint) {
setHttpEndpoint(httpEndpoint);
return this;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the * existing state is maintained. *
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataEndpointState
*/
public ModifyInstanceMetadataOptionsRequest withHttpEndpoint(InstanceMetadataEndpointState httpEndpoint) {
this.httpEndpoint = httpEndpoint.toString();
return this;
}
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP * metadata endpoint. *
* * @param httpProtocolIpv6 * Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the * HTTP metadata endpoint. * @see InstanceMetadataProtocolState */ public void setHttpProtocolIpv6(String httpProtocolIpv6) { this.httpProtocolIpv6 = httpProtocolIpv6; } /** ** Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP * metadata endpoint. *
* * @return Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the * HTTP metadata endpoint. * @see InstanceMetadataProtocolState */ public String getHttpProtocolIpv6() { return this.httpProtocolIpv6; } /** ** Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP * metadata endpoint. *
* * @param httpProtocolIpv6 * Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the * HTTP metadata endpoint. * @return Returns a reference to this object so that method calls can be chained together. * @see InstanceMetadataProtocolState */ public ModifyInstanceMetadataOptionsRequest withHttpProtocolIpv6(String httpProtocolIpv6) { setHttpProtocolIpv6(httpProtocolIpv6); return this; } /** ** Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP * metadata endpoint. *
* * @param httpProtocolIpv6 * Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the * HTTP metadata endpoint. * @return Returns a reference to this object so that method calls can be chained together. * @see InstanceMetadataProtocolState */ public ModifyInstanceMetadataOptionsRequest withHttpProtocolIpv6(InstanceMetadataProtocolState httpProtocolIpv6) { this.httpProtocolIpv6 = httpProtocolIpv6.toString(); return this; } /** *
* Set to enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more information, see
* Work with
* instance tags using the instance metadata.
*
* Default: disabled
*
enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more
* information, see Work
* with instance tags using the instance metadata.
*
* Default: disabled
* @see InstanceMetadataTagsState
*/
public void setInstanceMetadataTags(String instanceMetadataTags) {
this.instanceMetadataTags = instanceMetadataTags;
}
/**
*
* Set to enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more information, see
* Work with
* instance tags using the instance metadata.
*
* Default: disabled
*
enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more
* information, see Work
* with instance tags using the instance metadata.
*
* Default: disabled
* @see InstanceMetadataTagsState
*/
public String getInstanceMetadataTags() {
return this.instanceMetadataTags;
}
/**
*
* Set to enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more information, see
* Work with
* instance tags using the instance metadata.
*
* Default: disabled
*
enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more
* information, see Work
* with instance tags using the instance metadata.
*
* Default: disabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataTagsState
*/
public ModifyInstanceMetadataOptionsRequest withInstanceMetadataTags(String instanceMetadataTags) {
setInstanceMetadataTags(instanceMetadataTags);
return this;
}
/**
*
* Set to enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more information, see
* Work with
* instance tags using the instance metadata.
*
* Default: disabled
*
enabled
to allow access to instance tags from the instance metadata. Set to
* disabled
to turn off access to instance tags from the instance metadata. For more
* information, see Work
* with instance tags using the instance metadata.
*
* Default: disabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataTagsState
*/
public ModifyInstanceMetadataOptionsRequest withInstanceMetadataTags(InstanceMetadataTagsState instanceMetadataTags) {
this.instanceMetadataTags = instanceMetadataTags.toString();
return this;
}
/**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/
@Override
public Request