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

software.amazon.awssdk.services.medialive.model.DescribeInputSecurityGroupResponse 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.medialive.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * Placeholder documentation for DescribeInputSecurityGroupResponse
 */
@Generated("software.amazon.awssdk:codegen")
public final class DescribeInputSecurityGroupResponse extends MediaLiveResponse implements
        ToCopyableBuilder {
    private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
            .getter(getter(DescribeInputSecurityGroupResponse::arn)).setter(setter(Builder::arn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();

    private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
            .getter(getter(DescribeInputSecurityGroupResponse::id)).setter(setter(Builder::id))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();

    private static final SdkField> INPUTS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Inputs")
            .getter(getter(DescribeInputSecurityGroupResponse::inputs))
            .setter(setter(Builder::inputs))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("inputs").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
            .getter(getter(DescribeInputSecurityGroupResponse::stateAsString)).setter(setter(Builder::state))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("state").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(DescribeInputSecurityGroupResponse::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final SdkField> WHITELIST_RULES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("WhitelistRules")
            .getter(getter(DescribeInputSecurityGroupResponse::whitelistRules))
            .setter(setter(Builder::whitelistRules))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("whitelistRules").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(InputWhitelistRule::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, ID_FIELD,
            INPUTS_FIELD, STATE_FIELD, TAGS_FIELD, WHITELIST_RULES_FIELD));

    private final String arn;

    private final String id;

    private final List inputs;

    private final String state;

    private final Map tags;

    private final List whitelistRules;

    private DescribeInputSecurityGroupResponse(BuilderImpl builder) {
        super(builder);
        this.arn = builder.arn;
        this.id = builder.id;
        this.inputs = builder.inputs;
        this.state = builder.state;
        this.tags = builder.tags;
        this.whitelistRules = builder.whitelistRules;
    }

    /**
     * Unique ARN of Input Security Group
     * 
     * @return Unique ARN of Input Security Group
     */
    public final String arn() {
        return arn;
    }

    /**
     * The Id of the Input Security Group
     * 
     * @return The Id of the Input Security Group
     */
    public final String id() {
        return id;
    }

    /**
     * For responses, this returns true if the service returned a value for the Inputs property. This DOES NOT check
     * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
     * useful because the SDK will never return a null collection or map, but you may need to differentiate between the
     * service returning nothing (or null) and the service returning an empty collection or map. For requests, this
     * returns true if a value for the property was specified in the request builder, and false if a value was not
     * specified.
     */
    public final boolean hasInputs() {
        return inputs != null && !(inputs instanceof SdkAutoConstructList);
    }

    /**
     * The list of inputs currently using this Input Security Group.
     * 

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasInputs} method. *

* * @return The list of inputs currently using this Input Security Group. */ public final List inputs() { return inputs; } /** * The current state of the Input Security Group. *

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link InputSecurityGroupState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The current state of the Input Security Group. * @see InputSecurityGroupState */ public final InputSecurityGroupState state() { return InputSecurityGroupState.fromValue(state); } /** * The current state of the Input Security Group. *

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link InputSecurityGroupState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The current state of the Input Security Group. * @see InputSecurityGroupState */ public final String stateAsString() { return state; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** * A collection of key-value pairs. *

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return A collection of key-value pairs. */ public final Map tags() { return tags; } /** * For responses, this returns true if the service returned a value for the WhitelistRules property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasWhitelistRules() { return whitelistRules != null && !(whitelistRules instanceof SdkAutoConstructList); } /** * Whitelist rules and their sync status *

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasWhitelistRules} method. *

* * @return Whitelist rules and their sync status */ public final List whitelistRules() { return whitelistRules; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(hasInputs() ? inputs() : null); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(hasWhitelistRules() ? whitelistRules() : null); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DescribeInputSecurityGroupResponse)) { return false; } DescribeInputSecurityGroupResponse other = (DescribeInputSecurityGroupResponse) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(id(), other.id()) && hasInputs() == other.hasInputs() && Objects.equals(inputs(), other.inputs()) && Objects.equals(stateAsString(), other.stateAsString()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && hasWhitelistRules() == other.hasWhitelistRules() && Objects.equals(whitelistRules(), other.whitelistRules()); } /** * 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("DescribeInputSecurityGroupResponse").add("Arn", arn()).add("Id", id()) .add("Inputs", hasInputs() ? inputs() : null).add("State", stateAsString()) .add("Tags", hasTags() ? tags() : null).add("WhitelistRules", hasWhitelistRules() ? whitelistRules() : null) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "Id": return Optional.ofNullable(clazz.cast(id())); case "Inputs": return Optional.ofNullable(clazz.cast(inputs())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "WhitelistRules": return Optional.ofNullable(clazz.cast(whitelistRules())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DescribeInputSecurityGroupResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MediaLiveResponse.Builder, SdkPojo, CopyableBuilder { /** * Unique ARN of Input Security Group * * @param arn * Unique ARN of Input Security Group * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** * The Id of the Input Security Group * * @param id * The Id of the Input Security Group * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** * The list of inputs currently using this Input Security Group. * * @param inputs * The list of inputs currently using this Input Security Group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputs(Collection inputs); /** * The list of inputs currently using this Input Security Group. * * @param inputs * The list of inputs currently using this Input Security Group. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputs(String... inputs); /** * The current state of the Input Security Group. * * @param state * The current state of the Input Security Group. * @see InputSecurityGroupState * @return Returns a reference to this object so that method calls can be chained together. * @see InputSecurityGroupState */ Builder state(String state); /** * The current state of the Input Security Group. * * @param state * The current state of the Input Security Group. * @see InputSecurityGroupState * @return Returns a reference to this object so that method calls can be chained together. * @see InputSecurityGroupState */ Builder state(InputSecurityGroupState state); /** * A collection of key-value pairs. * * @param tags * A collection of key-value pairs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** * Whitelist rules and their sync status * * @param whitelistRules * Whitelist rules and their sync status * @return Returns a reference to this object so that method calls can be chained together. */ Builder whitelistRules(Collection whitelistRules); /** * Whitelist rules and their sync status * * @param whitelistRules * Whitelist rules and their sync status * @return Returns a reference to this object so that method calls can be chained together. */ Builder whitelistRules(InputWhitelistRule... whitelistRules); /** * Whitelist rules and their sync status This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.medialive.model.InputWhitelistRule.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.medialive.model.InputWhitelistRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.medialive.model.InputWhitelistRule.Builder#build()} is called * immediately and its result is passed to {@link #whitelistRules(List)}. * * @param whitelistRules * a consumer that will call methods on * {@link software.amazon.awssdk.services.medialive.model.InputWhitelistRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #whitelistRules(java.util.Collection) */ Builder whitelistRules(Consumer... whitelistRules); } static final class BuilderImpl extends MediaLiveResponse.BuilderImpl implements Builder { private String arn; private String id; private List inputs = DefaultSdkAutoConstructList.getInstance(); private String state; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private List whitelistRules = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(DescribeInputSecurityGroupResponse model) { super(model); arn(model.arn); id(model.id); inputs(model.inputs); state(model.state); tags(model.tags); whitelistRules(model.whitelistRules); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override public final Builder id(String id) { this.id = id; return this; } public final Collection getInputs() { if (inputs instanceof SdkAutoConstructList) { return null; } return inputs; } public final void setInputs(Collection inputs) { this.inputs = ___listOf__stringCopier.copy(inputs); } @Override public final Builder inputs(Collection inputs) { this.inputs = ___listOf__stringCopier.copy(inputs); return this; } @Override @SafeVarargs public final Builder inputs(String... inputs) { inputs(Arrays.asList(inputs)); return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(InputSecurityGroupState state) { this.state(state == null ? null : state.toString()); return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagsCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagsCopier.copy(tags); return this; } public final List getWhitelistRules() { List result = ___listOfInputWhitelistRuleCopier.copyToBuilder(this.whitelistRules); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setWhitelistRules(Collection whitelistRules) { this.whitelistRules = ___listOfInputWhitelistRuleCopier.copyFromBuilder(whitelistRules); } @Override public final Builder whitelistRules(Collection whitelistRules) { this.whitelistRules = ___listOfInputWhitelistRuleCopier.copy(whitelistRules); return this; } @Override @SafeVarargs public final Builder whitelistRules(InputWhitelistRule... whitelistRules) { whitelistRules(Arrays.asList(whitelistRules)); return this; } @Override @SafeVarargs public final Builder whitelistRules(Consumer... whitelistRules) { whitelistRules(Stream.of(whitelistRules).map(c -> InputWhitelistRule.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public DescribeInputSecurityGroupResponse build() { return new DescribeInputSecurityGroupResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy