software.amazon.awssdk.services.cloudwatchlogs.model.LogGroup 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.cloudwatchlogs.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;
/**
*
* Represents a log group.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LogGroup implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField LOG_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogGroup::logGroupName)).setter(setter(Builder::logGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logGroupName").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(LogGroup::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build();
private static final SdkField RETENTION_IN_DAYS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(LogGroup::retentionInDays)).setter(setter(Builder::retentionInDays))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retentionInDays").build()).build();
private static final SdkField METRIC_FILTER_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(LogGroup::metricFilterCount)).setter(setter(Builder::metricFilterCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricFilterCount").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogGroup::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField STORED_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(LogGroup::storedBytes)).setter(setter(Builder::storedBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("storedBytes").build()).build();
private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogGroup::kmsKeyId)).setter(setter(Builder::kmsKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kmsKeyId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOG_GROUP_NAME_FIELD,
CREATION_TIME_FIELD, RETENTION_IN_DAYS_FIELD, METRIC_FILTER_COUNT_FIELD, ARN_FIELD, STORED_BYTES_FIELD,
KMS_KEY_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String logGroupName;
private final Long creationTime;
private final Integer retentionInDays;
private final Integer metricFilterCount;
private final String arn;
private final Long storedBytes;
private final String kmsKeyId;
private LogGroup(BuilderImpl builder) {
this.logGroupName = builder.logGroupName;
this.creationTime = builder.creationTime;
this.retentionInDays = builder.retentionInDays;
this.metricFilterCount = builder.metricFilterCount;
this.arn = builder.arn;
this.storedBytes = builder.storedBytes;
this.kmsKeyId = builder.kmsKeyId;
}
/**
*
* The name of the log group.
*
*
* @return The name of the log group.
*/
public String logGroupName() {
return logGroupName;
}
/**
*
* The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
*
*
* @return The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00
* UTC.
*/
public Long creationTime() {
return creationTime;
}
/**
* Returns the value of the RetentionInDays property for this object.
*
* @return The value of the RetentionInDays property for this object.
*/
public Integer retentionInDays() {
return retentionInDays;
}
/**
*
* The number of metric filters.
*
*
* @return The number of metric filters.
*/
public Integer metricFilterCount() {
return metricFilterCount;
}
/**
*
* The Amazon Resource Name (ARN) of the log group.
*
*
* @return The Amazon Resource Name (ARN) of the log group.
*/
public String arn() {
return arn;
}
/**
*
* The number of bytes stored.
*
*
* @return The number of bytes stored.
*/
public Long storedBytes() {
return storedBytes;
}
/**
*
* The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.
*
*
* @return The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.
*/
public String kmsKeyId() {
return kmsKeyId;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(logGroupName());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(retentionInDays());
hashCode = 31 * hashCode + Objects.hashCode(metricFilterCount());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(storedBytes());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof LogGroup)) {
return false;
}
LogGroup other = (LogGroup) obj;
return Objects.equals(logGroupName(), other.logGroupName()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(retentionInDays(), other.retentionInDays())
&& Objects.equals(metricFilterCount(), other.metricFilterCount()) && Objects.equals(arn(), other.arn())
&& Objects.equals(storedBytes(), other.storedBytes()) && Objects.equals(kmsKeyId(), other.kmsKeyId());
}
/**
* 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 String toString() {
return ToString.builder("LogGroup").add("LogGroupName", logGroupName()).add("CreationTime", creationTime())
.add("RetentionInDays", retentionInDays()).add("MetricFilterCount", metricFilterCount()).add("Arn", arn())
.add("StoredBytes", storedBytes()).add("KmsKeyId", kmsKeyId()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "logGroupName":
return Optional.ofNullable(clazz.cast(logGroupName()));
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "retentionInDays":
return Optional.ofNullable(clazz.cast(retentionInDays()));
case "metricFilterCount":
return Optional.ofNullable(clazz.cast(metricFilterCount()));
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "storedBytes":
return Optional.ofNullable(clazz.cast(storedBytes()));
case "kmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy