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

software.amazon.awssdk.services.networkmanager.model.ServiceInsertionAction Maven / Gradle / Ivy

Go to download

The AWS Java SDK for NetworkManager module holds the client classes that are used for communicating with NetworkManager.

There is a newer version: 2.30.1
Show newest version
/*
 * 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.networkmanager.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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 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;

/**
 * 

* Describes the action that the service insertion will take for any segments associated with it. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ServiceInsertionAction implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACTION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Action") .getter(getter(ServiceInsertionAction::actionAsString)).setter(setter(Builder::action)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Action").build()).build(); private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode") .getter(getter(ServiceInsertionAction::modeAsString)).setter(setter(Builder::mode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build(); private static final SdkField WHEN_SENT_TO_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("WhenSentTo").getter(getter(ServiceInsertionAction::whenSentTo)).setter(setter(Builder::whenSentTo)) .constructor(WhenSentTo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WhenSentTo").build()).build(); private static final SdkField VIA_FIELD = SdkField. builder(MarshallingType.SDK_POJO).memberName("Via") .getter(getter(ServiceInsertionAction::via)).setter(setter(Builder::via)).constructor(Via::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Via").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_FIELD, MODE_FIELD, WHEN_SENT_TO_FIELD, VIA_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String action; private final String mode; private final WhenSentTo whenSentTo; private final Via via; private ServiceInsertionAction(BuilderImpl builder) { this.action = builder.action; this.mode = builder.mode; this.whenSentTo = builder.whenSentTo; this.via = builder.via; } /** *

* The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that to * either the Internet or to an on-premesis location. *

*

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

* * @return The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that * to either the Internet or to an on-premesis location. * @see SegmentActionServiceInsertion */ public final SegmentActionServiceInsertion action() { return SegmentActionServiceInsertion.fromValue(action); } /** *

* The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that to * either the Internet or to an on-premesis location. *

*

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

* * @return The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that * to either the Internet or to an on-premesis location. * @see SegmentActionServiceInsertion */ public final String actionAsString() { return action; } /** *

* Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the destination * core network edges. This mode requires that an inspection attachment must be present in all Regions of the * service insertion-enabled segments. For single-hop, packets traverse a single intermediate inserted * attachment. You can use EdgeOverride to specify a specific edge to use. *

*

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

* * @return Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in all * Regions of the service insertion-enabled segments. For single-hop, packets traverse a single * intermediate inserted attachment. You can use EdgeOverride to specify a specific edge to * use. * @see SendViaMode */ public final SendViaMode mode() { return SendViaMode.fromValue(mode); } /** *

* Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the destination * core network edges. This mode requires that an inspection attachment must be present in all Regions of the * service insertion-enabled segments. For single-hop, packets traverse a single intermediate inserted * attachment. You can use EdgeOverride to specify a specific edge to use. *

*

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

* * @return Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in all * Regions of the service insertion-enabled segments. For single-hop, packets traverse a single * intermediate inserted attachment. You can use EdgeOverride to specify a specific edge to * use. * @see SendViaMode */ public final String modeAsString() { return mode; } /** *

* The list of destination segments if the service insertion action is send-via. *

* * @return The list of destination segments if the service insertion action is send-via. */ public final WhenSentTo whenSentTo() { return whenSentTo; } /** *

* The list of network function groups and any edge overrides for the chosen service insertion action. Used for both * send-to or send-via. *

* * @return The list of network function groups and any edge overrides for the chosen service insertion action. Used * for both send-to or send-via. */ public final Via via() { return via; } @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(actionAsString()); hashCode = 31 * hashCode + Objects.hashCode(modeAsString()); hashCode = 31 * hashCode + Objects.hashCode(whenSentTo()); hashCode = 31 * hashCode + Objects.hashCode(via()); 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 ServiceInsertionAction)) { return false; } ServiceInsertionAction other = (ServiceInsertionAction) obj; return Objects.equals(actionAsString(), other.actionAsString()) && Objects.equals(modeAsString(), other.modeAsString()) && Objects.equals(whenSentTo(), other.whenSentTo()) && Objects.equals(via(), other.via()); } /** * 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("ServiceInsertionAction").add("Action", actionAsString()).add("Mode", modeAsString()) .add("WhenSentTo", whenSentTo()).add("Via", via()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Action": return Optional.ofNullable(clazz.cast(actionAsString())); case "Mode": return Optional.ofNullable(clazz.cast(modeAsString())); case "WhenSentTo": return Optional.ofNullable(clazz.cast(whenSentTo())); case "Via": return Optional.ofNullable(clazz.cast(via())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Action", ACTION_FIELD); map.put("Mode", MODE_FIELD); map.put("WhenSentTo", WHEN_SENT_TO_FIELD); map.put("Via", VIA_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ServiceInsertionAction) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that to * either the Internet or to an on-premesis location. *

* * @param action * The action the service insertion takes for traffic. send-via sends east-west traffic * between attachments. send-to sends north-south traffic to the security appliance, and * then from that to either the Internet or to an on-premesis location. * @see SegmentActionServiceInsertion * @return Returns a reference to this object so that method calls can be chained together. * @see SegmentActionServiceInsertion */ Builder action(String action); /** *

* The action the service insertion takes for traffic. send-via sends east-west traffic between * attachments. send-to sends north-south traffic to the security appliance, and then from that to * either the Internet or to an on-premesis location. *

* * @param action * The action the service insertion takes for traffic. send-via sends east-west traffic * between attachments. send-to sends north-south traffic to the security appliance, and * then from that to either the Internet or to an on-premesis location. * @see SegmentActionServiceInsertion * @return Returns a reference to this object so that method calls can be chained together. * @see SegmentActionServiceInsertion */ Builder action(SegmentActionServiceInsertion action); /** *

* Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in all * Regions of the service insertion-enabled segments. For single-hop, packets traverse a single * intermediate inserted attachment. You can use EdgeOverride to specify a specific edge to use. *

* * @param mode * Describes the mode packets take for the send-via action. This is not used when the action * is send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in * all Regions of the service insertion-enabled segments. For single-hop, packets traverse a * single intermediate inserted attachment. You can use EdgeOverride to specify a specific * edge to use. * @see SendViaMode * @return Returns a reference to this object so that method calls can be chained together. * @see SendViaMode */ Builder mode(String mode); /** *

* Describes the mode packets take for the send-via action. This is not used when the action is * send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in all * Regions of the service insertion-enabled segments. For single-hop, packets traverse a single * intermediate inserted attachment. You can use EdgeOverride to specify a specific edge to use. *

* * @param mode * Describes the mode packets take for the send-via action. This is not used when the action * is send-to. dual-hop packets traverse attachments in both the source to the * destination core network edges. This mode requires that an inspection attachment must be present in * all Regions of the service insertion-enabled segments. For single-hop, packets traverse a * single intermediate inserted attachment. You can use EdgeOverride to specify a specific * edge to use. * @see SendViaMode * @return Returns a reference to this object so that method calls can be chained together. * @see SendViaMode */ Builder mode(SendViaMode mode); /** *

* The list of destination segments if the service insertion action is send-via. *

* * @param whenSentTo * The list of destination segments if the service insertion action is send-via. * @return Returns a reference to this object so that method calls can be chained together. */ Builder whenSentTo(WhenSentTo whenSentTo); /** *

* The list of destination segments if the service insertion action is send-via. *

* This is a convenience method that creates an instance of the {@link WhenSentTo.Builder} avoiding the need to * create one manually via {@link WhenSentTo#builder()}. * *

* When the {@link Consumer} completes, {@link WhenSentTo.Builder#build()} is called immediately and its result * is passed to {@link #whenSentTo(WhenSentTo)}. * * @param whenSentTo * a consumer that will call methods on {@link WhenSentTo.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #whenSentTo(WhenSentTo) */ default Builder whenSentTo(Consumer whenSentTo) { return whenSentTo(WhenSentTo.builder().applyMutation(whenSentTo).build()); } /** *

* The list of network function groups and any edge overrides for the chosen service insertion action. Used for * both send-to or send-via. *

* * @param via * The list of network function groups and any edge overrides for the chosen service insertion action. * Used for both send-to or send-via. * @return Returns a reference to this object so that method calls can be chained together. */ Builder via(Via via); /** *

* The list of network function groups and any edge overrides for the chosen service insertion action. Used for * both send-to or send-via. *

* This is a convenience method that creates an instance of the {@link Via.Builder} avoiding the need to create * one manually via {@link Via#builder()}. * *

* When the {@link Consumer} completes, {@link Via.Builder#build()} is called immediately and its result is * passed to {@link #via(Via)}. * * @param via * a consumer that will call methods on {@link Via.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #via(Via) */ default Builder via(Consumer via) { return via(Via.builder().applyMutation(via).build()); } } static final class BuilderImpl implements Builder { private String action; private String mode; private WhenSentTo whenSentTo; private Via via; private BuilderImpl() { } private BuilderImpl(ServiceInsertionAction model) { action(model.action); mode(model.mode); whenSentTo(model.whenSentTo); via(model.via); } public final String getAction() { return action; } public final void setAction(String action) { this.action = action; } @Override public final Builder action(String action) { this.action = action; return this; } @Override public final Builder action(SegmentActionServiceInsertion action) { this.action(action == null ? null : action.toString()); return this; } public final String getMode() { return mode; } public final void setMode(String mode) { this.mode = mode; } @Override public final Builder mode(String mode) { this.mode = mode; return this; } @Override public final Builder mode(SendViaMode mode) { this.mode(mode == null ? null : mode.toString()); return this; } public final WhenSentTo.Builder getWhenSentTo() { return whenSentTo != null ? whenSentTo.toBuilder() : null; } public final void setWhenSentTo(WhenSentTo.BuilderImpl whenSentTo) { this.whenSentTo = whenSentTo != null ? whenSentTo.build() : null; } @Override public final Builder whenSentTo(WhenSentTo whenSentTo) { this.whenSentTo = whenSentTo; return this; } public final Via.Builder getVia() { return via != null ? via.toBuilder() : null; } public final void setVia(Via.BuilderImpl via) { this.via = via != null ? via.build() : null; } @Override public final Builder via(Via via) { this.via = via; return this; } @Override public ServiceInsertionAction build() { return new ServiceInsertionAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy