All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.securityhub.model.AwsEc2InstanceMetadataOptions Maven / Gradle / Ivy

/*
 * Copyright 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 software.amazon.awssdk.services.securityhub.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Metadata options that allow you to configure and secure the Amazon EC2 instance. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AwsEc2InstanceMetadataOptions implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField HTTP_ENDPOINT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HttpEndpoint").getter(getter(AwsEc2InstanceMetadataOptions::httpEndpoint)) .setter(setter(Builder::httpEndpoint)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpEndpoint").build()).build(); private static final SdkField HTTP_PROTOCOL_IPV6_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HttpProtocolIpv6").getter(getter(AwsEc2InstanceMetadataOptions::httpProtocolIpv6)) .setter(setter(Builder::httpProtocolIpv6)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpProtocolIpv6").build()).build(); private static final SdkField HTTP_PUT_RESPONSE_HOP_LIMIT_FIELD = SdkField . builder(MarshallingType.INTEGER).memberName("HttpPutResponseHopLimit") .getter(getter(AwsEc2InstanceMetadataOptions::httpPutResponseHopLimit)) .setter(setter(Builder::httpPutResponseHopLimit)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpPutResponseHopLimit").build()) .build(); private static final SdkField HTTP_TOKENS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HttpTokens").getter(getter(AwsEc2InstanceMetadataOptions::httpTokens)) .setter(setter(Builder::httpTokens)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpTokens").build()).build(); private static final SdkField INSTANCE_METADATA_TAGS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("InstanceMetadataTags").getter(getter(AwsEc2InstanceMetadataOptions::instanceMetadataTags)) .setter(setter(Builder::instanceMetadataTags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceMetadataTags").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HTTP_ENDPOINT_FIELD, HTTP_PROTOCOL_IPV6_FIELD, HTTP_PUT_RESPONSE_HOP_LIMIT_FIELD, HTTP_TOKENS_FIELD, INSTANCE_METADATA_TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String httpEndpoint; private final String httpProtocolIpv6; private final Integer httpPutResponseHopLimit; private final String httpTokens; private final String instanceMetadataTags; private AwsEc2InstanceMetadataOptions(BuilderImpl builder) { this.httpEndpoint = builder.httpEndpoint; this.httpProtocolIpv6 = builder.httpProtocolIpv6; this.httpPutResponseHopLimit = builder.httpPutResponseHopLimit; this.httpTokens = builder.httpTokens; this.instanceMetadataTags = builder.instanceMetadataTags; } /** *

* Enables or disables the HTTP metadata endpoint on the instance. *

* * @return Enables or disables the HTTP metadata endpoint on the instance. */ public final String httpEndpoint() { return httpEndpoint; } /** *

* Enables or disables the IPv6 endpoint for the instance metadata service. *

* * @return Enables or disables the IPv6 endpoint for the instance metadata service. */ public final String httpProtocolIpv6() { return httpProtocolIpv6; } /** *

* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. *

* * @return The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the * further instance metadata requests can travel. */ public final Integer httpPutResponseHopLimit() { return httpPutResponseHopLimit; } /** *

* The state of token usage for your instance metadata requests. *

* * @return The state of token usage for your instance metadata requests. */ public final String httpTokens() { return httpTokens; } /** *

* Specifies whether to allow access to instance tags from the instance metadata. *

* * @return Specifies whether to allow access to instance tags from the instance metadata. */ public final String instanceMetadataTags() { return instanceMetadataTags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(httpEndpoint()); hashCode = 31 * hashCode + Objects.hashCode(httpProtocolIpv6()); hashCode = 31 * hashCode + Objects.hashCode(httpPutResponseHopLimit()); hashCode = 31 * hashCode + Objects.hashCode(httpTokens()); hashCode = 31 * hashCode + Objects.hashCode(instanceMetadataTags()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AwsEc2InstanceMetadataOptions)) { return false; } AwsEc2InstanceMetadataOptions other = (AwsEc2InstanceMetadataOptions) obj; return Objects.equals(httpEndpoint(), other.httpEndpoint()) && Objects.equals(httpProtocolIpv6(), other.httpProtocolIpv6()) && Objects.equals(httpPutResponseHopLimit(), other.httpPutResponseHopLimit()) && Objects.equals(httpTokens(), other.httpTokens()) && Objects.equals(instanceMetadataTags(), other.instanceMetadataTags()); } /** * 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. */ @Override public final String toString() { return ToString.builder("AwsEc2InstanceMetadataOptions").add("HttpEndpoint", httpEndpoint()) .add("HttpProtocolIpv6", httpProtocolIpv6()).add("HttpPutResponseHopLimit", httpPutResponseHopLimit()) .add("HttpTokens", httpTokens()).add("InstanceMetadataTags", instanceMetadataTags()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "HttpEndpoint": return Optional.ofNullable(clazz.cast(httpEndpoint())); case "HttpProtocolIpv6": return Optional.ofNullable(clazz.cast(httpProtocolIpv6())); case "HttpPutResponseHopLimit": return Optional.ofNullable(clazz.cast(httpPutResponseHopLimit())); case "HttpTokens": return Optional.ofNullable(clazz.cast(httpTokens())); case "InstanceMetadataTags": return Optional.ofNullable(clazz.cast(instanceMetadataTags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AwsEc2InstanceMetadataOptions) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Enables or disables the HTTP metadata endpoint on the instance. *

* * @param httpEndpoint * Enables or disables the HTTP metadata endpoint on the instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpEndpoint(String httpEndpoint); /** *

* Enables or disables the IPv6 endpoint for the instance metadata service. *

* * @param httpProtocolIpv6 * Enables or disables the IPv6 endpoint for the instance metadata service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpProtocolIpv6(String httpProtocolIpv6); /** *

* The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further * instance metadata requests can travel. *

* * @param httpPutResponseHopLimit * The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the * further instance metadata requests can travel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpPutResponseHopLimit(Integer httpPutResponseHopLimit); /** *

* The state of token usage for your instance metadata requests. *

* * @param httpTokens * The state of token usage for your instance metadata requests. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpTokens(String httpTokens); /** *

* Specifies whether to allow access to instance tags from the instance metadata. *

* * @param instanceMetadataTags * Specifies whether to allow access to instance tags from the instance metadata. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceMetadataTags(String instanceMetadataTags); } static final class BuilderImpl implements Builder { private String httpEndpoint; private String httpProtocolIpv6; private Integer httpPutResponseHopLimit; private String httpTokens; private String instanceMetadataTags; private BuilderImpl() { } private BuilderImpl(AwsEc2InstanceMetadataOptions model) { httpEndpoint(model.httpEndpoint); httpProtocolIpv6(model.httpProtocolIpv6); httpPutResponseHopLimit(model.httpPutResponseHopLimit); httpTokens(model.httpTokens); instanceMetadataTags(model.instanceMetadataTags); } public final String getHttpEndpoint() { return httpEndpoint; } public final void setHttpEndpoint(String httpEndpoint) { this.httpEndpoint = httpEndpoint; } @Override public final Builder httpEndpoint(String httpEndpoint) { this.httpEndpoint = httpEndpoint; return this; } public final String getHttpProtocolIpv6() { return httpProtocolIpv6; } public final void setHttpProtocolIpv6(String httpProtocolIpv6) { this.httpProtocolIpv6 = httpProtocolIpv6; } @Override public final Builder httpProtocolIpv6(String httpProtocolIpv6) { this.httpProtocolIpv6 = httpProtocolIpv6; return this; } public final Integer getHttpPutResponseHopLimit() { return httpPutResponseHopLimit; } public final void setHttpPutResponseHopLimit(Integer httpPutResponseHopLimit) { this.httpPutResponseHopLimit = httpPutResponseHopLimit; } @Override public final Builder httpPutResponseHopLimit(Integer httpPutResponseHopLimit) { this.httpPutResponseHopLimit = httpPutResponseHopLimit; return this; } public final String getHttpTokens() { return httpTokens; } public final void setHttpTokens(String httpTokens) { this.httpTokens = httpTokens; } @Override public final Builder httpTokens(String httpTokens) { this.httpTokens = httpTokens; return this; } public final String getInstanceMetadataTags() { return instanceMetadataTags; } public final void setInstanceMetadataTags(String instanceMetadataTags) { this.instanceMetadataTags = instanceMetadataTags; } @Override public final Builder instanceMetadataTags(String instanceMetadataTags) { this.instanceMetadataTags = instanceMetadataTags; return this; } @Override public AwsEc2InstanceMetadataOptions build() { return new AwsEc2InstanceMetadataOptions(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy