software.amazon.awssdk.services.cloudwatchlogs.model.Destination Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudwatchlogs Show documentation
Show all versions of cloudwatchlogs Show documentation
The AWS Java SDK for Amazon CloudWatch Logs module holds the client classes that are used for
communicating with Amazon CloudWatch Logs Service
/*
* 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 extends Builder> 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy