private Amazon.GameLift.Model.CreateFleetResponse CallAWSServiceOperation(IAmazonGameLift client, Amazon.GameLift.Model.CreateFleetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GameLift Service", "CreateFleet"); try { #if DESKTOP return(client.CreateFleet(request)); #elif CORECLR return(client.CreateFleetAsync(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.GameLift.Model.CreateFleetRequest(); if (cmdletContext.BuildId != null) { request.BuildId = cmdletContext.BuildId; } // populate CertificateConfiguration var requestCertificateConfigurationIsNull = true; request.CertificateConfiguration = new Amazon.GameLift.Model.CertificateConfiguration(); Amazon.GameLift.CertificateType requestCertificateConfiguration_certificateConfiguration_CertificateType = null; if (cmdletContext.CertificateConfiguration_CertificateType != null) { requestCertificateConfiguration_certificateConfiguration_CertificateType = cmdletContext.CertificateConfiguration_CertificateType; } if (requestCertificateConfiguration_certificateConfiguration_CertificateType != null) { request.CertificateConfiguration.CertificateType = requestCertificateConfiguration_certificateConfiguration_CertificateType; requestCertificateConfigurationIsNull = false; } // determine if request.CertificateConfiguration should be set to null if (requestCertificateConfigurationIsNull) { request.CertificateConfiguration = null; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.EC2InboundPermission != null) { request.EC2InboundPermissions = cmdletContext.EC2InboundPermission; } if (cmdletContext.EC2InstanceType != null) { request.EC2InstanceType = cmdletContext.EC2InstanceType; } if (cmdletContext.FleetType != null) { request.FleetType = cmdletContext.FleetType; } if (cmdletContext.InstanceRoleArn != null) { request.InstanceRoleArn = cmdletContext.InstanceRoleArn; } if (cmdletContext.LogPath != null) { request.LogPaths = cmdletContext.LogPath; } if (cmdletContext.MetricGroup != null) { request.MetricGroups = cmdletContext.MetricGroup; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.NewGameSessionProtectionPolicy != null) { request.NewGameSessionProtectionPolicy = cmdletContext.NewGameSessionProtectionPolicy; } if (cmdletContext.PeerVpcAwsAccountId != null) { request.PeerVpcAwsAccountId = cmdletContext.PeerVpcAwsAccountId; } if (cmdletContext.PeerVpcId != null) { request.PeerVpcId = cmdletContext.PeerVpcId; } // populate ResourceCreationLimitPolicy var requestResourceCreationLimitPolicyIsNull = true; request.ResourceCreationLimitPolicy = new Amazon.GameLift.Model.ResourceCreationLimitPolicy(); System.Int32?requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_NewGameSessionsPerCreator = null; if (cmdletContext.ResourceCreationLimitPolicy_NewGameSessionsPerCreator != null) { requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_NewGameSessionsPerCreator = cmdletContext.ResourceCreationLimitPolicy_NewGameSessionsPerCreator.Value; } if (requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_NewGameSessionsPerCreator != null) { request.ResourceCreationLimitPolicy.NewGameSessionsPerCreator = requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_NewGameSessionsPerCreator.Value; requestResourceCreationLimitPolicyIsNull = false; } System.Int32?requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_PolicyPeriodInMinute = null; if (cmdletContext.ResourceCreationLimitPolicy_PolicyPeriodInMinute != null) { requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_PolicyPeriodInMinute = cmdletContext.ResourceCreationLimitPolicy_PolicyPeriodInMinute.Value; } if (requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_PolicyPeriodInMinute != null) { request.ResourceCreationLimitPolicy.PolicyPeriodInMinutes = requestResourceCreationLimitPolicy_resourceCreationLimitPolicy_PolicyPeriodInMinute.Value; requestResourceCreationLimitPolicyIsNull = false; } // determine if request.ResourceCreationLimitPolicy should be set to null if (requestResourceCreationLimitPolicyIsNull) { request.ResourceCreationLimitPolicy = null; } // populate RuntimeConfiguration var requestRuntimeConfigurationIsNull = true; request.RuntimeConfiguration = new Amazon.GameLift.Model.RuntimeConfiguration(); System.Int32?requestRuntimeConfiguration_runtimeConfiguration_GameSessionActivationTimeoutSecond = null; if (cmdletContext.RuntimeConfiguration_GameSessionActivationTimeoutSecond != null) { requestRuntimeConfiguration_runtimeConfiguration_GameSessionActivationTimeoutSecond = cmdletContext.RuntimeConfiguration_GameSessionActivationTimeoutSecond.Value; } if (requestRuntimeConfiguration_runtimeConfiguration_GameSessionActivationTimeoutSecond != null) { request.RuntimeConfiguration.GameSessionActivationTimeoutSeconds = requestRuntimeConfiguration_runtimeConfiguration_GameSessionActivationTimeoutSecond.Value; requestRuntimeConfigurationIsNull = false; } System.Int32?requestRuntimeConfiguration_runtimeConfiguration_MaxConcurrentGameSessionActivation = null; if (cmdletContext.RuntimeConfiguration_MaxConcurrentGameSessionActivation != null) { requestRuntimeConfiguration_runtimeConfiguration_MaxConcurrentGameSessionActivation = cmdletContext.RuntimeConfiguration_MaxConcurrentGameSessionActivation.Value; } if (requestRuntimeConfiguration_runtimeConfiguration_MaxConcurrentGameSessionActivation != null) { request.RuntimeConfiguration.MaxConcurrentGameSessionActivations = requestRuntimeConfiguration_runtimeConfiguration_MaxConcurrentGameSessionActivation.Value; requestRuntimeConfigurationIsNull = false; } List <Amazon.GameLift.Model.ServerProcess> requestRuntimeConfiguration_runtimeConfiguration_ServerProcess = null; if (cmdletContext.RuntimeConfiguration_ServerProcess != null) { requestRuntimeConfiguration_runtimeConfiguration_ServerProcess = cmdletContext.RuntimeConfiguration_ServerProcess; } if (requestRuntimeConfiguration_runtimeConfiguration_ServerProcess != null) { request.RuntimeConfiguration.ServerProcesses = requestRuntimeConfiguration_runtimeConfiguration_ServerProcess; requestRuntimeConfigurationIsNull = false; } // determine if request.RuntimeConfiguration should be set to null if (requestRuntimeConfigurationIsNull) { request.RuntimeConfiguration = null; } if (cmdletContext.ScriptId != null) { request.ScriptId = cmdletContext.ScriptId; } if (cmdletContext.ServerLaunchParameter != null) { request.ServerLaunchParameters = cmdletContext.ServerLaunchParameter; } if (cmdletContext.ServerLaunchPath != null) { request.ServerLaunchPath = cmdletContext.ServerLaunchPath; } 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); }
/// <summary> /// Creates a new fleet to host game servers. A fleet consists of a set of Amazon Elastic /// Compute Cloud (Amazon EC2) instances of a certain type, which defines the CPU, memory, /// storage, and networking capacity of each host in the fleet. See <a href="https://aws.amazon.com/ec2/instance-types/">Amazon /// EC2 Instance Types</a> for more information. Each instance in the fleet hosts a game /// server created from the specified game build. Once a fleet is in an ACTIVE state, /// it can begin hosting game sessions. /// /// /// <para> /// To create a new fleet, provide a name and the EC2 instance type for the new fleet, /// and specify the build and server launch path. Builds must be in a READY state before /// they can be used to build fleets. When configuring the new fleet, you can optionally /// (1) provide a set of launch parameters to be passed to a game server when activated; /// (2) limit incoming traffic to a specified range of IP addresses and port numbers; /// and (3) configure Amazon GameLift to store game session logs by specifying the path /// to the logs stored in your game server files. If the call is successful, Amazon GameLift /// performs the following tasks: /// </para> /// <ul> <li>Creates a fleet record and sets the state to NEW.</li> <li>Sets the fleet's /// capacity to 1 "desired" and 1 "active" EC2 instance count.</li> <li>Creates an EC2 /// instance and begins the process of initializing the fleet and activating a game server /// on the instance.</li> <li>Begins writing events to the fleet event log, which can /// be accessed in the GameLift console.</li> </ul> /// <para> /// Once a fleet is created, use the following actions to change certain fleet properties /// (server launch parameters and log paths cannot be changed): /// </para> /// <ul> <li> <a>UpdateFleetAttributes</a> -- Update fleet metadata, including name and /// description.</li> <li> <a>UpdateFleetCapacity</a> -- Increase or decrease the number /// of instances you want the fleet to maintain.</li> <li> <a>UpdateFleetPortSettings</a> /// -- Change the IP addresses and ports that allow access to incoming traffic.</li> </ul> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateFleet service method.</param> /// /// <returns>The response from the CreateFleet service method, as returned by GameLift.</returns> /// <exception cref="Amazon.GameLift.Model.ConflictException"> /// The requested operation would cause a conflict with the current state of a service /// resource associated with the request. Please resolve the conflict before retrying /// this request. /// </exception> /// <exception cref="Amazon.GameLift.Model.InternalServiceException"> /// The service encountered an unrecoverable internal failure while processing the request. /// Such requests can be retried by clients, either immediately or after a back-off period. /// </exception> /// <exception cref="Amazon.GameLift.Model.InvalidRequestException"> /// One or more parameters specified as part of the request are invalid. Please correct /// the invalid parameters before retrying. /// </exception> /// <exception cref="Amazon.GameLift.Model.LimitExceededException"> /// The requested operation would cause the resource to exceed the allowed service limit. /// Please resolve the issue before retrying. /// </exception> /// <exception cref="Amazon.GameLift.Model.NotFoundException"> /// A service resource associated with the request could not be found. Such requests should /// not be retried by clients. /// </exception> /// <exception cref="Amazon.GameLift.Model.UnauthorizedException"> /// The client failed authentication. Such requests should not be retried without valid /// authentication credentials. /// </exception> public CreateFleetResponse CreateFleet(CreateFleetRequest request) { var marshaller = new CreateFleetRequestMarshaller(); var unmarshaller = CreateFleetResponseUnmarshaller.Instance; return Invoke<CreateFleetRequest,CreateFleetResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateFleet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateFleet operation on AmazonGameLiftClient.</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 EndCreateFleet /// operation.</returns> public IAsyncResult BeginCreateFleet(CreateFleetRequest request, AsyncCallback callback, object state) { var marshaller = new CreateFleetRequestMarshaller(); var unmarshaller = CreateFleetResponseUnmarshaller.Instance; return BeginInvoke<CreateFleetRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the CreateFleet operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateFleet 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<CreateFleetResponse> CreateFleetAsync(CreateFleetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateFleetRequestMarshaller(); var unmarshaller = CreateFleetResponseUnmarshaller.Instance; return InvokeAsync<CreateFleetRequest,CreateFleetResponse>(request, marshaller, unmarshaller, cancellationToken); }