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

software.amazon.awssdk.services.cloudwatchlogs.model.Destination Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudWatch Logs module holds the client classes that are used for communicating with Amazon CloudWatch Logs Service

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.cloudwatchlogs.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.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;

/**
 * 

* Represents a cross-account destination that receives subscription log events. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Destination implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DESTINATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("destinationName").getter(getter(Destination::destinationName)).setter(setter(Builder::destinationName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationName").build()).build(); private static final SdkField TARGET_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("targetArn").getter(getter(Destination::targetArn)).setter(setter(Builder::targetArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targetArn").build()).build(); private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("roleArn").getter(getter(Destination::roleArn)).setter(setter(Builder::roleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build(); private static final SdkField ACCESS_POLICY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("accessPolicy").getter(getter(Destination::accessPolicy)).setter(setter(Builder::accessPolicy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("accessPolicy").build()).build(); private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn") .getter(getter(Destination::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build(); private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("creationTime").getter(getter(Destination::creationTime)).setter(setter(Builder::creationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESTINATION_NAME_FIELD, TARGET_ARN_FIELD, ROLE_ARN_FIELD, ACCESS_POLICY_FIELD, ARN_FIELD, CREATION_TIME_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String destinationName; private final String targetArn; private final String roleArn; private final String accessPolicy; private final String arn; private final Long creationTime; private Destination(BuilderImpl builder) { this.destinationName = builder.destinationName; this.targetArn = builder.targetArn; this.roleArn = builder.roleArn; this.accessPolicy = builder.accessPolicy; this.arn = builder.arn; this.creationTime = builder.creationTime; } /** *

* The name of the destination. *

* * @return The name of the destination. */ public final String destinationName() { return destinationName; } /** *

* The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a Kinesis * stream). *

* * @return The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a * Kinesis stream). */ public final String targetArn() { return targetArn; } /** *

* A role for impersonation, used when delivering log events to the target. *

* * @return A role for impersonation, used when delivering log events to the target. */ public final String roleArn() { return roleArn; } /** *

* An IAM policy document that governs which Amazon Web Services accounts can create subscription filters against * this destination. *

* * @return An IAM policy document that governs which Amazon Web Services accounts can create subscription filters * against this destination. */ public final String accessPolicy() { return accessPolicy; } /** *

* The ARN of this destination. *

* * @return The ARN of this destination. */ public final String arn() { return arn; } /** *

* The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

* * @return The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 * UTC. */ public final Long creationTime() { return creationTime; } @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(destinationName()); hashCode = 31 * hashCode + Objects.hashCode(targetArn()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(accessPolicy()); hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(creationTime()); 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 Destination)) { return false; } Destination other = (Destination) obj; return Objects.equals(destinationName(), other.destinationName()) && Objects.equals(targetArn(), other.targetArn()) && Objects.equals(roleArn(), other.roleArn()) && Objects.equals(accessPolicy(), other.accessPolicy()) && Objects.equals(arn(), other.arn()) && Objects.equals(creationTime(), other.creationTime()); } /** * 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("Destination").add("DestinationName", destinationName()).add("TargetArn", targetArn()) .add("RoleArn", roleArn()).add("AccessPolicy", accessPolicy()).add("Arn", arn()) .add("CreationTime", creationTime()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "destinationName": return Optional.ofNullable(clazz.cast(destinationName())); case "targetArn": return Optional.ofNullable(clazz.cast(targetArn())); case "roleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "accessPolicy": return Optional.ofNullable(clazz.cast(accessPolicy())); case "arn": return Optional.ofNullable(clazz.cast(arn())); case "creationTime": return Optional.ofNullable(clazz.cast(creationTime())); 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("destinationName", DESTINATION_NAME_FIELD); map.put("targetArn", TARGET_ARN_FIELD); map.put("roleArn", ROLE_ARN_FIELD); map.put("accessPolicy", ACCESS_POLICY_FIELD); map.put("arn", ARN_FIELD); map.put("creationTime", CREATION_TIME_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((Destination) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the destination. *

* * @param destinationName * The name of the destination. * @return Returns a reference to this object so that method calls can be chained together. */ Builder destinationName(String destinationName); /** *

* The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a * Kinesis stream). *

* * @param targetArn * The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, * a Kinesis stream). * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetArn(String targetArn); /** *

* A role for impersonation, used when delivering log events to the target. *

* * @param roleArn * A role for impersonation, used when delivering log events to the target. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* An IAM policy document that governs which Amazon Web Services accounts can create subscription filters * against this destination. *

* * @param accessPolicy * An IAM policy document that governs which Amazon Web Services accounts can create subscription filters * against this destination. * @return Returns a reference to this object so that method calls can be chained together. */ Builder accessPolicy(String accessPolicy); /** *

* The ARN of this destination. *

* * @param arn * The ARN of this destination. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. *

* * @param creationTime * The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 * 00:00:00 UTC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationTime(Long creationTime); } static final class BuilderImpl implements Builder { private String destinationName; private String targetArn; private String roleArn; private String accessPolicy; private String arn; private Long creationTime; private BuilderImpl() { } private BuilderImpl(Destination model) { destinationName(model.destinationName); targetArn(model.targetArn); roleArn(model.roleArn); accessPolicy(model.accessPolicy); arn(model.arn); creationTime(model.creationTime); } public final String getDestinationName() { return destinationName; } public final void setDestinationName(String destinationName) { this.destinationName = destinationName; } @Override public final Builder destinationName(String destinationName) { this.destinationName = destinationName; return this; } public final String getTargetArn() { return targetArn; } public final void setTargetArn(String targetArn) { this.targetArn = targetArn; } @Override public final Builder targetArn(String targetArn) { this.targetArn = targetArn; return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final String getAccessPolicy() { return accessPolicy; } public final void setAccessPolicy(String accessPolicy) { this.accessPolicy = accessPolicy; } @Override public final Builder accessPolicy(String accessPolicy) { this.accessPolicy = accessPolicy; return this; } 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 Long getCreationTime() { return creationTime; } public final void setCreationTime(Long creationTime) { this.creationTime = creationTime; } @Override public final Builder creationTime(Long creationTime) { this.creationTime = creationTime; return this; } @Override public Destination build() { return new Destination(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy