internal CreateLayerResponse CreateLayer(CreateLayerRequest request) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.Instance; return Invoke<CreateLayerRequest,CreateLayerResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateLayer operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLayer 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<CreateLayerResponse> CreateLayerAsync(CreateLayerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.Instance; return InvokeAsync<CreateLayerRequest,CreateLayerResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal CreateLayerResponse CreateLayer(CreateLayerRequest request) { var task = CreateLayerAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para>Creates a layer. For more information, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-create.html">How to Create a Layer</a> .</para> /// <para><b>NOTE:</b>You should use CreateLayer for noncustom layer types such as PHP App Server only if the stack does not have an existing /// layer of that type. A stack can have at most one instance of each noncustom layer; if you attempt to create a second instance, CreateLayer /// fails. A stack can have an arbitrary number of custom layers, so you can call CreateLayer as many times as you like for that layer /// type.</para> <para> <b>Required Permissions</b> : To use this action, an IAM user must have a Manage permissions level for the stack, or an /// attached policy that explicitly grants permissions. For more information on user permissions, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing User Permissions</a> .</para> /// </summary> /// /// <param name="createLayerRequest">Container for the necessary parameters to execute the CreateLayer service method on AmazonOpsWorks.</param> /// /// <returns>The response from the CreateLayer service method, as returned by AmazonOpsWorks.</returns> /// /// <exception cref="T:Amazon.OpsWorks.Model.ResourceNotFoundException" /> /// <exception cref="T:Amazon.OpsWorks.Model.ValidationException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreateLayerResponse> CreateLayerAsync(CreateLayerRequest createLayerRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateLayerRequest, CreateLayerResponse>(createLayerRequest, marshaller, unmarshaller, signer, cancellationToken); }
IAsyncResult invokeCreateLayer(CreateLayerRequest createLayerRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateLayerRequestMarshaller().Marshall(createLayerRequest); var unmarshaller = CreateLayerResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateLayer operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLayer operation on AmazonOpsWorksClient.</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 EndCreateLayer /// operation.</returns> public IAsyncResult BeginCreateLayer(CreateLayerRequest request, AsyncCallback callback, object state) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.Instance; return BeginInvoke<CreateLayerRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Creates a layer. For more information, see <a /// href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-create.html" >How to Create a Layer</a> .</para> /// <para><b>NOTE:</b>You should use CreateLayer for noncustom layer types such as PHP App Server only if the stack does not have an existing /// layer of that type. A stack can have at most one instance of each noncustom layer; if you attempt to create a second instance, CreateLayer /// fails. A stack can have an arbitrary number of custom layers, so you can call CreateLayer as many times as you like for that layer /// type.</para> <para> <b>Required Permissions</b> : To use this action, an IAM user must have a Manage permissions level for the stack, or an /// attached policy that explicitly grants permissions. For more information on user permissions, see <a /// href="http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html" >Managing User Permissions</a> .</para> /// </summary> /// /// <param name="createLayerRequest">Container for the necessary parameters to execute the CreateLayer service method on AmazonOpsWorks.</param> /// /// <returns>The response from the CreateLayer service method, as returned by AmazonOpsWorks.</returns> /// /// <exception cref="ResourceNotFoundException"/> /// <exception cref="ValidationException"/> public CreateLayerResponse CreateLayer(CreateLayerRequest createLayerRequest) { IAsyncResult asyncResult = invokeCreateLayer(createLayerRequest, null, null, true); return EndCreateLayer(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateLayer operation. /// <seealso cref="Amazon.OpsWorks.IAmazonOpsWorks.CreateLayer"/> /// </summary> /// /// <param name="createLayerRequest">Container for the necessary parameters to execute the CreateLayer operation on AmazonOpsWorks.</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 EndCreateLayer /// operation.</returns> public IAsyncResult BeginCreateLayer(CreateLayerRequest createLayerRequest, AsyncCallback callback, object state) { return invokeCreateLayer(createLayerRequest, callback, state, false); }
IAsyncResult invokeCreateLayer(CreateLayerRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the CreateLayer operation. /// <seealso cref="Amazon.OpsWorks.IAmazonOpsWorks.CreateLayer"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLayer 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 async Task<CreateLayerResponse> CreateLayerAsync(CreateLayerRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateLayerRequestMarshaller(); var unmarshaller = CreateLayerResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateLayerRequest, CreateLayerResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Creates a layer. For more information, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-basics-create.html">How to Create a Layer</a> .</para> /// <para><b>NOTE:</b>You should use CreateLayer for noncustom layer types such as PHP App Server only if the stack does not have an existing /// layer of that type. A stack can have at most one instance of each noncustom layer; if you attempt to create a second instance, CreateLayer /// fails. A stack can have an arbitrary number of custom layers, so you can call CreateLayer as many times as you like for that layer /// type.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateLayer service method on AmazonOpsWorks.</param> /// /// <returns>The response from the CreateLayer service method, as returned by AmazonOpsWorks.</returns> /// /// <exception cref="T:Amazon.OpsWorks.Model.ResourceNotFoundException" /> /// <exception cref="T:Amazon.OpsWorks.Model.ValidationException" /> public CreateLayerResponse CreateLayer(CreateLayerRequest request) { var task = CreateLayerAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.OpsWorks.Model.CreateLayerResponse CallAWSServiceOperation(IAmazonOpsWorks client, Amazon.OpsWorks.Model.CreateLayerRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS OpsWorks", "CreateLayer"); try { #if DESKTOP return(client.CreateLayer(request)); #elif CORECLR return(client.CreateLayerAsync(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.OpsWorks.Model.CreateLayerRequest(); if (cmdletContext.Attribute != null) { request.Attributes = cmdletContext.Attribute; } if (cmdletContext.AutoAssignElasticIp != null) { request.AutoAssignElasticIps = cmdletContext.AutoAssignElasticIp.Value; } if (cmdletContext.AutoAssignPublicIp != null) { request.AutoAssignPublicIps = cmdletContext.AutoAssignPublicIp.Value; } // populate CloudWatchLogsConfiguration var requestCloudWatchLogsConfigurationIsNull = true; request.CloudWatchLogsConfiguration = new Amazon.OpsWorks.Model.CloudWatchLogsConfiguration(); System.Boolean?requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_Enabled = null; if (cmdletContext.CloudWatchLogsConfiguration_Enabled != null) { requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_Enabled = cmdletContext.CloudWatchLogsConfiguration_Enabled.Value; } if (requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_Enabled != null) { request.CloudWatchLogsConfiguration.Enabled = requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_Enabled.Value; requestCloudWatchLogsConfigurationIsNull = false; } List <Amazon.OpsWorks.Model.CloudWatchLogsLogStream> requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_LogStream = null; if (cmdletContext.CloudWatchLogsConfiguration_LogStream != null) { requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_LogStream = cmdletContext.CloudWatchLogsConfiguration_LogStream; } if (requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_LogStream != null) { request.CloudWatchLogsConfiguration.LogStreams = requestCloudWatchLogsConfiguration_cloudWatchLogsConfiguration_LogStream; requestCloudWatchLogsConfigurationIsNull = false; } // determine if request.CloudWatchLogsConfiguration should be set to null if (requestCloudWatchLogsConfigurationIsNull) { request.CloudWatchLogsConfiguration = null; } if (cmdletContext.CustomInstanceProfileArn != null) { request.CustomInstanceProfileArn = cmdletContext.CustomInstanceProfileArn; } if (cmdletContext.CustomJson != null) { request.CustomJson = cmdletContext.CustomJson; } // populate CustomRecipes var requestCustomRecipesIsNull = true; request.CustomRecipes = new Amazon.OpsWorks.Model.Recipes(); List <System.String> requestCustomRecipes_customRecipes_Configure = null; if (cmdletContext.CustomRecipes_Configure != null) { requestCustomRecipes_customRecipes_Configure = cmdletContext.CustomRecipes_Configure; } if (requestCustomRecipes_customRecipes_Configure != null) { request.CustomRecipes.Configure = requestCustomRecipes_customRecipes_Configure; requestCustomRecipesIsNull = false; } List <System.String> requestCustomRecipes_customRecipes_Deploy = null; if (cmdletContext.CustomRecipes_Deploy != null) { requestCustomRecipes_customRecipes_Deploy = cmdletContext.CustomRecipes_Deploy; } if (requestCustomRecipes_customRecipes_Deploy != null) { request.CustomRecipes.Deploy = requestCustomRecipes_customRecipes_Deploy; requestCustomRecipesIsNull = false; } List <System.String> requestCustomRecipes_customRecipes_Setup = null; if (cmdletContext.CustomRecipes_Setup != null) { requestCustomRecipes_customRecipes_Setup = cmdletContext.CustomRecipes_Setup; } if (requestCustomRecipes_customRecipes_Setup != null) { request.CustomRecipes.Setup = requestCustomRecipes_customRecipes_Setup; requestCustomRecipesIsNull = false; } List <System.String> requestCustomRecipes_customRecipes_Shutdown = null; if (cmdletContext.CustomRecipes_Shutdown != null) { requestCustomRecipes_customRecipes_Shutdown = cmdletContext.CustomRecipes_Shutdown; } if (requestCustomRecipes_customRecipes_Shutdown != null) { request.CustomRecipes.Shutdown = requestCustomRecipes_customRecipes_Shutdown; requestCustomRecipesIsNull = false; } List <System.String> requestCustomRecipes_customRecipes_Undeploy = null; if (cmdletContext.CustomRecipes_Undeploy != null) { requestCustomRecipes_customRecipes_Undeploy = cmdletContext.CustomRecipes_Undeploy; } if (requestCustomRecipes_customRecipes_Undeploy != null) { request.CustomRecipes.Undeploy = requestCustomRecipes_customRecipes_Undeploy; requestCustomRecipesIsNull = false; } // determine if request.CustomRecipes should be set to null if (requestCustomRecipesIsNull) { request.CustomRecipes = null; } if (cmdletContext.CustomSecurityGroupId != null) { request.CustomSecurityGroupIds = cmdletContext.CustomSecurityGroupId; } if (cmdletContext.EnableAutoHealing != null) { request.EnableAutoHealing = cmdletContext.EnableAutoHealing.Value; } if (cmdletContext.InstallUpdatesOnBoot != null) { request.InstallUpdatesOnBoot = cmdletContext.InstallUpdatesOnBoot.Value; } // populate LifecycleEventConfiguration var requestLifecycleEventConfigurationIsNull = true; request.LifecycleEventConfiguration = new Amazon.OpsWorks.Model.LifecycleEventConfiguration(); Amazon.OpsWorks.Model.ShutdownEventConfiguration requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown = null; // populate Shutdown var requestLifecycleEventConfiguration_lifecycleEventConfiguration_ShutdownIsNull = true; requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown = new Amazon.OpsWorks.Model.ShutdownEventConfiguration(); System.Boolean?requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_DelayUntilElbConnectionsDrained = null; if (cmdletContext.Shutdown_DelayUntilElbConnectionsDrained != null) { requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_DelayUntilElbConnectionsDrained = cmdletContext.Shutdown_DelayUntilElbConnectionsDrained.Value; } if (requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_DelayUntilElbConnectionsDrained != null) { requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown.DelayUntilElbConnectionsDrained = requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_DelayUntilElbConnectionsDrained.Value; requestLifecycleEventConfiguration_lifecycleEventConfiguration_ShutdownIsNull = false; } System.Int32?requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_ExecutionTimeout = null; if (cmdletContext.Shutdown_ExecutionTimeout != null) { requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_ExecutionTimeout = cmdletContext.Shutdown_ExecutionTimeout.Value; } if (requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_ExecutionTimeout != null) { requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown.ExecutionTimeout = requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown_shutdown_ExecutionTimeout.Value; requestLifecycleEventConfiguration_lifecycleEventConfiguration_ShutdownIsNull = false; } // determine if requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown should be set to null if (requestLifecycleEventConfiguration_lifecycleEventConfiguration_ShutdownIsNull) { requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown = null; } if (requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown != null) { request.LifecycleEventConfiguration.Shutdown = requestLifecycleEventConfiguration_lifecycleEventConfiguration_Shutdown; requestLifecycleEventConfigurationIsNull = false; } // determine if request.LifecycleEventConfiguration should be set to null if (requestLifecycleEventConfigurationIsNull) { request.LifecycleEventConfiguration = null; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.Package != null) { request.Packages = cmdletContext.Package; } if (cmdletContext.Shortname != null) { request.Shortname = cmdletContext.Shortname; } if (cmdletContext.StackId != null) { request.StackId = cmdletContext.StackId; } if (cmdletContext.Type != null) { request.Type = cmdletContext.Type; } if (cmdletContext.UseEbsOptimizedInstance != null) { request.UseEbsOptimizedInstances = cmdletContext.UseEbsOptimizedInstance.Value; } if (cmdletContext.VolumeConfiguration != null) { request.VolumeConfigurations = cmdletContext.VolumeConfiguration; } 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); }