Container for the parameters to the DescribeAlias operation. Retrieves properties for a specified alias. To get the alias, specify an alias ID. If successful, an Alias object is returned.
Inheritance: AmazonGameLiftRequest
Ejemplo n.º 1
0
    public GameLiftClient(GameLift _gl)
    {
        gl       = _gl;
        playerId = Guid.NewGuid().ToString();
        Credentials.Install();
        CreateGameLiftClient();

        // Use command line alias if possible, otherwise use default (hard coded alias)
        string[] args = System.Environment.GetCommandLineArgs();
        for (int i = 0; i < args.Length - 1; i++)
        {
            if (args[i] != "--alias")
            {
                continue;
            }

            string pattern = @"alias-[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}";
            Match  m       = Regex.Match(args[i + 1], pattern);
            if (m.Success)
            {
                aliasId = m.Value;
                Debug.Log(":) ALIAS RECOGNIZED. Alias " + aliasId + " found on command line");
                break;
            }
        }

        // verify alias exists
        if (aglc != null)
        {
            try
            {
                var dareq = new Amazon.GameLift.Model.DescribeAliasRequest();
                dareq.AliasId = aliasId;
                Amazon.GameLift.Model.DescribeAliasResponse dares = aglc.DescribeAlias(dareq);
                Amazon.GameLift.Model.Alias alias = dares.Alias;
                Debug.Log((int)dares.HttpStatusCode + " ALIAS NAME: " + alias.Name + " (" + aliasId + ")");
                if (alias.RoutingStrategy.Type == Amazon.GameLift.RoutingStrategyType.TERMINAL)
                {
                    Debug.Log("             (TERMINAL ALIAS)");
                }
            }
            catch (Exception e)
            {
                Debug.Log("AWS Credentials found but probably invalid. Check IAM permissions for the credentials.");
                Debug.Log(e.Message);
            }
        }
    }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.GameLift.Model.DescribeAliasRequest();

            if (cmdletContext.AliasId != null)
            {
                request.AliasId = cmdletContext.AliasId;
            }

            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);
        }
