private Amazon.SageMaker.Model.CreateActionResponse CallAWSServiceOperation(IAmazonSageMaker client, Amazon.SageMaker.Model.CreateActionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon SageMaker Service", "CreateAction"); try { #if DESKTOP return(client.CreateAction(request)); #elif CORECLR return(client.CreateActionAsync(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.CreateActionRequest(); if (cmdletContext.ActionName != null) { request.ActionName = cmdletContext.ActionName; } if (cmdletContext.ActionType != null) { request.ActionType = cmdletContext.ActionType; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } // populate MetadataProperties var requestMetadataPropertiesIsNull = true; request.MetadataProperties = new Amazon.SageMaker.Model.MetadataProperties(); System.String requestMetadataProperties_metadataProperties_CommitId = null; if (cmdletContext.MetadataProperties_CommitId != null) { requestMetadataProperties_metadataProperties_CommitId = cmdletContext.MetadataProperties_CommitId; } if (requestMetadataProperties_metadataProperties_CommitId != null) { request.MetadataProperties.CommitId = requestMetadataProperties_metadataProperties_CommitId; requestMetadataPropertiesIsNull = false; } System.String requestMetadataProperties_metadataProperties_GeneratedBy = null; if (cmdletContext.MetadataProperties_GeneratedBy != null) { requestMetadataProperties_metadataProperties_GeneratedBy = cmdletContext.MetadataProperties_GeneratedBy; } if (requestMetadataProperties_metadataProperties_GeneratedBy != null) { request.MetadataProperties.GeneratedBy = requestMetadataProperties_metadataProperties_GeneratedBy; requestMetadataPropertiesIsNull = false; } System.String requestMetadataProperties_metadataProperties_ProjectId = null; if (cmdletContext.MetadataProperties_ProjectId != null) { requestMetadataProperties_metadataProperties_ProjectId = cmdletContext.MetadataProperties_ProjectId; } if (requestMetadataProperties_metadataProperties_ProjectId != null) { request.MetadataProperties.ProjectId = requestMetadataProperties_metadataProperties_ProjectId; requestMetadataPropertiesIsNull = false; } System.String requestMetadataProperties_metadataProperties_Repository = null; if (cmdletContext.MetadataProperties_Repository != null) { requestMetadataProperties_metadataProperties_Repository = cmdletContext.MetadataProperties_Repository; } if (requestMetadataProperties_metadataProperties_Repository != null) { request.MetadataProperties.Repository = requestMetadataProperties_metadataProperties_Repository; requestMetadataPropertiesIsNull = false; } // determine if request.MetadataProperties should be set to null if (requestMetadataPropertiesIsNull) { request.MetadataProperties = null; } if (cmdletContext.Property != null) { request.Properties = cmdletContext.Property; } // populate Source var requestSourceIsNull = true; request.Source = new Amazon.SageMaker.Model.ActionSource(); System.String requestSource_source_SourceId = null; if (cmdletContext.Source_SourceId != null) { requestSource_source_SourceId = cmdletContext.Source_SourceId; } if (requestSource_source_SourceId != null) { request.Source.SourceId = requestSource_source_SourceId; requestSourceIsNull = false; } System.String requestSource_source_SourceType = null; if (cmdletContext.Source_SourceType != null) { requestSource_source_SourceType = cmdletContext.Source_SourceType; } if (requestSource_source_SourceType != null) { request.Source.SourceType = requestSource_source_SourceType; requestSourceIsNull = false; } System.String requestSource_source_SourceUri = null; if (cmdletContext.Source_SourceUri != null) { requestSource_source_SourceUri = cmdletContext.Source_SourceUri; } if (requestSource_source_SourceUri != null) { request.Source.SourceUri = requestSource_source_SourceUri; requestSourceIsNull = false; } // determine if request.Source should be set to null if (requestSourceIsNull) { request.Source = null; } if (cmdletContext.Status != null) { request.Status = cmdletContext.Status; } 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); }