com.amazonaws.services.ec2.model.InstanceMetadataOptionsRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ec2 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.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* The metadata options for the instance.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InstanceMetadataOptionsRequest implements Serializable, Cloneable {
/**
*
* Indicates whether IMDSv2 is required.
*
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
*
*/
private String httpTokens;
/**
*
* The maximum number of hops that the metadata token can travel.
*
*
* Possible values: Integers from 1 to 64
*
*/
private Integer httpPutResponseHopLimit;
/**
*
* Enables or disables the HTTP metadata endpoint on your instances.
*
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
*
*/
private String httpEndpoint;
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
*
* Default: disabled
*
*/
private String httpProtocolIpv6;
/**
*
* 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
*
*/
private String instanceMetadataTags;
/**
*
* Indicates whether IMDSv2 is required.
*
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
*
*
* @param httpTokens
* Indicates whether IMDSv2 is required.
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
* @see HttpTokensState
*/
public void setHttpTokens(String httpTokens) {
this.httpTokens = httpTokens;
}
/**
*
* Indicates whether IMDSv2 is required.
*
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
*
*
* @return Indicates whether IMDSv2 is required.
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
* @see HttpTokensState
*/
public String getHttpTokens() {
return this.httpTokens;
}
/**
*
* Indicates whether IMDSv2 is required.
*
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
*
*
* @param httpTokens
* Indicates whether IMDSv2 is required.
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
* @see HttpTokensState
*/
public InstanceMetadataOptionsRequest withHttpTokens(String httpTokens) {
setHttpTokens(httpTokens);
return this;
}
/**
*
* Indicates whether IMDSv2 is required.
*
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
*
*
* @param httpTokens
* Indicates whether IMDSv2 is required.
*
* -
*
* optional
- IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
*
*
* -
*
* required
- IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.
*
*
*
*
* Default:
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
and the account level default is set to no-preference
, the default is
* required
.
*
*
* -
*
* If the value of ImdsSupport
for the Amazon Machine Image (AMI) for your instance is
* v2.0
, but the account level default is set to V1 or V2
, the default is
* optional
.
*
*
*
*
* The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide.
* @return Returns a reference to this object so that method calls can be chained together.
* @see HttpTokensState
*/
public InstanceMetadataOptionsRequest withHttpTokens(HttpTokensState httpTokens) {
this.httpTokens = httpTokens.toString();
return this;
}
/**
*
* The maximum number of hops that the metadata token can travel.
*
*
* Possible values: Integers from 1 to 64
*
*
* @param httpPutResponseHopLimit
* The maximum number of hops that the metadata token can travel.
*
* Possible values: Integers from 1 to 64
*/
public void setHttpPutResponseHopLimit(Integer httpPutResponseHopLimit) {
this.httpPutResponseHopLimit = httpPutResponseHopLimit;
}
/**
*
* The maximum number of hops that the metadata token can travel.
*
*
* Possible values: Integers from 1 to 64
*
*
* @return The maximum number of hops that the metadata token can travel.
*
* Possible values: Integers from 1 to 64
*/
public Integer getHttpPutResponseHopLimit() {
return this.httpPutResponseHopLimit;
}
/**
*
* The maximum number of hops that the metadata token can travel.
*
*
* Possible values: Integers from 1 to 64
*
*
* @param httpPutResponseHopLimit
* The maximum number of hops that the metadata token can travel.
*
* Possible values: Integers from 1 to 64
* @return Returns a reference to this object so that method calls can be chained together.
*/
public InstanceMetadataOptionsRequest withHttpPutResponseHopLimit(Integer httpPutResponseHopLimit) {
setHttpPutResponseHopLimit(httpPutResponseHopLimit);
return this;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances.
*
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
*
*
* @param httpEndpoint
* Enables or disables the HTTP metadata endpoint on your instances.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
* @see InstanceMetadataEndpointState
*/
public void setHttpEndpoint(String httpEndpoint) {
this.httpEndpoint = httpEndpoint;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances.
*
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
*
*
* @return Enables or disables the HTTP metadata endpoint on your instances.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
* @see InstanceMetadataEndpointState
*/
public String getHttpEndpoint() {
return this.httpEndpoint;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances.
*
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
*
*
* @param httpEndpoint
* Enables or disables the HTTP metadata endpoint on your instances.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataEndpointState
*/
public InstanceMetadataOptionsRequest withHttpEndpoint(String httpEndpoint) {
setHttpEndpoint(httpEndpoint);
return this;
}
/**
*
* Enables or disables the HTTP metadata endpoint on your instances.
*
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
*
*
* @param httpEndpoint
* Enables or disables the HTTP metadata endpoint on your instances.
*
* If you specify a value of disabled
, you cannot access your instance metadata.
*
*
* Default: enabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataEndpointState
*/
public InstanceMetadataOptionsRequest withHttpEndpoint(InstanceMetadataEndpointState httpEndpoint) {
this.httpEndpoint = httpEndpoint.toString();
return this;
}
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
*
* Default: disabled
*
*
* @param httpProtocolIpv6
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
* Default: disabled
* @see InstanceMetadataProtocolState
*/
public void setHttpProtocolIpv6(String httpProtocolIpv6) {
this.httpProtocolIpv6 = httpProtocolIpv6;
}
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
*
* Default: disabled
*
*
* @return Enables or disables the IPv6 endpoint for the instance metadata service.
*
* Default: disabled
* @see InstanceMetadataProtocolState
*/
public String getHttpProtocolIpv6() {
return this.httpProtocolIpv6;
}
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
*
* Default: disabled
*
*
* @param httpProtocolIpv6
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
* Default: disabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataProtocolState
*/
public InstanceMetadataOptionsRequest withHttpProtocolIpv6(String httpProtocolIpv6) {
setHttpProtocolIpv6(httpProtocolIpv6);
return this;
}
/**
*
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
*
* Default: disabled
*
*
* @param httpProtocolIpv6
* Enables or disables the IPv6 endpoint for the instance metadata service.
*
* Default: disabled
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataProtocolState
*/
public InstanceMetadataOptionsRequest 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
*
*
* @param 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
* @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
*
*
* @return 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
* @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
*
*
* @param 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
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataTagsState
*/
public InstanceMetadataOptionsRequest 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
*
*
* @param 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
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceMetadataTagsState
*/
public InstanceMetadataOptionsRequest withInstanceMetadataTags(InstanceMetadataTagsState instanceMetadataTags) {
this.instanceMetadataTags = instanceMetadataTags.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 (getHttpTokens() != null)
sb.append("HttpTokens: ").append(getHttpTokens()).append(",");
if (getHttpPutResponseHopLimit() != null)
sb.append("HttpPutResponseHopLimit: ").append(getHttpPutResponseHopLimit()).append(",");
if (getHttpEndpoint() != null)
sb.append("HttpEndpoint: ").append(getHttpEndpoint()).append(",");
if (getHttpProtocolIpv6() != null)
sb.append("HttpProtocolIpv6: ").append(getHttpProtocolIpv6()).append(",");
if (getInstanceMetadataTags() != null)
sb.append("InstanceMetadataTags: ").append(getInstanceMetadataTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof InstanceMetadataOptionsRequest == false)
return false;
InstanceMetadataOptionsRequest other = (InstanceMetadataOptionsRequest) obj;
if (other.getHttpTokens() == null ^ this.getHttpTokens() == null)
return false;
if (other.getHttpTokens() != null && other.getHttpTokens().equals(this.getHttpTokens()) == false)
return false;
if (other.getHttpPutResponseHopLimit() == null ^ this.getHttpPutResponseHopLimit() == null)
return false;
if (other.getHttpPutResponseHopLimit() != null && other.getHttpPutResponseHopLimit().equals(this.getHttpPutResponseHopLimit()) == false)
return false;
if (other.getHttpEndpoint() == null ^ this.getHttpEndpoint() == null)
return false;
if (other.getHttpEndpoint() != null && other.getHttpEndpoint().equals(this.getHttpEndpoint()) == false)
return false;
if (other.getHttpProtocolIpv6() == null ^ this.getHttpProtocolIpv6() == null)
return false;
if (other.getHttpProtocolIpv6() != null && other.getHttpProtocolIpv6().equals(this.getHttpProtocolIpv6()) == false)
return false;
if (other.getInstanceMetadataTags() == null ^ this.getInstanceMetadataTags() == null)
return false;
if (other.getInstanceMetadataTags() != null && other.getInstanceMetadataTags().equals(this.getInstanceMetadataTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getHttpTokens() == null) ? 0 : getHttpTokens().hashCode());
hashCode = prime * hashCode + ((getHttpPutResponseHopLimit() == null) ? 0 : getHttpPutResponseHopLimit().hashCode());
hashCode = prime * hashCode + ((getHttpEndpoint() == null) ? 0 : getHttpEndpoint().hashCode());
hashCode = prime * hashCode + ((getHttpProtocolIpv6() == null) ? 0 : getHttpProtocolIpv6().hashCode());
hashCode = prime * hashCode + ((getInstanceMetadataTags() == null) ? 0 : getInstanceMetadataTags().hashCode());
return hashCode;
}
@Override
public InstanceMetadataOptionsRequest clone() {
try {
return (InstanceMetadataOptionsRequest) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}