public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.CreateGroupRequest(); if (cmdletContext.GroupName != null) { request.GroupName = cmdletContext.GroupName; } if (cmdletContext.Path != null) { request.Path = cmdletContext.Path; } 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); }
/// <summary> /// Initiates the asynchronous execution of the CreateGroup operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateGroup 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<CreateGroupResponse> CreateGroupAsync(CreateGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.Instance; return InvokeAsync<CreateGroupRequest,CreateGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal CreateGroupResponse CreateGroup(CreateGroupRequest request) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.Instance; return Invoke<CreateGroupRequest,CreateGroupResponse>(request, marshaller, unmarshaller); }
IAsyncResult invokeCreateGroup(CreateGroupRequest createGroupRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateGroupRequestMarshaller().Marshall(createGroupRequest); var unmarshaller = CreateGroupResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateGroup operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.CreateGroup"/> /// </summary> /// /// <param name="createGroupRequest">Container for the necessary parameters to execute the CreateGroup operation on /// AmazonIdentityManagementService.</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 EndCreateGroup /// operation.</returns> public IAsyncResult BeginCreateGroup(CreateGroupRequest createGroupRequest, AsyncCallback callback, object state) { return invokeCreateGroup(createGroupRequest, callback, state, false); }
/// <summary> /// <para>Creates a new group.</para> <para>For information about the number of groups you can create, see Limitations on IAM Entities in /// <i>Using AWS Identity and Access Management</i> .</para> /// </summary> /// /// <param name="createGroupRequest">Container for the necessary parameters to execute the CreateGroup service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the CreateGroup service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="LimitExceededException"/> /// <exception cref="EntityAlreadyExistsException"/> public CreateGroupResponse CreateGroup(CreateGroupRequest createGroupRequest) { IAsyncResult asyncResult = invokeCreateGroup(createGroupRequest, null, null, true); return EndCreateGroup(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateGroup operation on AmazonIdentityManagementServiceClient.</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 EndCreateGroup /// operation.</returns> public IAsyncResult BeginCreateGroup(CreateGroupRequest request, AsyncCallback callback, object state) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.Instance; return BeginInvoke<CreateGroupRequest>(request, marshaller, unmarshaller, callback, state); }
private Amazon.IdentityManagement.Model.CreateGroupResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.CreateGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "CreateGroup"); try { #if DESKTOP return(client.CreateGroup(request)); #elif CORECLR return(client.CreateGroupAsync(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; } }
/// <summary> /// <para>Creates a new group.</para> <para>For information about the /// number of groups you can create, see Limitations on IAM Entities in /// Using AWS Identity and Access Management.</para> /// </summary> /// /// <param name="createGroupRequest">Container for the necessary /// parameters to execute the CreateGroup service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the CreateGroup service method, as returned /// by AmazonIdentityManagementService.</returns> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="LimitExceededException"/> /// <exception cref="EntityAlreadyExistsException"/> public CreateGroupResponse CreateGroup(CreateGroupRequest createGroupRequest) { IRequest<CreateGroupRequest> request = new CreateGroupRequestMarshaller().Marshall(createGroupRequest); CreateGroupResponse response = Invoke<CreateGroupRequest, CreateGroupResponse> (request, this.signer, CreateGroupResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the CreateGroup operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.CreateGroup"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateGroup 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 async Task<CreateGroupResponse> CreateGroupAsync(CreateGroupRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateGroupRequest, CreateGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Initiates the asynchronous execution of the CreateGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateGroup operation on AmazonIdentityManagementServiceClient.</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 CreateGroupAsync(CreateGroupRequest request, AmazonServiceCallback<CreateGroupRequest, CreateGroupResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<CreateGroupRequest,CreateGroupResponse> responseObject = new AmazonServiceResult<CreateGroupRequest,CreateGroupResponse>((CreateGroupRequest)req, (CreateGroupResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<CreateGroupRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// <para>Creates a new group.</para> <para>For information about the number of groups you can create, see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/index.html?LimitationsOnEntities.html">Limitations on IAM Entities</a> in <i>Using /// AWS Identity and Access Management</i> .</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateGroup service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the CreateGroup service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" /> public CreateGroupResponse CreateGroup(CreateGroupRequest request) { var task = CreateGroupAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
public override async Task<Resource> Create( Resource resource, string correlationIdentifier) { if (null == resource) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameResource); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier); } if (string.IsNullOrWhiteSpace(resource.Identifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidResource); } string informationStarting = string.Format( CultureInfo.InvariantCulture, AmazonProvisioningAgentResources.InformationCreating, resource.Identifier); ProvisioningAgentMonitor.Instance.Inform(informationStarting, true, correlationIdentifier); IAmazonIdentityManagementService proxy = null; try { proxy = AWSClientFactory.CreateAmazonIdentityManagementServiceClient(this.credentials); WindowsAzureActiveDirectoryGroup group = resource as WindowsAzureActiveDirectoryGroup; if (group != null) { CreateGroupRequest request = new CreateGroupRequest(group.ExternalIdentifier); CreateGroupResult response = await proxy.CreateGroupAsync(request); group.Identifier = this.AnchoringBehavior.Identify(response.Group); if (group.Members != null && group.Members.Any()) { await this.AddMembers(group.ExternalIdentifier, group.Members, proxy, correlationIdentifier); } return group; } UserBase user = resource as UserBase; if (user != null) { CreateUserRequest request = new CreateUserRequest(user.ExternalIdentifier); CreateUserResult response = await proxy.CreateUserAsync(request); user.Identifier = this.AnchoringBehavior.Identify(response.User); return user; } string unsupportedSchema = string.Join( Environment.NewLine, resource.Schemas); throw new NotSupportedException(unsupportedSchema); } finally { if (proxy != null) { proxy.Dispose(); proxy = null; } } }
/// <summary> /// <para>Creates a new group.</para> <para>For information about the number of groups you can create, see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/index.html?LimitationsOnEntities.html">Limitations on IAM Entities</a> in <i>Using /// AWS Identity and Access Management</i> .</para> /// </summary> /// /// <param name="createGroupRequest">Container for the necessary parameters to execute the CreateGroup service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the CreateGroup service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreateGroupResponse> CreateGroupAsync(CreateGroupRequest createGroupRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateGroupRequest, CreateGroupResponse>(createGroupRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreateGroupResponse CreateGroup(CreateGroupRequest request) { var task = CreateGroupAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
IAsyncResult invokeCreateGroup(CreateGroupRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new CreateGroupRequestMarshaller(); var unmarshaller = CreateGroupResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }