private Amazon.SageMaker.Model.CreateAppResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateAppRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateApp"); try { #if DESKTOP return(client.CreateApp(request)); #elif CORECLR return(client.CreateAppAsync(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.SageMaker.Model.CreateAppRequest(); if (cmdletContext.AppName != null) { request.AppName = cmdletContext.AppName; } if (cmdletContext.AppType != null) { request.AppType = cmdletContext.AppType; } if (cmdletContext.DomainId != null) { request.DomainId = cmdletContext.DomainId; } // populate ResourceSpec var requestResourceSpecIsNull = true; request.ResourceSpec = new Amazon.SageMaker.Model.ResourceSpec(); Amazon.SageMaker.AppInstanceType requestResourceSpec_resourceSpec_InstanceType = null; if (cmdletContext.ResourceSpec_InstanceType != null) { requestResourceSpec_resourceSpec_InstanceType = cmdletContext.ResourceSpec_InstanceType; } if (requestResourceSpec_resourceSpec_InstanceType != null) { request.ResourceSpec.InstanceType = requestResourceSpec_resourceSpec_InstanceType; requestResourceSpecIsNull = false; } System.String requestResourceSpec_resourceSpec_SageMakerImageArn = null; if (cmdletContext.ResourceSpec_SageMakerImageArn != null) { requestResourceSpec_resourceSpec_SageMakerImageArn = cmdletContext.ResourceSpec_SageMakerImageArn; } if (requestResourceSpec_resourceSpec_SageMakerImageArn != null) { request.ResourceSpec.SageMakerImageArn = requestResourceSpec_resourceSpec_SageMakerImageArn; requestResourceSpecIsNull = false; } // determine if request.ResourceSpec should be set to null if (requestResourceSpecIsNull) { request.ResourceSpec = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.UserProfileName != null) { request.UserProfileName = cmdletContext.UserProfileName; } 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); }