示例#1
0
 private Amazon.GlueDataBrew.Model.CreateProjectResponse CallAWSServiceOperation(IAmazonGlueDataBrew client, Amazon.GlueDataBrew.Model.CreateProjectRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Glue DataBrew", "CreateProject");
     try
     {
         #if DESKTOP
         return(client.CreateProject(request));
         #elif CORECLR
         return(client.CreateProjectAsync(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;
     }
 }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.GlueDataBrew.Model.CreateProjectRequest();

            if (cmdletContext.DatasetName != null)
            {
                request.DatasetName = cmdletContext.DatasetName;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.RecipeName != null)
            {
                request.RecipeName = cmdletContext.RecipeName;
            }
            if (cmdletContext.RoleArn != null)
            {
                request.RoleArn = cmdletContext.RoleArn;
            }

            // populate Sample
            var requestSampleIsNull = true;

            request.Sample = new Amazon.GlueDataBrew.Model.Sample();
            System.Int32?requestSample_sample_Size = null;
            if (cmdletContext.Sample_Size != null)
            {
                requestSample_sample_Size = cmdletContext.Sample_Size.Value;
            }
            if (requestSample_sample_Size != null)
            {
                request.Sample.Size = requestSample_sample_Size.Value;
                requestSampleIsNull = false;
            }
            Amazon.GlueDataBrew.SampleType requestSample_sample_Type = null;
            if (cmdletContext.Sample_Type != null)
            {
                requestSample_sample_Type = cmdletContext.Sample_Type;
            }
            if (requestSample_sample_Type != null)
            {
                request.Sample.Type = requestSample_sample_Type;
                requestSampleIsNull = false;
            }
            // determine if request.Sample should be set to null
            if (requestSampleIsNull)
            {
                request.Sample = null;
            }
            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);
        }