Beispiel #1
0
 private Amazon.SageMaker.Model.CreateDeviceFleetResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateDeviceFleetRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateDeviceFleet");
     try
     {
         #if DESKTOP
         return(client.CreateDeviceFleet(request));
         #elif CORECLR
         return(client.CreateDeviceFleetAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SageMaker.Model.CreateDeviceFleetRequest();

            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.DeviceFleetName != null)
            {
                request.DeviceFleetName = cmdletContext.DeviceFleetName;
            }
            if (cmdletContext.EnableIotRoleAlias != null)
            {
                request.EnableIotRoleAlias = cmdletContext.EnableIotRoleAlias.Value;
            }

            // populate OutputConfig
            var requestOutputConfigIsNull = true;

            request.OutputConfig = new Amazon.SageMaker.Model.EdgeOutputConfig();
            System.String requestOutputConfig_outputConfig_KmsKeyId = null;
            if (cmdletContext.OutputConfig_KmsKeyId != null)
            {
                requestOutputConfig_outputConfig_KmsKeyId = cmdletContext.OutputConfig_KmsKeyId;
            }
            if (requestOutputConfig_outputConfig_KmsKeyId != null)
            {
                request.OutputConfig.KmsKeyId = requestOutputConfig_outputConfig_KmsKeyId;
                requestOutputConfigIsNull     = false;
            }
            System.String requestOutputConfig_outputConfig_PresetDeploymentConfig = null;
            if (cmdletContext.OutputConfig_PresetDeploymentConfig != null)
            {
                requestOutputConfig_outputConfig_PresetDeploymentConfig = cmdletContext.OutputConfig_PresetDeploymentConfig;
            }
            if (requestOutputConfig_outputConfig_PresetDeploymentConfig != null)
            {
                request.OutputConfig.PresetDeploymentConfig = requestOutputConfig_outputConfig_PresetDeploymentConfig;
                requestOutputConfigIsNull = false;
            }
            Amazon.SageMaker.EdgePresetDeploymentType requestOutputConfig_outputConfig_PresetDeploymentType = null;
            if (cmdletContext.OutputConfig_PresetDeploymentType != null)
            {
                requestOutputConfig_outputConfig_PresetDeploymentType = cmdletContext.OutputConfig_PresetDeploymentType;
            }
            if (requestOutputConfig_outputConfig_PresetDeploymentType != null)
            {
                request.OutputConfig.PresetDeploymentType = requestOutputConfig_outputConfig_PresetDeploymentType;
                requestOutputConfigIsNull = false;
            }
            System.String requestOutputConfig_outputConfig_S3OutputLocation = null;
            if (cmdletContext.OutputConfig_S3OutputLocation != null)
            {
                requestOutputConfig_outputConfig_S3OutputLocation = cmdletContext.OutputConfig_S3OutputLocation;
            }
            if (requestOutputConfig_outputConfig_S3OutputLocation != null)
            {
                request.OutputConfig.S3OutputLocation = requestOutputConfig_outputConfig_S3OutputLocation;
                requestOutputConfigIsNull             = false;
            }
            // determine if request.OutputConfig should be set to null
            if (requestOutputConfigIsNull)
            {
                request.OutputConfig = null;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }