/// <summary> /// Creates a new identity pool. The identity pool is a store of user identity information /// that is specific to your AWS account. The limit on identity pools is 60 per account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool service method.</param> /// /// <returns>The response from the CreateIdentityPool service method, as returned by CognitoIdentity.</returns> /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException"> /// Thrown when the service encounters an error during processing the request. /// </exception> /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException"> /// Thrown for missing or bad input parameter(s). /// </exception> /// <exception cref="Amazon.CognitoIdentity.Model.LimitExceededException"> /// Thrown when the total number of user pools has exceeded a preset limit. /// </exception> /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException"> /// Thrown when a user tries to use a login which is already linked to another account. /// </exception> /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException"> /// Thrown when a request is throttled. /// </exception> internal CreateIdentityPoolResponse CreateIdentityPool(CreateIdentityPoolRequest request) { var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.Instance; return Invoke<CreateIdentityPoolRequest,CreateIdentityPoolResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateIdentityPool operation. /// <seealso cref="Amazon.CognitoIdentity.IAmazonCognitoIdentity.CreateIdentityPool"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateIdentityPoolResponse> CreateIdentityPoolAsync(CreateIdentityPoolRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateIdentityPoolRequest, CreateIdentityPoolResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the CreateIdentityPool operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool operation on AmazonCognitoIdentityClient.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public void CreateIdentityPoolAsync(CreateIdentityPoolRequest request, AmazonServiceCallback<CreateIdentityPoolRequest, CreateIdentityPoolResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<CreateIdentityPoolRequest,CreateIdentityPoolResponse> responseObject = new AmazonServiceResult<CreateIdentityPoolRequest,CreateIdentityPoolResponse>((CreateIdentityPoolRequest)req, (CreateIdentityPoolResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<CreateIdentityPoolRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the CreateIdentityPool operation. /// <seealso cref="Amazon.CognitoIdentity.IAmazonCognitoIdentity"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool operation on AmazonCognitoIdentityClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateIdentityPool /// operation.</returns> public IAsyncResult BeginCreateIdentityPool(CreateIdentityPoolRequest request, AsyncCallback callback, object state) { var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.Instance; return BeginInvoke<CreateIdentityPoolRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Creates a new identity pool. The identity pool is a store of user identity information /// that is specific to your AWS account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool service method.</param> /// /// <returns>The response from the CreateIdentityPool service method, as returned by CognitoIdentity.</returns> /// <exception cref="T:Amazon.CognitoIdentity.Model.InternalErrorException"> /// Thrown when the service encounters an error during processing the request. /// </exception> /// <exception cref="T:Amazon.CognitoIdentity.Model.InvalidParameterException"> /// Thrown for missing or bad input parameter(s). /// </exception> /// <exception cref="T:Amazon.CognitoIdentity.Model.LimitExceededException"> /// Thrown when the total number of user pools has exceeded a preset limit. /// </exception> /// <exception cref="T:Amazon.CognitoIdentity.Model.NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="T:Amazon.CognitoIdentity.Model.ResourceConflictException"> /// Thrown when a user tries to use a login which is already linked to another account. /// </exception> /// <exception cref="T:Amazon.CognitoIdentity.Model.TooManyRequestsException"> /// Thrown when a request is throttled. /// </exception> public CreateIdentityPoolResponse CreateIdentityPool(CreateIdentityPoolRequest request) { var task = CreateIdentityPoolAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private void CreateIdentityPool(out string poolId, out string poolName) { poolName = "netTestPool" + DateTime.Now.ToFileTime(); var request = new CreateIdentityPoolRequest { IdentityPoolName = poolName, AllowUnauthenticatedIdentities = true #if INCLUDE_FACEBOOK_TESTS , SupportedLoginProviders = new Dictionary<string, string>() { { FacebookProvider, FacebookAppId } } #endif }; var createPoolResult = Client.CreateIdentityPool(request); Assert.IsNotNull(createPoolResult.IdentityPoolId); Assert.IsNotNull(createPoolResult.IdentityPoolName); Assert.AreEqual(request.AllowUnauthenticatedIdentities, createPoolResult.AllowUnauthenticatedIdentities); poolId = createPoolResult.IdentityPoolId; allPoolIds.Add(poolId); var describePoolResult = Client.DescribeIdentityPool(new DescribeIdentityPoolRequest { IdentityPoolId = poolId }); Assert.AreEqual(poolId, describePoolResult.IdentityPoolId); Assert.AreEqual(poolName, describePoolResult.IdentityPoolName); var getIdentityPoolRolesResult = Client.GetIdentityPoolRoles(poolId); Assert.AreEqual(poolId, getIdentityPoolRolesResult.IdentityPoolId); Assert.AreEqual(0, getIdentityPoolRolesResult.Roles.Count); var roles = new Dictionary<string, string>(StringComparer.Ordinal); if ((poolRoles & PoolRoles.Unauthenticated) == PoolRoles.Unauthenticated) roles["unauthenticated"] = PrepareRole(); if ((poolRoles & PoolRoles.Authenticated) == PoolRoles.Authenticated) roles["authenticated"] = PrepareRole(); Client.SetIdentityPoolRoles(new SetIdentityPoolRolesRequest { IdentityPoolId = poolId, Roles = roles }); getIdentityPoolRolesResult = Client.GetIdentityPoolRoles(poolId); Assert.AreEqual(poolId, getIdentityPoolRolesResult.IdentityPoolId); Assert.AreEqual(NumberOfPoolRoles, getIdentityPoolRolesResult.Roles.Count); Thread.Sleep(2000); }
/// <summary> /// Initiates the asynchronous execution of the CreateIdentityPool operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateIdentityPoolResponse> CreateIdentityPoolAsync(CreateIdentityPoolRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.Instance; return InvokeAsync<CreateIdentityPoolRequest,CreateIdentityPoolResponse>(request, marshaller, unmarshaller, cancellationToken); }
private Amazon.CognitoIdentity.Model.CreateIdentityPoolResponse CallAWSServiceOperation(IAmazonCognitoIdentity client, Amazon.CognitoIdentity.Model.CreateIdentityPoolRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Identity", "CreateIdentityPool"); try { #if DESKTOP return(client.CreateIdentityPool(request)); #elif CORECLR return(client.CreateIdentityPoolAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CognitoIdentity.Model.CreateIdentityPoolRequest(); if (cmdletContext.AllowUnauthenticatedIdentity != null) { request.AllowUnauthenticatedIdentities = cmdletContext.AllowUnauthenticatedIdentity.Value; } if (cmdletContext.CognitoIdentityProvider != null) { request.CognitoIdentityProviders = cmdletContext.CognitoIdentityProvider; } if (cmdletContext.DeveloperProviderName != null) { request.DeveloperProviderName = cmdletContext.DeveloperProviderName; } if (cmdletContext.IdentityPoolName != null) { request.IdentityPoolName = cmdletContext.IdentityPoolName; } if (cmdletContext.IdentityPoolTag != null) { request.IdentityPoolTags = cmdletContext.IdentityPoolTag; } if (cmdletContext.OpenIdConnectProviderARNs != null) { request.OpenIdConnectProviderARNs = cmdletContext.OpenIdConnectProviderARNs; } if (cmdletContext.SamlProviderARNs != null) { request.SamlProviderARNs = cmdletContext.SamlProviderARNs; } if (cmdletContext.SupportedLoginProvider != null) { request.SupportedLoginProviders = cmdletContext.SupportedLoginProvider; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
IAsyncResult invokeCreateIdentityPool(CreateIdentityPoolRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new CreateIdentityPoolRequestMarshaller(); var unmarshaller = CreateIdentityPoolResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the CreateIdentityPool operation. /// <seealso cref="Amazon.CognitoIdentity.IAmazonCognitoIdentity"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool operation on AmazonCognitoIdentityClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateIdentityPool /// operation.</returns> public IAsyncResult BeginCreateIdentityPool(CreateIdentityPoolRequest request, AsyncCallback callback, object state) { return invokeCreateIdentityPool(request, callback, state, false); }
/// <summary> /// Creates a new identity pool. The identity pool is a store of user identity information /// that is specific to your AWS account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateIdentityPool service method.</param> /// /// <returns>The response from the CreateIdentityPool service method, as returned by CognitoIdentity.</returns> /// <exception cref="InternalErrorException"> /// Thrown when the service encounters an error during processing the request. /// </exception> /// <exception cref="InvalidParameterException"> /// Thrown for missing or bad input parameter(s). /// </exception> /// <exception cref="LimitExceededException"> /// Thrown when the total number of user pools has exceeded a preset limit. /// </exception> /// <exception cref="NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="ResourceConflictException"> /// Thrown when a user tries to use a login which is already linked to another account. /// </exception> /// <exception cref="TooManyRequestsException"> /// Thrown when a request is throttled. /// </exception> public CreateIdentityPoolResponse CreateIdentityPool(CreateIdentityPoolRequest request) { IAsyncResult asyncResult = invokeCreateIdentityPool(request, null, null, true); return EndCreateIdentityPool(asyncResult); }