software.amazon.awssdk.services.pinpoint.model.GCMChannelResponse Maven / Gradle / Ivy
Show all versions of pinpoint 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.pinpoint.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;
/**
*
* Provides information about the status and settings of the GCM channel for an application. The GCM channel enables
* Amazon Pinpoint to send push notifications through the Firebase Cloud Messaging (FCM), formerly Google Cloud
* Messaging (GCM), service.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GCMChannelResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(GCMChannelResponse::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationDate").getter(getter(GCMChannelResponse::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField CREDENTIAL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Credential").getter(getter(GCMChannelResponse::credential)).setter(setter(Builder::credential))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Credential").build()).build();
private static final SdkField DEFAULT_AUTHENTICATION_METHOD_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("DefaultAuthenticationMethod")
.getter(getter(GCMChannelResponse::defaultAuthenticationMethod))
.setter(setter(Builder::defaultAuthenticationMethod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultAuthenticationMethod")
.build()).build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enabled").getter(getter(GCMChannelResponse::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build();
private static final SdkField HAS_CREDENTIAL_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("HasCredential").getter(getter(GCMChannelResponse::hasCredential)).setter(setter(Builder::hasCredential))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HasCredential").build()).build();
private static final SdkField HAS_FCM_SERVICE_CREDENTIALS_FIELD = SdkField
. builder(MarshallingType.BOOLEAN).memberName("HasFcmServiceCredentials")
.getter(getter(GCMChannelResponse::hasFcmServiceCredentials)).setter(setter(Builder::hasFcmServiceCredentials))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HasFcmServiceCredentials").build())
.build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(GCMChannelResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField IS_ARCHIVED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsArchived").getter(getter(GCMChannelResponse::isArchived)).setter(setter(Builder::isArchived))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsArchived").build()).build();
private static final SdkField LAST_MODIFIED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastModifiedBy").getter(getter(GCMChannelResponse::lastModifiedBy))
.setter(setter(Builder::lastModifiedBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedBy").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastModifiedDate").getter(getter(GCMChannelResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Platform").getter(getter(GCMChannelResponse::platform)).setter(setter(Builder::platform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Platform").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Version").getter(getter(GCMChannelResponse::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Version").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
CREATION_DATE_FIELD, CREDENTIAL_FIELD, DEFAULT_AUTHENTICATION_METHOD_FIELD, ENABLED_FIELD, HAS_CREDENTIAL_FIELD,
HAS_FCM_SERVICE_CREDENTIALS_FIELD, ID_FIELD, IS_ARCHIVED_FIELD, LAST_MODIFIED_BY_FIELD, LAST_MODIFIED_DATE_FIELD,
PLATFORM_FIELD, VERSION_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final String creationDate;
private final String credential;
private final String defaultAuthenticationMethod;
private final Boolean enabled;
private final Boolean hasCredential;
private final Boolean hasFcmServiceCredentials;
private final String id;
private final Boolean isArchived;
private final String lastModifiedBy;
private final String lastModifiedDate;
private final String platform;
private final Integer version;
private GCMChannelResponse(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.creationDate = builder.creationDate;
this.credential = builder.credential;
this.defaultAuthenticationMethod = builder.defaultAuthenticationMethod;
this.enabled = builder.enabled;
this.hasCredential = builder.hasCredential;
this.hasFcmServiceCredentials = builder.hasFcmServiceCredentials;
this.id = builder.id;
this.isArchived = builder.isArchived;
this.lastModifiedBy = builder.lastModifiedBy;
this.lastModifiedDate = builder.lastModifiedDate;
this.platform = builder.platform;
this.version = builder.version;
}
/**
*
* The unique identifier for the application that the GCM channel applies to.
*
*
* @return The unique identifier for the application that the GCM channel applies to.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The date and time when the GCM channel was enabled.
*
*
* @return The date and time when the GCM channel was enabled.
*/
public final String creationDate() {
return creationDate;
}
/**
*
* The Web API Key, also referred to as an API_KEY or server key, that you received from Google to
* communicate with Google services.
*
*
* @return The Web API Key, also referred to as an API_KEY or server key, that you received from
* Google to communicate with Google services.
*/
public final String credential() {
return credential;
}
/**
*
* The default authentication method used for GCM. Values are either "TOKEN" or "KEY". Defaults to "KEY".
*
*
* @return The default authentication method used for GCM. Values are either "TOKEN" or "KEY". Defaults to "KEY".
*/
public final String defaultAuthenticationMethod() {
return defaultAuthenticationMethod;
}
/**
*
* Specifies whether the GCM channel is enabled for the application.
*
*
* @return Specifies whether the GCM channel is enabled for the application.
*/
public final Boolean enabled() {
return enabled;
}
/**
*
* (Not used) This property is retained only for backward compatibility.
*
*
* @return (Not used) This property is retained only for backward compatibility.
*/
public final Boolean hasCredential() {
return hasCredential;
}
/**
*
* Returns true if the JSON file provided by Google during registration process was used in the ServiceJson
* field of the request.
*
*
* @return Returns true if the JSON file provided by Google during registration process was used in the
* ServiceJson field of the request.
*/
public final Boolean hasFcmServiceCredentials() {
return hasFcmServiceCredentials;
}
/**
*
* (Deprecated) An identifier for the GCM channel. This property is retained only for backward compatibility.
*
*
* @return (Deprecated) An identifier for the GCM channel. This property is retained only for backward
* compatibility.
*/
public final String id() {
return id;
}
/**
*
* Specifies whether the GCM channel is archived.
*
*
* @return Specifies whether the GCM channel is archived.
*/
public final Boolean isArchived() {
return isArchived;
}
/**
*
* The user who last modified the GCM channel.
*
*
* @return The user who last modified the GCM channel.
*/
public final String lastModifiedBy() {
return lastModifiedBy;
}
/**
*
* The date and time when the GCM channel was last modified.
*
*
* @return The date and time when the GCM channel was last modified.
*/
public final String lastModifiedDate() {
return lastModifiedDate;
}
/**
*
* The type of messaging or notification platform for the channel. For the GCM channel, this value is GCM.
*
*
* @return The type of messaging or notification platform for the channel. For the GCM channel, this value is GCM.
*/
public final String platform() {
return platform;
}
/**
*
* The current version of the GCM channel.
*
*
* @return The current version of the GCM channel.
*/
public final Integer version() {
return version;
}
@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(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(credential());
hashCode = 31 * hashCode + Objects.hashCode(defaultAuthenticationMethod());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
hashCode = 31 * hashCode + Objects.hashCode(hasCredential());
hashCode = 31 * hashCode + Objects.hashCode(hasFcmServiceCredentials());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(isArchived());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedBy());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
hashCode = 31 * hashCode + Objects.hashCode(platform());
hashCode = 31 * hashCode + Objects.hashCode(version());
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 GCMChannelResponse)) {
return false;
}
GCMChannelResponse other = (GCMChannelResponse) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(credential(), other.credential())
&& Objects.equals(defaultAuthenticationMethod(), other.defaultAuthenticationMethod())
&& Objects.equals(enabled(), other.enabled()) && Objects.equals(hasCredential(), other.hasCredential())
&& Objects.equals(hasFcmServiceCredentials(), other.hasFcmServiceCredentials())
&& Objects.equals(id(), other.id()) && Objects.equals(isArchived(), other.isArchived())
&& Objects.equals(lastModifiedBy(), other.lastModifiedBy())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate()) && Objects.equals(platform(), other.platform())
&& Objects.equals(version(), other.version());
}
/**
* 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("GCMChannelResponse").add("ApplicationId", applicationId()).add("CreationDate", creationDate())
.add("Credential", credential()).add("DefaultAuthenticationMethod", defaultAuthenticationMethod())
.add("Enabled", enabled()).add("HasCredential", hasCredential())
.add("HasFcmServiceCredentials", hasFcmServiceCredentials()).add("Id", id()).add("IsArchived", isArchived())
.add("LastModifiedBy", lastModifiedBy()).add("LastModifiedDate", lastModifiedDate()).add("Platform", platform())
.add("Version", version()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "Credential":
return Optional.ofNullable(clazz.cast(credential()));
case "DefaultAuthenticationMethod":
return Optional.ofNullable(clazz.cast(defaultAuthenticationMethod()));
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "HasCredential":
return Optional.ofNullable(clazz.cast(hasCredential()));
case "HasFcmServiceCredentials":
return Optional.ofNullable(clazz.cast(hasFcmServiceCredentials()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "IsArchived":
return Optional.ofNullable(clazz.cast(isArchived()));
case "LastModifiedBy":
return Optional.ofNullable(clazz.cast(lastModifiedBy()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
case "Platform":
return Optional.ofNullable(clazz.cast(platform()));
case "Version":
return Optional.ofNullable(clazz.cast(version()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function