/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListAliasesResponse response = new ListAliasesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Aliases", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <AliasConfiguration, AliasConfigurationUnmarshaller>(AliasConfigurationUnmarshaller.Instance);
                    response.Aliases = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextMarker", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextMarker = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public static ListAliasesResponse Unmarshall(UnmarshallerContext context)
        {
            ListAliasesResponse listAliasesResponse = new ListAliasesResponse();

            listAliasesResponse.HttpResponse = context.HttpResponse;
            listAliasesResponse.TotalCount   = context.IntegerValue("ListAliases.TotalCount");
            listAliasesResponse.PageNumber   = context.IntegerValue("ListAliases.PageNumber");
            listAliasesResponse.PageSize     = context.IntegerValue("ListAliases.PageSize");
            listAliasesResponse.RequestId    = context.StringValue("ListAliases.RequestId");

            List <ListAliasesResponse.ListAliases_Alias> listAliasesResponse_aliases = new List <ListAliasesResponse.ListAliases_Alias>();

            for (int i = 0; i < context.Length("ListAliases.Aliases.Length"); i++)
            {
                ListAliasesResponse.ListAliases_Alias alias = new ListAliasesResponse.ListAliases_Alias();
                alias.KeyId     = context.StringValue("ListAliases.Aliases[" + i + "].KeyId");
                alias.AliasName = context.StringValue("ListAliases.Aliases[" + i + "].AliasName");
                alias.AliasArn  = context.StringValue("ListAliases.Aliases[" + i + "].AliasArn");

                listAliasesResponse_aliases.Add(alias);
            }
            listAliasesResponse.Aliases = listAliasesResponse_aliases;

            return(listAliasesResponse);
        }
예제 #3
0
        public async Task <AliasListEntry[]> ListAliasesAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            ListAliasesResponse response = null;
            var results = new List <AliasListEntry>();

            while ((response = await _client.ListAliasesAsync(new ListAliasesRequest()
            {
                Marker = response?.NextMarker,
                Limit = 1000
            }, cancellationToken).EnsureSuccessAsync()) != null)
            {
                if (!response.Aliases.IsNullOrEmpty())
                {
                    results.AddRange(response.Aliases);
                }

                if (!response.Truncated)
                {
                    break;
                }

                await Task.Delay(100);
            }

            return(results.ToArray());
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonGameLiftConfig config = new AmazonGameLiftConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonGameLiftClient client = new AmazonGameLiftClient(creds, config);

            ListAliasesResponse resp = new ListAliasesResponse();

            do
            {
                ListAliasesRequest req = new ListAliasesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    Limit = maxItems
                };

                resp = client.ListAliases(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Aliases)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
예제 #5
0
        public static async Task Main()
        {
            var client   = new AmazonKeyManagementServiceClient();
            var request  = new ListAliasesRequest();
            var response = new ListAliasesResponse();

            do
            {
                response = await client.ListAliasesAsync(request);

                response.Aliases.ForEach(alias =>
                {
                    Console.WriteLine($"Created: {alias.CreationDate} Last Update: {alias.LastUpdatedDate} Name: {alias.AliasName}");
                });

                request.Marker = response.NextMarker;
            }while (response.Truncated);
        }