Container for the parameters to the CreateProduct operation. Creates a new product.
Inheritance: AmazonServiceCatalogRequest
Exemplo n.º 1
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateProduct operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateProduct operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<CreateProductResponse> CreateProductAsync(CreateProductRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateProductRequestMarshaller();
            var unmarshaller = CreateProductResponseUnmarshaller.Instance;

            return InvokeAsync<CreateProductRequest,CreateProductResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemplo n.º 2
0
        internal CreateProductResponse CreateProduct(CreateProductRequest request)
        {
            var marshaller = new CreateProductRequestMarshaller();
            var unmarshaller = CreateProductResponseUnmarshaller.Instance;

            return Invoke<CreateProductRequest,CreateProductResponse>(request, marshaller, unmarshaller);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ServiceCatalog.Model.CreateProductRequest();

            if (cmdletContext.AcceptLanguage != null)
            {
                request.AcceptLanguage = cmdletContext.AcceptLanguage;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Distributor != null)
            {
                request.Distributor = cmdletContext.Distributor;
            }
            if (cmdletContext.IdempotencyToken != null)
            {
                request.IdempotencyToken = cmdletContext.IdempotencyToken;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Owner != null)
            {
                request.Owner = cmdletContext.Owner;
            }
            if (cmdletContext.ProductType != null)
            {
                request.ProductType = cmdletContext.ProductType;
            }

            // populate ProvisioningArtifactParameters
            var requestProvisioningArtifactParametersIsNull = true;

            request.ProvisioningArtifactParameters = new Amazon.ServiceCatalog.Model.ProvisioningArtifactProperties();
            System.String requestProvisioningArtifactParameters_provisioningArtifactParameters_Description = null;
            if (cmdletContext.ProvisioningArtifactParameters_Description != null)
            {
                requestProvisioningArtifactParameters_provisioningArtifactParameters_Description = cmdletContext.ProvisioningArtifactParameters_Description;
            }
            if (requestProvisioningArtifactParameters_provisioningArtifactParameters_Description != null)
            {
                request.ProvisioningArtifactParameters.Description = requestProvisioningArtifactParameters_provisioningArtifactParameters_Description;
                requestProvisioningArtifactParametersIsNull        = false;
            }
            System.Boolean?requestProvisioningArtifactParameters_provisioningArtifactParameters_DisableTemplateValidation = null;
            if (cmdletContext.ProvisioningArtifactParameters_DisableTemplateValidation != null)
            {
                requestProvisioningArtifactParameters_provisioningArtifactParameters_DisableTemplateValidation = cmdletContext.ProvisioningArtifactParameters_DisableTemplateValidation.Value;
            }
            if (requestProvisioningArtifactParameters_provisioningArtifactParameters_DisableTemplateValidation != null)
            {
                request.ProvisioningArtifactParameters.DisableTemplateValidation = requestProvisioningArtifactParameters_provisioningArtifactParameters_DisableTemplateValidation.Value;
                requestProvisioningArtifactParametersIsNull = false;
            }
            Dictionary <System.String, System.String> requestProvisioningArtifactParameters_provisioningArtifactParameters_Info = null;

            if (cmdletContext.ProvisioningArtifactParameters_Info != null)
            {
                requestProvisioningArtifactParameters_provisioningArtifactParameters_Info = cmdletContext.ProvisioningArtifactParameters_Info;
            }
            if (requestProvisioningArtifactParameters_provisioningArtifactParameters_Info != null)
            {
                request.ProvisioningArtifactParameters.Info = requestProvisioningArtifactParameters_provisioningArtifactParameters_Info;
                requestProvisioningArtifactParametersIsNull = false;
            }
            System.String requestProvisioningArtifactParameters_provisioningArtifactParameters_Name = null;
            if (cmdletContext.ProvisioningArtifactParameters_Name != null)
            {
                requestProvisioningArtifactParameters_provisioningArtifactParameters_Name = cmdletContext.ProvisioningArtifactParameters_Name;
            }
            if (requestProvisioningArtifactParameters_provisioningArtifactParameters_Name != null)
            {
                request.ProvisioningArtifactParameters.Name = requestProvisioningArtifactParameters_provisioningArtifactParameters_Name;
                requestProvisioningArtifactParametersIsNull = false;
            }
            Amazon.ServiceCatalog.ProvisioningArtifactType requestProvisioningArtifactParameters_provisioningArtifactParameters_Type = null;
            if (cmdletContext.ProvisioningArtifactParameters_Type != null)
            {
                requestProvisioningArtifactParameters_provisioningArtifactParameters_Type = cmdletContext.ProvisioningArtifactParameters_Type;
            }
            if (requestProvisioningArtifactParameters_provisioningArtifactParameters_Type != null)
            {
                request.ProvisioningArtifactParameters.Type = requestProvisioningArtifactParameters_provisioningArtifactParameters_Type;
                requestProvisioningArtifactParametersIsNull = false;
            }
            // determine if request.ProvisioningArtifactParameters should be set to null
            if (requestProvisioningArtifactParametersIsNull)
            {
                request.ProvisioningArtifactParameters = null;
            }
            if (cmdletContext.SupportDescription != null)
            {
                request.SupportDescription = cmdletContext.SupportDescription;
            }
            if (cmdletContext.SupportEmail != null)
            {
                request.SupportEmail = cmdletContext.SupportEmail;
            }
            if (cmdletContext.SupportUrl != null)
            {
                request.SupportUrl = cmdletContext.SupportUrl;
            }
            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);
        }
 private Amazon.ServiceCatalog.Model.CreateProductResponse CallAWSServiceOperation(IAmazonServiceCatalog client, Amazon.ServiceCatalog.Model.CreateProductRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Service Catalog", "CreateProduct");
     try
     {
         #if DESKTOP
         return(client.CreateProduct(request));
         #elif CORECLR
         return(client.CreateProductAsync(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.º 5
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateProduct operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateProduct operation on AmazonServiceCatalogClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateProduct
        ///         operation.</returns>
        public IAsyncResult BeginCreateProduct(CreateProductRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateProductRequestMarshaller();
            var unmarshaller = CreateProductResponseUnmarshaller.Instance;

            return BeginInvoke<CreateProductRequest>(request, marshaller, unmarshaller,
                callback, state);
        }