Ejemplo n.º 3
0
 private Amazon.GameLift.Model.DescribeAliasResponse CallAWSServiceOperation(IAmazonGameLift client, Amazon.GameLift.Model.DescribeAliasRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GameLift Service", "DescribeAlias");
     try
     {
         #if DESKTOP
         return(client.DescribeAlias(request));
         #elif CORECLR
         return(client.DescribeAliasAsync(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;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAlias operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAlias 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 EndDescribeAlias
        ///         operation.</returns>
        public IAsyncResult BeginDescribeAlias(DescribeAliasRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeAliasRequestMarshaller();
            var unmarshaller = DescribeAliasResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeAliasRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Retrieves properties for a specified alias. To get the alias, specify an alias ID.
        /// If successful, an <a>Alias</a> object is returned.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeAlias service method.</param>
        /// 
        /// <returns>The response from the DescribeAlias service method, as returned by GameLift.</returns>
        /// <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.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 DescribeAliasResponse DescribeAlias(DescribeAliasRequest request)
        {
            var marshaller = new DescribeAliasRequestMarshaller();
            var unmarshaller = DescribeAliasResponseUnmarshaller.Instance;

            return Invoke<DescribeAliasRequest,DescribeAliasResponse>(request, marshaller, unmarshaller);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Retrieves properties for a specified alias. To get the alias, specify an alias ID.
 /// If successful, an <a>Alias</a> object is returned.
 /// </summary>
 /// <param name="aliasId">Unique identifier for a fleet alias. Specify the alias you want to retrieve. </param>
 /// 
 /// <returns>The response from the DescribeAlias service method, as returned by GameLift.</returns>
 /// <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.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 DescribeAliasResponse DescribeAlias(string aliasId)
 {
     var request = new DescribeAliasRequest();
     request.AliasId = aliasId;
     return DescribeAlias(request);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAlias operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAlias 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<DescribeAliasResponse> DescribeAliasAsync(DescribeAliasRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeAliasRequestMarshaller();
            var unmarshaller = DescribeAliasResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeAliasRequest,DescribeAliasResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Retrieves properties for a specified alias. To get the alias, specify an alias ID.
 /// If successful, an <a>Alias</a> object is returned.
 /// </summary>
 /// <param name="aliasId">Unique identifier for a fleet alias. Specify the alias you want to retrieve.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the DescribeAlias service method, as returned by GameLift.</returns>
 /// <exception cref="Amazon.GameLift.Model.InternalServiceException">
 /// The service encountered an unrecoverable internal failure while processing the request.
 /// Clients can retry such requests immediately or after a waiting period.
 /// </exception>
 /// <exception cref="Amazon.GameLift.Model.InvalidRequestException">
 /// One or more parameter values in the request are invalid. Correct the invalid parameter
 /// values before retrying.
 /// </exception>
 /// <exception cref="Amazon.GameLift.Model.NotFoundException">
 /// A service resource associated with the request could not be found. Clients should
 /// not retry such requests.
 /// </exception>
 /// <exception cref="Amazon.GameLift.Model.UnauthorizedException">
 /// The client failed authentication. Clients should not retry such requests.
 /// </exception>
 public Task<DescribeAliasResponse> DescribeAliasAsync(string aliasId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DescribeAliasRequest();
     request.AliasId = aliasId;
     return DescribeAliasAsync(request, cancellationToken);
 }
Ejemplo n.º 9
0
    public GameLiftClient(GameLift _gl)
    {
        gl       = _gl;
        playerId = Guid.NewGuid().ToString();
        Credentials.Install();

        // Use command line alias if possible, otherwise use default (hard coded alias)
        string[] args = System.Environment.GetCommandLineArgs();
        for (int i = 0; i < args.Length - 1; i++)
        {
            if (args[i] != "--alias")
            {
                //Debug.Log(":( Unrecognized command line parameter: " + args[i] + " (consider --alias <aliasId>)" + Environment.NewLine);
                continue;
            }

            string pattern = @"alias-[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}";
            Match  m       = Regex.Match(args[i + 1], pattern);
            if (m.Success)
            {
                aliasId = m.Value;
                Debug.Log(":) ALIAS RECOGNIZED. Alias " + aliasId + " found on command line");
                break;
            }
        }

        // verify alias exists
        var config = new AmazonGameLiftConfig();

        config.RegionEndpoint = Amazon.RegionEndpoint.USEast1;
        AmazonGameLiftClient aglc = null;
        AWSCredentials       credentials;

        var  chain        = new CredentialProfileStoreChain();
        bool profileFound = chain.TryGetAWSCredentials("demo-gamelift-unity", out credentials);

        if (profileFound)
        {
            Debug.Log("demo-gamelift-unity profile");
            aglc = new AmazonGameLiftClient(credentials, config);
        }
        else
        {
            Debug.Log("regular profile search");
            try
            {
                aglc = new AmazonGameLiftClient(config);
            }
            catch (AmazonServiceException e)
            {
                Debug.Log(e.Message);
                Debug.Log("AWS Credentials not found. Cannot connect to GameLift. Start application with -credentials <file> flag where credentials are the credentials.csv file containing the access and secret key.");
            }
        }
        if (aglc != null)
        {
            try
            {
                var dareq = new Amazon.GameLift.Model.DescribeAliasRequest();
                dareq.AliasId = aliasId;
                Amazon.GameLift.Model.DescribeAliasResponse dares = aglc.DescribeAlias(dareq);
                Amazon.GameLift.Model.Alias alias = dares.Alias;
                Debug.Log((int)dares.HttpStatusCode + " ALIAS NAME: " + alias.Name + " (" + aliasId + ")");
                if (alias.RoutingStrategy.Type == Amazon.GameLift.RoutingStrategyType.TERMINAL)
                {
                    Debug.Log("             (TERMINAL ALIAS)");
                }
            }
            catch (Exception e)
            {
                Debug.Log("AWS Credentials found but probably invalid. Check IAM permissions for the credentials.");
                Debug.Log(e.Message);
            }
            finally
            {
                aglc.Dispose();
            }
        }
    }