Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.qapps.model.CreateQAppRequest Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Q Apps module holds the client classes that are used for
communicating with Q Apps.
/*
* 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.qapps.model;
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.Consumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 CreateQAppRequest extends QAppsRequest implements
ToCopyableBuilder {
private static final SdkField INSTANCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceId").getter(getter(CreateQAppRequest::instanceId)).setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("instance-id").build()).build();
private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("title")
.getter(getter(CreateQAppRequest::title)).setter(setter(Builder::title))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("title").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(CreateQAppRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField APP_DEFINITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("appDefinition")
.getter(getter(CreateQAppRequest::appDefinition)).setter(setter(Builder::appDefinition))
.constructor(AppDefinitionInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("appDefinition").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(CreateQAppRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_ID_FIELD,
TITLE_FIELD, DESCRIPTION_FIELD, APP_DEFINITION_FIELD, TAGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String instanceId;
private final String title;
private final String description;
private final AppDefinitionInput appDefinition;
private final Map tags;
private CreateQAppRequest(BuilderImpl builder) {
super(builder);
this.instanceId = builder.instanceId;
this.title = builder.title;
this.description = builder.description;
this.appDefinition = builder.appDefinition;
this.tags = builder.tags;
}
/**
*
* The unique identifier of the Amazon Q Business application environment instance.
*
*
* @return The unique identifier of the Amazon Q Business application environment instance.
*/
public final String instanceId() {
return instanceId;
}
/**
*
* The title of the new Q App.
*
*
* @return The title of the new Q App.
*/
public final String title() {
return title;
}
/**
*
* The description of the new Q App.
*
*
* @return The description of the new Q App.
*/
public final String description() {
return description;
}
/**
*
* The definition of the new Q App, specifying the cards and flow.
*
*
* @return The definition of the new Q App, specifying the cards and flow.
*/
public final AppDefinitionInput appDefinition() {
return appDefinition;
}
/**
* 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 SdkAutoConstructMap);
}
/**
*
* Optional tags to associate with the new Q App.
*
*
* 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 Optional tags to associate with the new Q App.
*/
public final Map tags() {
return tags;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(title());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(appDefinition());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
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 CreateQAppRequest)) {
return false;
}
CreateQAppRequest other = (CreateQAppRequest) obj;
return Objects.equals(instanceId(), other.instanceId()) && Objects.equals(title(), other.title())
&& Objects.equals(description(), other.description()) && Objects.equals(appDefinition(), other.appDefinition())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags());
}
/**
* 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("CreateQAppRequest").add("InstanceId", instanceId()).add("Title", title())
.add("Description", description()).add("AppDefinition", appDefinition()).add("Tags", hasTags() ? tags() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "instanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "title":
return Optional.ofNullable(clazz.cast(title()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "appDefinition":
return Optional.ofNullable(clazz.cast(appDefinition()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
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("instance-id", INSTANCE_ID_FIELD);
map.put("title", TITLE_FIELD);
map.put("description", DESCRIPTION_FIELD);
map.put("appDefinition", APP_DEFINITION_FIELD);
map.put("tags", TAGS_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function getter(Function g) {
return obj -> g.apply((CreateQAppRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends QAppsRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The unique identifier of the Amazon Q Business application environment instance.
*
*
* @param instanceId
* The unique identifier of the Amazon Q Business application environment instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder instanceId(String instanceId);
/**
*
* The title of the new Q App.
*
*
* @param title
* The title of the new Q App.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder title(String title);
/**
*
* The description of the new Q App.
*
*
* @param description
* The description of the new Q App.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* The definition of the new Q App, specifying the cards and flow.
*
*
* @param appDefinition
* The definition of the new Q App, specifying the cards and flow.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder appDefinition(AppDefinitionInput appDefinition);
/**
*
* The definition of the new Q App, specifying the cards and flow.
*
* This is a convenience method that creates an instance of the {@link AppDefinitionInput.Builder} avoiding the
* need to create one manually via {@link AppDefinitionInput#builder()}.
*
*
* When the {@link Consumer} completes, {@link AppDefinitionInput.Builder#build()} is called immediately and its
* result is passed to {@link #appDefinition(AppDefinitionInput)}.
*
* @param appDefinition
* a consumer that will call methods on {@link AppDefinitionInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #appDefinition(AppDefinitionInput)
*/
default Builder appDefinition(Consumer appDefinition) {
return appDefinition(AppDefinitionInput.builder().applyMutation(appDefinition).build());
}
/**
*
* Optional tags to associate with the new Q App.
*
*
* @param tags
* Optional tags to associate with the new Q App.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends QAppsRequest.BuilderImpl implements Builder {
private String instanceId;
private String title;
private String description;
private AppDefinitionInput appDefinition;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateQAppRequest model) {
super(model);
instanceId(model.instanceId);
title(model.title);
description(model.description);
appDefinition(model.appDefinition);
tags(model.tags);
}
public final String getInstanceId() {
return instanceId;
}
public final void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
@Override
public final Builder instanceId(String instanceId) {
this.instanceId = instanceId;
return this;
}
public final String getTitle() {
return title;
}
public final void setTitle(String title) {
this.title = title;
}
@Override
public final Builder title(String title) {
this.title = title;
return this;
}
public final String getDescription() {
return description;
}
public final void setDescription(String description) {
this.description = description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final AppDefinitionInput.Builder getAppDefinition() {
return appDefinition != null ? appDefinition.toBuilder() : null;
}
public final void setAppDefinition(AppDefinitionInput.BuilderImpl appDefinition) {
this.appDefinition = appDefinition != null ? appDefinition.build() : null;
}
@Override
public final Builder appDefinition(AppDefinitionInput appDefinition) {
this.appDefinition = appDefinition;
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagMapCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagMapCopier.copy(tags);
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateQAppRequest build() {
return new CreateQAppRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}