private Amazon.AppStream.Model.UpdateFleetResponse CallAWSServiceOperation(IAmazonAppStream client, Amazon.AppStream.Model.UpdateFleetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon AppStream", "UpdateFleet"); try { #if DESKTOP return(client.UpdateFleet(request)); #elif CORECLR return(client.UpdateFleetAsync(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.AppStream.Model.UpdateFleetRequest(); if (cmdletContext.AttributesToDelete != null) { request.AttributesToDelete = cmdletContext.AttributesToDelete; } // populate ComputeCapacity var requestComputeCapacityIsNull = true; request.ComputeCapacity = new Amazon.AppStream.Model.ComputeCapacity(); System.Int32?requestComputeCapacity_computeCapacity_DesiredInstance = null; if (cmdletContext.ComputeCapacity_DesiredInstance != null) { requestComputeCapacity_computeCapacity_DesiredInstance = cmdletContext.ComputeCapacity_DesiredInstance.Value; } if (requestComputeCapacity_computeCapacity_DesiredInstance != null) { request.ComputeCapacity.DesiredInstances = requestComputeCapacity_computeCapacity_DesiredInstance.Value; requestComputeCapacityIsNull = false; } // determine if request.ComputeCapacity should be set to null if (requestComputeCapacityIsNull) { request.ComputeCapacity = null; } #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.DeleteVpcConfig != null) { request.DeleteVpcConfig = cmdletContext.DeleteVpcConfig.Value; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DisconnectTimeoutInSecond != null) { request.DisconnectTimeoutInSeconds = cmdletContext.DisconnectTimeoutInSecond.Value; } if (cmdletContext.DisplayName != null) { request.DisplayName = cmdletContext.DisplayName; } // populate DomainJoinInfo var requestDomainJoinInfoIsNull = true; request.DomainJoinInfo = new Amazon.AppStream.Model.DomainJoinInfo(); System.String requestDomainJoinInfo_domainJoinInfo_DirectoryName = null; if (cmdletContext.DomainJoinInfo_DirectoryName != null) { requestDomainJoinInfo_domainJoinInfo_DirectoryName = cmdletContext.DomainJoinInfo_DirectoryName; } if (requestDomainJoinInfo_domainJoinInfo_DirectoryName != null) { request.DomainJoinInfo.DirectoryName = requestDomainJoinInfo_domainJoinInfo_DirectoryName; requestDomainJoinInfoIsNull = false; } System.String requestDomainJoinInfo_domainJoinInfo_OrganizationalUnitDistinguishedName = null; if (cmdletContext.DomainJoinInfo_OrganizationalUnitDistinguishedName != null) { requestDomainJoinInfo_domainJoinInfo_OrganizationalUnitDistinguishedName = cmdletContext.DomainJoinInfo_OrganizationalUnitDistinguishedName; } if (requestDomainJoinInfo_domainJoinInfo_OrganizationalUnitDistinguishedName != null) { request.DomainJoinInfo.OrganizationalUnitDistinguishedName = requestDomainJoinInfo_domainJoinInfo_OrganizationalUnitDistinguishedName; requestDomainJoinInfoIsNull = false; } // determine if request.DomainJoinInfo should be set to null if (requestDomainJoinInfoIsNull) { request.DomainJoinInfo = null; } if (cmdletContext.EnableDefaultInternetAccess != null) { request.EnableDefaultInternetAccess = cmdletContext.EnableDefaultInternetAccess.Value; } if (cmdletContext.IamRoleArn != null) { request.IamRoleArn = cmdletContext.IamRoleArn; } if (cmdletContext.IdleDisconnectTimeoutInSecond != null) { request.IdleDisconnectTimeoutInSeconds = cmdletContext.IdleDisconnectTimeoutInSecond.Value; } if (cmdletContext.ImageArn != null) { request.ImageArn = cmdletContext.ImageArn; } if (cmdletContext.ImageName != null) { request.ImageName = cmdletContext.ImageName; } if (cmdletContext.InstanceType != null) { request.InstanceType = cmdletContext.InstanceType; } if (cmdletContext.MaxUserDurationInSecond != null) { request.MaxUserDurationInSeconds = cmdletContext.MaxUserDurationInSecond.Value; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.StreamView != null) { request.StreamView = cmdletContext.StreamView; } // populate VpcConfig var requestVpcConfigIsNull = true; request.VpcConfig = new Amazon.AppStream.Model.VpcConfig(); List <System.String> requestVpcConfig_vpcConfig_SecurityGroupId = null; if (cmdletContext.VpcConfig_SecurityGroupId != null) { requestVpcConfig_vpcConfig_SecurityGroupId = cmdletContext.VpcConfig_SecurityGroupId; } if (requestVpcConfig_vpcConfig_SecurityGroupId != null) { request.VpcConfig.SecurityGroupIds = requestVpcConfig_vpcConfig_SecurityGroupId; requestVpcConfigIsNull = false; } List <System.String> requestVpcConfig_vpcConfig_SubnetId = null; if (cmdletContext.VpcConfig_SubnetId != null) { requestVpcConfig_vpcConfig_SubnetId = cmdletContext.VpcConfig_SubnetId; } if (requestVpcConfig_vpcConfig_SubnetId != null) { request.VpcConfig.SubnetIds = requestVpcConfig_vpcConfig_SubnetId; requestVpcConfigIsNull = false; } // determine if request.VpcConfig should be set to null if (requestVpcConfigIsNull) { request.VpcConfig = null; } 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> /// Updates an existing fleet. All the attributes except the fleet name can be updated /// in the INACTIVE state. Only ComputeResourceCapacity and imageName can be updated in /// any other state. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateFleet service method.</param> /// /// <returns>The response from the UpdateFleet service method, as returned by AppStream.</returns> /// <exception cref="Amazon.AppStream.Model.InvalidRoleException"> /// The specified role is invalid. /// </exception> /// <exception cref="Amazon.AppStream.Model.LimitExceededException"> /// The requested limit exceeds the permitted limit for an account. /// </exception> /// <exception cref="Amazon.AppStream.Model.ResourceInUseException"> /// The specified resource is in use. /// </exception> /// <exception cref="Amazon.AppStream.Model.ResourceNotFoundException"> /// The specified resource was not found. /// </exception> public UpdateFleetResponse UpdateFleet(UpdateFleetRequest request) { var marshaller = new UpdateFleetRequestMarshaller(); var unmarshaller = UpdateFleetResponseUnmarshaller.Instance; return Invoke<UpdateFleetRequest,UpdateFleetResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the UpdateFleet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateFleet 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<UpdateFleetResponse> UpdateFleetAsync(UpdateFleetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateFleetRequestMarshaller(); var unmarshaller = UpdateFleetResponseUnmarshaller.Instance; return InvokeAsync<UpdateFleetRequest,UpdateFleetResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the UpdateFleet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateFleet operation on AmazonAppStreamClient.</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 EndUpdateFleet /// operation.</returns> public IAsyncResult BeginUpdateFleet(UpdateFleetRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateFleetRequestMarshaller(); var unmarshaller = UpdateFleetResponseUnmarshaller.Instance; return BeginInvoke<UpdateFleetRequest>(request, marshaller, unmarshaller, callback, state); }