software.amazon.awssdk.services.applicationinsights.model.CreateApplicationRequest Maven / Gradle / Ivy
Show all versions of applicationinsights Show documentation
/*
* 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.applicationinsights.model;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateApplicationRequest extends ApplicationInsightsRequest implements
ToCopyableBuilder {
private static final SdkField RESOURCE_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceGroupName").getter(getter(CreateApplicationRequest::resourceGroupName))
.setter(setter(Builder::resourceGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceGroupName").build()).build();
private static final SdkField OPS_CENTER_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("OpsCenterEnabled").getter(getter(CreateApplicationRequest::opsCenterEnabled))
.setter(setter(Builder::opsCenterEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OpsCenterEnabled").build()).build();
private static final SdkField CWE_MONITOR_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("CWEMonitorEnabled").getter(getter(CreateApplicationRequest::cweMonitorEnabled))
.setter(setter(Builder::cweMonitorEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CWEMonitorEnabled").build()).build();
private static final SdkField OPS_ITEM_SNS_TOPIC_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OpsItemSNSTopicArn").getter(getter(CreateApplicationRequest::opsItemSNSTopicArn))
.setter(setter(Builder::opsItemSNSTopicArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OpsItemSNSTopicArn").build())
.build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(CreateApplicationRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField AUTO_CONFIG_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AutoConfigEnabled").getter(getter(CreateApplicationRequest::autoConfigEnabled))
.setter(setter(Builder::autoConfigEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoConfigEnabled").build()).build();
private static final SdkField AUTO_CREATE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AutoCreate").getter(getter(CreateApplicationRequest::autoCreate)).setter(setter(Builder::autoCreate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoCreate").build()).build();
private static final SdkField GROUPING_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GroupingType").getter(getter(CreateApplicationRequest::groupingTypeAsString))
.setter(setter(Builder::groupingType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GroupingType").build()).build();
private static final SdkField ATTACH_MISSING_PERMISSION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AttachMissingPermission").getter(getter(CreateApplicationRequest::attachMissingPermission))
.setter(setter(Builder::attachMissingPermission))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttachMissingPermission").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_GROUP_NAME_FIELD,
OPS_CENTER_ENABLED_FIELD, CWE_MONITOR_ENABLED_FIELD, OPS_ITEM_SNS_TOPIC_ARN_FIELD, TAGS_FIELD,
AUTO_CONFIG_ENABLED_FIELD, AUTO_CREATE_FIELD, GROUPING_TYPE_FIELD, ATTACH_MISSING_PERMISSION_FIELD));
private final String resourceGroupName;
private final Boolean opsCenterEnabled;
private final Boolean cweMonitorEnabled;
private final String opsItemSNSTopicArn;
private final List tags;
private final Boolean autoConfigEnabled;
private final Boolean autoCreate;
private final String groupingType;
private final Boolean attachMissingPermission;
private CreateApplicationRequest(BuilderImpl builder) {
super(builder);
this.resourceGroupName = builder.resourceGroupName;
this.opsCenterEnabled = builder.opsCenterEnabled;
this.cweMonitorEnabled = builder.cweMonitorEnabled;
this.opsItemSNSTopicArn = builder.opsItemSNSTopicArn;
this.tags = builder.tags;
this.autoConfigEnabled = builder.autoConfigEnabled;
this.autoCreate = builder.autoCreate;
this.groupingType = builder.groupingType;
this.attachMissingPermission = builder.attachMissingPermission;
}
/**
*
* The name of the resource group.
*
*
* @return The name of the resource group.
*/
public final String resourceGroupName() {
return resourceGroupName;
}
/**
*
* When set to true
, creates opsItems for any problems detected on an application.
*
*
* @return When set to true
, creates opsItems for any problems detected on an application.
*/
public final Boolean opsCenterEnabled() {
return opsCenterEnabled;
}
/**
*
* Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as
* instance terminated
, failed deployment
, and others.
*
*
* @return Indicates whether Application Insights can listen to CloudWatch events for the application resources,
* such as instance terminated
, failed deployment
, and others.
*/
public final Boolean cweMonitorEnabled() {
return cweMonitorEnabled;
}
/**
*
* The SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive
* notifications for updates to the opsItem.
*
*
* @return The SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to
* receive notifications for updates to the opsItem.
*/
public final String opsItemSNSTopicArn() {
return opsItemSNSTopicArn;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* List of tags to add to the application. tag key (Key
) and an associated tag value (
* Value
). The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256
* characters.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return List of tags to add to the application. tag key (Key
) and an associated tag value (
* Value
). The maximum length of a tag key is 128 characters. The maximum length of a tag value
* is 256 characters.
*/
public final List tags() {
return tags;
}
/**
*
* Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
*
*
* @return Indicates whether Application Insights automatically configures unmonitored resources in the resource
* group.
*/
public final Boolean autoConfigEnabled() {
return autoConfigEnabled;
}
/**
*
* Configures all of the resources in the resource group by applying the recommended configurations.
*
*
* @return Configures all of the resources in the resource group by applying the recommended configurations.
*/
public final Boolean autoCreate() {
return autoCreate;
}
/**
*
* Application Insights can create applications based on a resource group or on an account. To create an
* account-based application using all of the resources in the account, set this parameter to
* ACCOUNT_BASED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #groupingType} will
* return {@link GroupingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #groupingTypeAsString}.
*
*
* @return Application Insights can create applications based on a resource group or on an account. To create an
* account-based application using all of the resources in the account, set this parameter to
* ACCOUNT_BASED
.
* @see GroupingType
*/
public final GroupingType groupingType() {
return GroupingType.fromValue(groupingType);
}
/**
*
* Application Insights can create applications based on a resource group or on an account. To create an
* account-based application using all of the resources in the account, set this parameter to
* ACCOUNT_BASED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #groupingType} will
* return {@link GroupingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #groupingTypeAsString}.
*
*
* @return Application Insights can create applications based on a resource group or on an account. To create an
* account-based application using all of the resources in the account, set this parameter to
* ACCOUNT_BASED
.
* @see GroupingType
*/
public final String groupingTypeAsString() {
return groupingType;
}
/**
*
* If set to true, the managed policies for SSM and CW will be attached to the instance roles if they are missing.
*
*
* @return If set to true, the managed policies for SSM and CW will be attached to the instance roles if they are
* missing.
*/
public final Boolean attachMissingPermission() {
return attachMissingPermission;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(resourceGroupName());
hashCode = 31 * hashCode + Objects.hashCode(opsCenterEnabled());
hashCode = 31 * hashCode + Objects.hashCode(cweMonitorEnabled());
hashCode = 31 * hashCode + Objects.hashCode(opsItemSNSTopicArn());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(autoConfigEnabled());
hashCode = 31 * hashCode + Objects.hashCode(autoCreate());
hashCode = 31 * hashCode + Objects.hashCode(groupingTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(attachMissingPermission());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateApplicationRequest)) {
return false;
}
CreateApplicationRequest other = (CreateApplicationRequest) obj;
return Objects.equals(resourceGroupName(), other.resourceGroupName())
&& Objects.equals(opsCenterEnabled(), other.opsCenterEnabled())
&& Objects.equals(cweMonitorEnabled(), other.cweMonitorEnabled())
&& Objects.equals(opsItemSNSTopicArn(), other.opsItemSNSTopicArn()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(autoConfigEnabled(), other.autoConfigEnabled())
&& Objects.equals(autoCreate(), other.autoCreate())
&& Objects.equals(groupingTypeAsString(), other.groupingTypeAsString())
&& Objects.equals(attachMissingPermission(), other.attachMissingPermission());
}
/**
* 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("CreateApplicationRequest").add("ResourceGroupName", resourceGroupName())
.add("OpsCenterEnabled", opsCenterEnabled()).add("CWEMonitorEnabled", cweMonitorEnabled())
.add("OpsItemSNSTopicArn", opsItemSNSTopicArn()).add("Tags", hasTags() ? tags() : null)
.add("AutoConfigEnabled", autoConfigEnabled()).add("AutoCreate", autoCreate())
.add("GroupingType", groupingTypeAsString()).add("AttachMissingPermission", attachMissingPermission()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ResourceGroupName":
return Optional.ofNullable(clazz.cast(resourceGroupName()));
case "OpsCenterEnabled":
return Optional.ofNullable(clazz.cast(opsCenterEnabled()));
case "CWEMonitorEnabled":
return Optional.ofNullable(clazz.cast(cweMonitorEnabled()));
case "OpsItemSNSTopicArn":
return Optional.ofNullable(clazz.cast(opsItemSNSTopicArn()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "AutoConfigEnabled":
return Optional.ofNullable(clazz.cast(autoConfigEnabled()));
case "AutoCreate":
return Optional.ofNullable(clazz.cast(autoCreate()));
case "GroupingType":
return Optional.ofNullable(clazz.cast(groupingTypeAsString()));
case "AttachMissingPermission":
return Optional.ofNullable(clazz.cast(attachMissingPermission()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function