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

software.amazon.awssdk.services.lambda.model.LoggingConfig Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.lambda.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;

/**
 * 

* The function's Amazon CloudWatch Logs configuration settings. *

*/ @Generated("software.amazon.awssdk:codegen") public final class LoggingConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField LOG_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LogFormat").getter(getter(LoggingConfig::logFormatAsString)).setter(setter(Builder::logFormat)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogFormat").build()).build(); private static final SdkField APPLICATION_LOG_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ApplicationLogLevel").getter(getter(LoggingConfig::applicationLogLevelAsString)) .setter(setter(Builder::applicationLogLevel)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationLogLevel").build()) .build(); private static final SdkField SYSTEM_LOG_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SystemLogLevel").getter(getter(LoggingConfig::systemLogLevelAsString)) .setter(setter(Builder::systemLogLevel)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SystemLogLevel").build()).build(); private static final SdkField LOG_GROUP_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LogGroup").getter(getter(LoggingConfig::logGroup)).setter(setter(Builder::logGroup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogGroup").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOG_FORMAT_FIELD, APPLICATION_LOG_LEVEL_FIELD, SYSTEM_LOG_LEVEL_FIELD, LOG_GROUP_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("LogFormat", LOG_FORMAT_FIELD); put("ApplicationLogLevel", APPLICATION_LOG_LEVEL_FIELD); put("SystemLogLevel", SYSTEM_LOG_LEVEL_FIELD); put("LogGroup", LOG_GROUP_FIELD); } }); private static final long serialVersionUID = 1L; private final String logFormat; private final String applicationLogLevel; private final String systemLogLevel; private final String logGroup; private LoggingConfig(BuilderImpl builder) { this.logFormat = builder.logFormat; this.applicationLogLevel = builder.applicationLogLevel; this.systemLogLevel = builder.systemLogLevel; this.logGroup = builder.logGroup; } /** *

* The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain * text and structured JSON. *

*

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

* * @return The format in which Lambda sends your function's application and system logs to CloudWatch. Select * between plain text and structured JSON. * @see LogFormat */ public final LogFormat logFormat() { return LogFormat.fromValue(logFormat); } /** *

* The format in which Lambda sends your function's application and system logs to CloudWatch. Select between plain * text and structured JSON. *

*

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

* * @return The format in which Lambda sends your function's application and system logs to CloudWatch. Select * between plain text and structured JSON. * @see LogFormat */ public final String logFormatAsString() { return logFormat; } /** *

* Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only * sends application logs at the selected level of detail and lower, where TRACE is the highest level * and FATAL is the lowest. *

*

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

* * @return Set this property to filter the application logs for your function that Lambda sends to CloudWatch. * Lambda only sends application logs at the selected level of detail and lower, where TRACE is * the highest level and FATAL is the lowest. * @see ApplicationLogLevel */ public final ApplicationLogLevel applicationLogLevel() { return ApplicationLogLevel.fromValue(applicationLogLevel); } /** *

* Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda only * sends application logs at the selected level of detail and lower, where TRACE is the highest level * and FATAL is the lowest. *

*

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

* * @return Set this property to filter the application logs for your function that Lambda sends to CloudWatch. * Lambda only sends application logs at the selected level of detail and lower, where TRACE is * the highest level and FATAL is the lowest. * @see ApplicationLogLevel */ public final String applicationLogLevelAsString() { return applicationLogLevel; } /** *

* Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends * system logs at the selected level of detail and lower, where DEBUG is the highest level and * WARN is the lowest. *

*

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

* * @return Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda * only sends system logs at the selected level of detail and lower, where DEBUG is the highest * level and WARN is the lowest. * @see SystemLogLevel */ public final SystemLogLevel systemLogLevel() { return SystemLogLevel.fromValue(systemLogLevel); } /** *

* Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only sends * system logs at the selected level of detail and lower, where DEBUG is the highest level and * WARN is the lowest. *

*

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

* * @return Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda * only sends system logs at the selected level of detail and lower, where DEBUG is the highest * level and WARN is the lowest. * @see SystemLogLevel */ public final String systemLogLevelAsString() { return systemLogLevel; } /** *

* The name of the Amazon CloudWatch log group the function sends logs to. By default, Lambda functions send logs to * a default log group named /aws/lambda/<function name>. To use a different log group, enter an * existing log group or enter a new log group name. *

* * @return The name of the Amazon CloudWatch log group the function sends logs to. By default, Lambda functions send * logs to a default log group named /aws/lambda/<function name>. To use a different log * group, enter an existing log group or enter a new log group name. */ public final String logGroup() { return logGroup; } @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(logFormatAsString()); hashCode = 31 * hashCode + Objects.hashCode(applicationLogLevelAsString()); hashCode = 31 * hashCode + Objects.hashCode(systemLogLevelAsString()); hashCode = 31 * hashCode + Objects.hashCode(logGroup()); 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 LoggingConfig)) { return false; } LoggingConfig other = (LoggingConfig) obj; return Objects.equals(logFormatAsString(), other.logFormatAsString()) && Objects.equals(applicationLogLevelAsString(), other.applicationLogLevelAsString()) && Objects.equals(systemLogLevelAsString(), other.systemLogLevelAsString()) && Objects.equals(logGroup(), other.logGroup()); } /** * 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("LoggingConfig").add("LogFormat", logFormatAsString()) .add("ApplicationLogLevel", applicationLogLevelAsString()).add("SystemLogLevel", systemLogLevelAsString()) .add("LogGroup", logGroup()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "LogFormat": return Optional.ofNullable(clazz.cast(logFormatAsString())); case "ApplicationLogLevel": return Optional.ofNullable(clazz.cast(applicationLogLevelAsString())); case "SystemLogLevel": return Optional.ofNullable(clazz.cast(systemLogLevelAsString())); case "LogGroup": return Optional.ofNullable(clazz.cast(logGroup())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((LoggingConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The format in which Lambda sends your function's application and system logs to CloudWatch. Select between * plain text and structured JSON. *

* * @param logFormat * The format in which Lambda sends your function's application and system logs to CloudWatch. Select * between plain text and structured JSON. * @see LogFormat * @return Returns a reference to this object so that method calls can be chained together. * @see LogFormat */ Builder logFormat(String logFormat); /** *

* The format in which Lambda sends your function's application and system logs to CloudWatch. Select between * plain text and structured JSON. *

* * @param logFormat * The format in which Lambda sends your function's application and system logs to CloudWatch. Select * between plain text and structured JSON. * @see LogFormat * @return Returns a reference to this object so that method calls can be chained together. * @see LogFormat */ Builder logFormat(LogFormat logFormat); /** *

* Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda * only sends application logs at the selected level of detail and lower, where TRACE is the * highest level and FATAL is the lowest. *

* * @param applicationLogLevel * Set this property to filter the application logs for your function that Lambda sends to CloudWatch. * Lambda only sends application logs at the selected level of detail and lower, where TRACE * is the highest level and FATAL is the lowest. * @see ApplicationLogLevel * @return Returns a reference to this object so that method calls can be chained together. * @see ApplicationLogLevel */ Builder applicationLogLevel(String applicationLogLevel); /** *

* Set this property to filter the application logs for your function that Lambda sends to CloudWatch. Lambda * only sends application logs at the selected level of detail and lower, where TRACE is the * highest level and FATAL is the lowest. *

* * @param applicationLogLevel * Set this property to filter the application logs for your function that Lambda sends to CloudWatch. * Lambda only sends application logs at the selected level of detail and lower, where TRACE * is the highest level and FATAL is the lowest. * @see ApplicationLogLevel * @return Returns a reference to this object so that method calls can be chained together. * @see ApplicationLogLevel */ Builder applicationLogLevel(ApplicationLogLevel applicationLogLevel); /** *

* Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only * sends system logs at the selected level of detail and lower, where DEBUG is the highest level * and WARN is the lowest. *

* * @param systemLogLevel * Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda * only sends system logs at the selected level of detail and lower, where DEBUG is the * highest level and WARN is the lowest. * @see SystemLogLevel * @return Returns a reference to this object so that method calls can be chained together. * @see SystemLogLevel */ Builder systemLogLevel(String systemLogLevel); /** *

* Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda only * sends system logs at the selected level of detail and lower, where DEBUG is the highest level * and WARN is the lowest. *

* * @param systemLogLevel * Set this property to filter the system logs for your function that Lambda sends to CloudWatch. Lambda * only sends system logs at the selected level of detail and lower, where DEBUG is the * highest level and WARN is the lowest. * @see SystemLogLevel * @return Returns a reference to this object so that method calls can be chained together. * @see SystemLogLevel */ Builder systemLogLevel(SystemLogLevel systemLogLevel); /** *

* The name of the Amazon CloudWatch log group the function sends logs to. By default, Lambda functions send * logs to a default log group named /aws/lambda/<function name>. To use a different log * group, enter an existing log group or enter a new log group name. *

* * @param logGroup * The name of the Amazon CloudWatch log group the function sends logs to. By default, Lambda functions * send logs to a default log group named /aws/lambda/<function name>. To use a * different log group, enter an existing log group or enter a new log group name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder logGroup(String logGroup); } static final class BuilderImpl implements Builder { private String logFormat; private String applicationLogLevel; private String systemLogLevel; private String logGroup; private BuilderImpl() { } private BuilderImpl(LoggingConfig model) { logFormat(model.logFormat); applicationLogLevel(model.applicationLogLevel); systemLogLevel(model.systemLogLevel); logGroup(model.logGroup); } public final String getLogFormat() { return logFormat; } public final void setLogFormat(String logFormat) { this.logFormat = logFormat; } @Override public final Builder logFormat(String logFormat) { this.logFormat = logFormat; return this; } @Override public final Builder logFormat(LogFormat logFormat) { this.logFormat(logFormat == null ? null : logFormat.toString()); return this; } public final String getApplicationLogLevel() { return applicationLogLevel; } public final void setApplicationLogLevel(String applicationLogLevel) { this.applicationLogLevel = applicationLogLevel; } @Override public final Builder applicationLogLevel(String applicationLogLevel) { this.applicationLogLevel = applicationLogLevel; return this; } @Override public final Builder applicationLogLevel(ApplicationLogLevel applicationLogLevel) { this.applicationLogLevel(applicationLogLevel == null ? null : applicationLogLevel.toString()); return this; } public final String getSystemLogLevel() { return systemLogLevel; } public final void setSystemLogLevel(String systemLogLevel) { this.systemLogLevel = systemLogLevel; } @Override public final Builder systemLogLevel(String systemLogLevel) { this.systemLogLevel = systemLogLevel; return this; } @Override public final Builder systemLogLevel(SystemLogLevel systemLogLevel) { this.systemLogLevel(systemLogLevel == null ? null : systemLogLevel.toString()); return this; } public final String getLogGroup() { return logGroup; } public final void setLogGroup(String logGroup) { this.logGroup = logGroup; } @Override public final Builder logGroup(String logGroup) { this.logGroup = logGroup; return this; } @Override public LoggingConfig build() { return new LoggingConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy