Exemplo n.º 1
0
 private Amazon.Glue.Model.PutSchemaVersionMetadataResponse CallAWSServiceOperation(IAmazonGlue client, Amazon.Glue.Model.PutSchemaVersionMetadataRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Glue", "PutSchemaVersionMetadata");
     try
     {
         #if DESKTOP
         return(client.PutSchemaVersionMetadata(request));
         #elif CORECLR
         return(client.PutSchemaVersionMetadataAsync(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;
     }
 }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Glue.Model.PutSchemaVersionMetadataRequest();


            // populate MetadataKeyValue
            var requestMetadataKeyValueIsNull = true;

            request.MetadataKeyValue = new Amazon.Glue.Model.MetadataKeyValuePair();
            System.String requestMetadataKeyValue_metadataKeyValue_MetadataKey = null;
            if (cmdletContext.MetadataKeyValue_MetadataKey != null)
            {
                requestMetadataKeyValue_metadataKeyValue_MetadataKey = cmdletContext.MetadataKeyValue_MetadataKey;
            }
            if (requestMetadataKeyValue_metadataKeyValue_MetadataKey != null)
            {
                request.MetadataKeyValue.MetadataKey = requestMetadataKeyValue_metadataKeyValue_MetadataKey;
                requestMetadataKeyValueIsNull        = false;
            }
            System.String requestMetadataKeyValue_metadataKeyValue_MetadataValue = null;
            if (cmdletContext.MetadataKeyValue_MetadataValue != null)
            {
                requestMetadataKeyValue_metadataKeyValue_MetadataValue = cmdletContext.MetadataKeyValue_MetadataValue;
            }
            if (requestMetadataKeyValue_metadataKeyValue_MetadataValue != null)
            {
                request.MetadataKeyValue.MetadataValue = requestMetadataKeyValue_metadataKeyValue_MetadataValue;
                requestMetadataKeyValueIsNull          = false;
            }
            // determine if request.MetadataKeyValue should be set to null
            if (requestMetadataKeyValueIsNull)
            {
                request.MetadataKeyValue = null;
            }

            // populate SchemaId
            var requestSchemaIdIsNull = true;

            request.SchemaId = new Amazon.Glue.Model.SchemaId();
            System.String requestSchemaId_schemaId_RegistryName = null;
            if (cmdletContext.SchemaId_RegistryName != null)
            {
                requestSchemaId_schemaId_RegistryName = cmdletContext.SchemaId_RegistryName;
            }
            if (requestSchemaId_schemaId_RegistryName != null)
            {
                request.SchemaId.RegistryName = requestSchemaId_schemaId_RegistryName;
                requestSchemaIdIsNull         = false;
            }
            System.String requestSchemaId_schemaId_SchemaArn = null;
            if (cmdletContext.SchemaId_SchemaArn != null)
            {
                requestSchemaId_schemaId_SchemaArn = cmdletContext.SchemaId_SchemaArn;
            }
            if (requestSchemaId_schemaId_SchemaArn != null)
            {
                request.SchemaId.SchemaArn = requestSchemaId_schemaId_SchemaArn;
                requestSchemaIdIsNull      = false;
            }
            System.String requestSchemaId_schemaId_SchemaName = null;
            if (cmdletContext.SchemaId_SchemaName != null)
            {
                requestSchemaId_schemaId_SchemaName = cmdletContext.SchemaId_SchemaName;
            }
            if (requestSchemaId_schemaId_SchemaName != null)
            {
                request.SchemaId.SchemaName = requestSchemaId_schemaId_SchemaName;
                requestSchemaIdIsNull       = false;
            }
            // determine if request.SchemaId should be set to null
            if (requestSchemaIdIsNull)
            {
                request.SchemaId = null;
            }
            if (cmdletContext.SchemaVersionId != null)
            {
                request.SchemaVersionId = cmdletContext.SchemaVersionId;
            }

            // populate SchemaVersionNumber
            var requestSchemaVersionNumberIsNull = true;

            request.SchemaVersionNumber = new Amazon.Glue.Model.SchemaVersionNumber();
            System.Boolean?requestSchemaVersionNumber_schemaVersionNumber_LatestVersion = null;
            if (cmdletContext.SchemaVersionNumber_LatestVersion != null)
            {
                requestSchemaVersionNumber_schemaVersionNumber_LatestVersion = cmdletContext.SchemaVersionNumber_LatestVersion.Value;
            }
            if (requestSchemaVersionNumber_schemaVersionNumber_LatestVersion != null)
            {
                request.SchemaVersionNumber.LatestVersion = requestSchemaVersionNumber_schemaVersionNumber_LatestVersion.Value;
                requestSchemaVersionNumberIsNull          = false;
            }
            System.Int64?requestSchemaVersionNumber_schemaVersionNumber_VersionNumber = null;
            if (cmdletContext.SchemaVersionNumber_VersionNumber != null)
            {
                requestSchemaVersionNumber_schemaVersionNumber_VersionNumber = cmdletContext.SchemaVersionNumber_VersionNumber.Value;
            }
            if (requestSchemaVersionNumber_schemaVersionNumber_VersionNumber != null)
            {
                request.SchemaVersionNumber.VersionNumber = requestSchemaVersionNumber_schemaVersionNumber_VersionNumber.Value;
                requestSchemaVersionNumberIsNull          = false;
            }
            // determine if request.SchemaVersionNumber should be set to null
            if (requestSchemaVersionNumberIsNull)
            {
                request.SchemaVersionNumber = null;
            }

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