From d39d75a5d149acd5978f95a2f4290a28f0460bd5 Mon Sep 17 00:00:00 2001
From: AWS Mobile SDK Bot <46607340+awsmobilesdk@users.noreply.github.com>
Date: Fri, 11 Aug 2023 16:56:30 -0300
Subject: [PATCH] feat(aws-android-sdk-core): update models to latest (#3366)
Co-authored-by: Tyler Roach
---
.../model/AssumeRoleRequest.java | 94 +++++++-
.../AssumeRoleWithWebIdentityRequest.java | 19 +-
.../securitytoken/model/ProvidedContext.java | 216 ++++++++++++++++++
.../AssumeRoleRequestMarshaller.java | 16 ++
.../ProvidedContextStaxMarshaller.java | 48 ++++
.../ProvidedContextStaxUnmarshaller.java | 76 ++++++
6 files changed, 461 insertions(+), 8 deletions(-)
create mode 100644 aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/ProvidedContext.java
create mode 100644 aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxMarshaller.java
create mode 100644 aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxUnmarshaller.java
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleRequest.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleRequest.java
index da009c0e36..082c5cb64f 100644
--- a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleRequest.java
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleRequest.java
@@ -506,6 +506,13 @@ public class AssumeRoleRequest extends AmazonWebServiceRequest implements Serial
*/
private String sourceIdentity;
+ /**
+ *
+ * Reserved for future use.
+ *
+ */
+ private java.util.List providedContexts;
+
/**
*
* The Amazon Resource Name (ARN) of the role to assume.
@@ -2870,6 +2877,82 @@ public AssumeRoleRequest withSourceIdentity(String sourceIdentity) {
return this;
}
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * @return
+ * Reserved for future use.
+ *
+ */
+ public java.util.List getProvidedContexts() {
+ return providedContexts;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * @param providedContexts
+ * Reserved for future use.
+ *
+ */
+ public void setProvidedContexts(java.util.Collection providedContexts) {
+ if (providedContexts == null) {
+ this.providedContexts = null;
+ return;
+ }
+
+ this.providedContexts = new java.util.ArrayList(providedContexts);
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Returns a reference to this object so that method calls can be chained
+ * together.
+ *
+ * @param providedContexts
+ * Reserved for future use.
+ *
+ * @return A reference to this updated object so that method calls can be
+ * chained together.
+ */
+ public AssumeRoleRequest withProvidedContexts(ProvidedContext... providedContexts) {
+ if (getProvidedContexts() == null) {
+ this.providedContexts = new java.util.ArrayList(
+ providedContexts.length);
+ }
+ for (ProvidedContext value : providedContexts) {
+ this.providedContexts.add(value);
+ }
+ return this;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Returns a reference to this object so that method calls can be chained
+ * together.
+ *
+ * @param providedContexts
+ * Reserved for future use.
+ *
+ * @return A reference to this updated object so that method calls can be
+ * chained together.
+ */
+ public AssumeRoleRequest withProvidedContexts(
+ java.util.Collection providedContexts) {
+ setProvidedContexts(providedContexts);
+ return this;
+ }
+
/**
* Returns a string representation of this object; useful for testing and
* debugging.
@@ -2902,7 +2985,9 @@ public String toString() {
if (getTokenCode() != null)
sb.append("TokenCode: " + getTokenCode() + ",");
if (getSourceIdentity() != null)
- sb.append("SourceIdentity: " + getSourceIdentity());
+ sb.append("SourceIdentity: " + getSourceIdentity() + ",");
+ if (getProvidedContexts() != null)
+ sb.append("ProvidedContexts: " + getProvidedContexts());
sb.append("}");
return sb.toString();
}
@@ -2928,6 +3013,8 @@ public int hashCode() {
hashCode = prime * hashCode + ((getTokenCode() == null) ? 0 : getTokenCode().hashCode());
hashCode = prime * hashCode
+ ((getSourceIdentity() == null) ? 0 : getSourceIdentity().hashCode());
+ hashCode = prime * hashCode
+ + ((getProvidedContexts() == null) ? 0 : getProvidedContexts().hashCode());
return hashCode;
}
@@ -2994,6 +3081,11 @@ public boolean equals(Object obj) {
if (other.getSourceIdentity() != null
&& other.getSourceIdentity().equals(this.getSourceIdentity()) == false)
return false;
+ if (other.getProvidedContexts() == null ^ this.getProvidedContexts() == null)
+ return false;
+ if (other.getProvidedContexts() != null
+ && other.getProvidedContexts().equals(this.getProvidedContexts()) == false)
+ return false;
return true;
}
}
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleWithWebIdentityRequest.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleWithWebIdentityRequest.java
index ab8bed0e8f..a6c0de7900 100644
--- a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleWithWebIdentityRequest.java
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/AssumeRoleWithWebIdentityRequest.java
@@ -271,7 +271,8 @@ public class AssumeRoleWithWebIdentityRequest extends AmazonWebServiceRequest im
* the identity provider. Your application must get this token by
* authenticating the user who is using your application with a web identity
* provider before the application makes an
- * AssumeRoleWithWebIdentity
call.
+ * AssumeRoleWithWebIdentity
call. Only tokens with RSA
+ * algorithms (RS256) are supported.
*
*
* Constraints:
@@ -611,7 +612,8 @@ public AssumeRoleWithWebIdentityRequest withRoleSessionName(String roleSessionNa
* the identity provider. Your application must get this token by
* authenticating the user who is using your application with a web identity
* provider before the application makes an
- * AssumeRoleWithWebIdentity
call.
+ * AssumeRoleWithWebIdentity
call. Only tokens with RSA
+ * algorithms (RS256) are supported.
*
*
* Constraints:
@@ -622,7 +624,8 @@ public AssumeRoleWithWebIdentityRequest withRoleSessionName(String roleSessionNa
* provided by the identity provider. Your application must get this
* token by authenticating the user who is using your application
* with a web identity provider before the application makes an
- * AssumeRoleWithWebIdentity
call.
+ * AssumeRoleWithWebIdentity
call. Only tokens with RSA
+ * algorithms (RS256) are supported.
*
*/
public String getWebIdentityToken() {
@@ -635,7 +638,8 @@ public String getWebIdentityToken() {
* the identity provider. Your application must get this token by
* authenticating the user who is using your application with a web identity
* provider before the application makes an
- * AssumeRoleWithWebIdentity
call.
+ * AssumeRoleWithWebIdentity
call. Only tokens with RSA
+ * algorithms (RS256) are supported.
*
*
* Constraints:
@@ -647,7 +651,7 @@ public String getWebIdentityToken() {
* this token by authenticating the user who is using your
* application with a web identity provider before the
* application makes an AssumeRoleWithWebIdentity
- * call.
+ * call. Only tokens with RSA algorithms (RS256) are supported.
*
*/
public void setWebIdentityToken(String webIdentityToken) {
@@ -660,7 +664,8 @@ public void setWebIdentityToken(String webIdentityToken) {
* the identity provider. Your application must get this token by
* authenticating the user who is using your application with a web identity
* provider before the application makes an
- * AssumeRoleWithWebIdentity
call.
+ * AssumeRoleWithWebIdentity
call. Only tokens with RSA
+ * algorithms (RS256) are supported.
*
*
* Returns a reference to this object so that method calls can be chained
@@ -675,7 +680,7 @@ public void setWebIdentityToken(String webIdentityToken) {
* this token by authenticating the user who is using your
* application with a web identity provider before the
* application makes an AssumeRoleWithWebIdentity
- * call.
+ * call. Only tokens with RSA algorithms (RS256) are supported.
*
* @return A reference to this updated object so that method calls can be
* chained together.
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/ProvidedContext.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/ProvidedContext.java
new file mode 100644
index 0000000000..c91f73b670
--- /dev/null
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/ProvidedContext.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2010-2023 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 com.amazonaws.services.securitytoken.model;
+
+import java.io.Serializable;
+
+/**
+ *
+ * Reserved for future use.
+ *
+ */
+public class ProvidedContext implements Serializable {
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 20 - 2048
+ * Pattern: [
+ * -\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+
+ */
+ private String providerArn;
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 4 - 2048
+ */
+ private String contextAssertion;
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 20 - 2048
+ * Pattern: [
+ * -\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+
+ *
+ * @return
+ * Reserved for future use.
+ *
+ */
+ public String getProviderArn() {
+ return providerArn;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 20 - 2048
+ * Pattern: [
+ * -\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+
+ *
+ * @param providerArn
+ * Reserved for future use.
+ *
+ */
+ public void setProviderArn(String providerArn) {
+ this.providerArn = providerArn;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Returns a reference to this object so that method calls can be chained
+ * together.
+ *
+ * Constraints:
+ * Length: 20 - 2048
+ * Pattern: [
+ * -\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+
+ *
+ * @param providerArn
+ * Reserved for future use.
+ *
+ * @return A reference to this updated object so that method calls can be
+ * chained together.
+ */
+ public ProvidedContext withProviderArn(String providerArn) {
+ this.providerArn = providerArn;
+ return this;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 4 - 2048
+ *
+ * @return
+ * Reserved for future use.
+ *
+ */
+ public String getContextAssertion() {
+ return contextAssertion;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Constraints:
+ * Length: 4 - 2048
+ *
+ * @param contextAssertion
+ * Reserved for future use.
+ *
+ */
+ public void setContextAssertion(String contextAssertion) {
+ this.contextAssertion = contextAssertion;
+ }
+
+ /**
+ *
+ * Reserved for future use.
+ *
+ *
+ * Returns a reference to this object so that method calls can be chained
+ * together.
+ *
+ * Constraints:
+ * Length: 4 - 2048
+ *
+ * @param contextAssertion
+ * Reserved for future use.
+ *
+ * @return A reference to this updated object so that method calls can be
+ * chained together.
+ */
+ public ProvidedContext withContextAssertion(String contextAssertion) {
+ this.contextAssertion = contextAssertion;
+ return this;
+ }
+
+ /**
+ * Returns a string representation of this object; useful for testing and
+ * debugging.
+ *
+ * @return A string representation of this object.
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ if (getProviderArn() != null)
+ sb.append("ProviderArn: " + getProviderArn() + ",");
+ if (getContextAssertion() != null)
+ sb.append("ContextAssertion: " + getContextAssertion());
+ sb.append("}");
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int hashCode = 1;
+
+ hashCode = prime * hashCode
+ + ((getProviderArn() == null) ? 0 : getProviderArn().hashCode());
+ hashCode = prime * hashCode
+ + ((getContextAssertion() == null) ? 0 : getContextAssertion().hashCode());
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+
+ if (obj instanceof ProvidedContext == false)
+ return false;
+ ProvidedContext other = (ProvidedContext) obj;
+
+ if (other.getProviderArn() == null ^ this.getProviderArn() == null)
+ return false;
+ if (other.getProviderArn() != null
+ && other.getProviderArn().equals(this.getProviderArn()) == false)
+ return false;
+ if (other.getContextAssertion() == null ^ this.getContextAssertion() == null)
+ return false;
+ if (other.getContextAssertion() != null
+ && other.getContextAssertion().equals(this.getContextAssertion()) == false)
+ return false;
+ return true;
+ }
+}
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/AssumeRoleRequestMarshaller.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/AssumeRoleRequestMarshaller.java
index 93ffef2ebd..4312545627 100644
--- a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/AssumeRoleRequestMarshaller.java
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/AssumeRoleRequestMarshaller.java
@@ -123,6 +123,22 @@ public Request marshall(AssumeRoleRequest assumeRoleRequest)
String sourceIdentity = assumeRoleRequest.getSourceIdentity();
request.addParameter(prefix, StringUtils.fromString(sourceIdentity));
}
+ if (assumeRoleRequest.getProvidedContexts() != null) {
+ prefix = "ProvidedContexts";
+ java.util.List providedContexts = assumeRoleRequest
+ .getProvidedContexts();
+ int providedContextsIndex = 1;
+ String providedContextsPrefix = prefix;
+ for (ProvidedContext providedContextsItem : providedContexts) {
+ prefix = providedContextsPrefix + ".member." + providedContextsIndex;
+ if (providedContextsItem != null) {
+ ProvidedContextStaxMarshaller.getInstance().marshall(providedContextsItem,
+ request, prefix + ".");
+ }
+ providedContextsIndex++;
+ }
+ prefix = providedContextsPrefix;
+ }
return request;
}
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxMarshaller.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxMarshaller.java
new file mode 100644
index 0000000000..b40e2d5b05
--- /dev/null
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxMarshaller.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010-2023 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 com.amazonaws.services.securitytoken.model.transform;
+
+import com.amazonaws.Request;
+import com.amazonaws.services.securitytoken.model.*;
+import com.amazonaws.util.StringUtils;
+
+/**
+ * StAX marshaller for POJO ProvidedContext
+ */
+class ProvidedContextStaxMarshaller {
+
+ public void marshall(ProvidedContext _providedContext, Request> request, String _prefix) {
+ String prefix;
+ if (_providedContext.getProviderArn() != null) {
+ prefix = _prefix + "ProviderArn";
+ String providerArn = _providedContext.getProviderArn();
+ request.addParameter(prefix, StringUtils.fromString(providerArn));
+ }
+ if (_providedContext.getContextAssertion() != null) {
+ prefix = _prefix + "ContextAssertion";
+ String contextAssertion = _providedContext.getContextAssertion();
+ request.addParameter(prefix, StringUtils.fromString(contextAssertion));
+ }
+ }
+
+ private static ProvidedContextStaxMarshaller instance;
+
+ public static ProvidedContextStaxMarshaller getInstance() {
+ if (instance == null)
+ instance = new ProvidedContextStaxMarshaller();
+ return instance;
+ }
+}
diff --git a/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxUnmarshaller.java b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxUnmarshaller.java
new file mode 100644
index 0000000000..c43eb22424
--- /dev/null
+++ b/aws-android-sdk-core/src/main/java/com/amazonaws/services/securitytoken/model/transform/ProvidedContextStaxUnmarshaller.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2010-2023 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 com.amazonaws.services.securitytoken.model.transform;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.xmlpull.v1.XmlPullParser;
+
+import com.amazonaws.services.securitytoken.model.*;
+import com.amazonaws.transform.Unmarshaller;
+import com.amazonaws.transform.MapEntry;
+import com.amazonaws.transform.StaxUnmarshallerContext;
+import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
+
+/**
+ * StAX unmarshaller for model ProvidedContext
+ */
+class ProvidedContextStaxUnmarshaller implements
+ Unmarshaller {
+
+ public ProvidedContext unmarshall(StaxUnmarshallerContext context) throws Exception {
+ ProvidedContext providedContext = new ProvidedContext();
+
+ int originalDepth = context.getCurrentDepth();
+ int targetDepth = originalDepth + 1;
+
+ if (context.isStartOfDocument())
+ targetDepth += 2;
+
+ while (true) {
+ int xmlEvent = context.nextEvent();
+ if (xmlEvent == XmlPullParser.END_DOCUMENT)
+ break;
+
+ if (xmlEvent == XmlPullParser.START_TAG) {
+ if (context.testExpression("ProviderArn", targetDepth)) {
+ providedContext.setProviderArn(StringStaxUnmarshaller.getInstance().unmarshall(
+ context));
+ continue;
+ }
+ if (context.testExpression("ContextAssertion", targetDepth)) {
+ providedContext.setContextAssertion(StringStaxUnmarshaller.getInstance()
+ .unmarshall(context));
+ continue;
+ }
+ } else if (xmlEvent == XmlPullParser.END_TAG) {
+ if (context.getCurrentDepth() < originalDepth) {
+ break;
+ }
+ }
+ }
+ return providedContext;
+ }
+
+ private static ProvidedContextStaxUnmarshaller instance;
+
+ public static ProvidedContextStaxUnmarshaller getInstance() {
+ if (instance == null)
+ instance = new ProvidedContextStaxUnmarshaller();
+ return instance;
+ }
+}