public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.MigrationHubRefactorSpaces.Model.GetServiceRequest(); if (cmdletContext.ApplicationIdentifier != null) { request.ApplicationIdentifier = cmdletContext.ApplicationIdentifier; } if (cmdletContext.EnvironmentIdentifier != null) { request.EnvironmentIdentifier = cmdletContext.EnvironmentIdentifier; } if (cmdletContext.ServiceIdentifier != null) { request.ServiceIdentifier = cmdletContext.ServiceIdentifier; } 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); }
private Amazon.MigrationHubRefactorSpaces.Model.GetServiceResponse CallAWSServiceOperation(IAmazonMigrationHubRefactorSpaces client, Amazon.MigrationHubRefactorSpaces.Model.GetServiceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Migration Hub Refactor Spaces", "GetService"); try { #if DESKTOP return(client.GetService(request)); #elif CORECLR return(client.GetServiceAsync(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; } }