public static ListCertificatesResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListCertificatesResponse listCertificatesResponse = new ListCertificatesResponse();

            listCertificatesResponse.HttpResponse = _ctx.HttpResponse;
            listCertificatesResponse.RequestId    = _ctx.StringValue("ListCertificates.RequestId");
            listCertificatesResponse.TotalSize    = _ctx.IntegerValue("ListCertificates.TotalSize");
            listCertificatesResponse.PageNumber   = _ctx.IntegerValue("ListCertificates.PageNumber");
            listCertificatesResponse.PageSize     = _ctx.IntegerValue("ListCertificates.PageSize");

            List <ListCertificatesResponse.ListCertificates_CertificateSummary> listCertificatesResponse_certificateSummaryList = new List <ListCertificatesResponse.ListCertificates_CertificateSummary>();

            for (int i = 0; i < _ctx.Length("ListCertificates.CertificateSummaryList.Length"); i++)
            {
                ListCertificatesResponse.ListCertificates_CertificateSummary certificateSummary = new ListCertificatesResponse.ListCertificates_CertificateSummary();
                certificateSummary.CertificateId   = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].CertificateId");
                certificateSummary.Subject         = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].Subject");
                certificateSummary.Issuer          = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].Issuer");
                certificateSummary.KeySpec         = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].KeySpec");
                certificateSummary.ProtectionLevel = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].ProtectionLevel");
                certificateSummary.NotBefore       = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].NotBefore");
                certificateSummary.NotAfter        = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].NotAfter");
                certificateSummary.Status          = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].Status");

                listCertificatesResponse_certificateSummaryList.Add(certificateSummary);
            }
            listCertificatesResponse.CertificateSummaryList = listCertificatesResponse_certificateSummaryList;

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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("CertificateSummaryList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <CertificateSummary, CertificateSummaryUnmarshaller>(CertificateSummaryUnmarshaller.Instance);
                    response.CertificateSummaryList = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #3
0
        public static ListCertificatesResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListCertificatesResponse listCertificatesResponse = new ListCertificatesResponse();

            listCertificatesResponse.HttpResponse = _ctx.HttpResponse;
            listCertificatesResponse.RequestId    = _ctx.StringValue("ListCertificates.RequestId");
            listCertificatesResponse.TotalSize    = _ctx.IntegerValue("ListCertificates.TotalSize");
            listCertificatesResponse.PageNumber   = _ctx.IntegerValue("ListCertificates.PageNumber");
            listCertificatesResponse.PageSize     = _ctx.IntegerValue("ListCertificates.PageSize");

            List <ListCertificatesResponse.ListCertificates_CertificateSummary> listCertificatesResponse_certificateSummaryList = new List <ListCertificatesResponse.ListCertificates_CertificateSummary>();

            for (int i = 0; i < _ctx.Length("ListCertificates.CertificateSummaryList.Length"); i++)
            {
                ListCertificatesResponse.ListCertificates_CertificateSummary certificateSummary = new ListCertificatesResponse.ListCertificates_CertificateSummary();
                certificateSummary.CertificateId = _ctx.StringValue("ListCertificates.CertificateSummaryList[" + i + "].CertificateId");

                listCertificatesResponse_certificateSummaryList.Add(certificateSummary);
            }
            listCertificatesResponse.CertificateSummaryList = listCertificatesResponse_certificateSummaryList;

            List <ListCertificatesResponse.ListCertificates_Certificate> listCertificatesResponse_certificates = new List <ListCertificatesResponse.ListCertificates_Certificate>();

            for (int i = 0; i < _ctx.Length("ListCertificates.Certificates.Length"); i++)
            {
                ListCertificatesResponse.ListCertificates_Certificate certificate = new ListCertificatesResponse.ListCertificates_Certificate();
                certificate.CertificateId = _ctx.StringValue("ListCertificates.Certificates[" + i + "].CertificateId");

                listCertificatesResponse_certificates.Add(certificate);
            }
            listCertificatesResponse.Certificates = listCertificatesResponse_certificates;

            return(listCertificatesResponse);
        }
Пример #4
0
        public async Task <CertificateSummary[]> ListCertificatesAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            ListCertificatesResponse response = null;
            var results = new List <CertificateSummary>();

            while ((response = await _client.ListCertificatesAsync(new ListCertificatesRequest()
            {
                NextToken = response?.NextToken,
                MaxItems = 1000
            }, cancellationToken).EnsureSuccessAsync()) != null)
            {
                if (!response.CertificateSummaryList.IsNullOrEmpty())
                {
                    results.AddRange(response.CertificateSummaryList);
                }

                if (response.NextToken.IsNullOrEmpty())
                {
                    break;
                }

                await Task.Delay(100);
            }

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

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

            ListCertificatesResponse resp = new ListCertificatesResponse();

            do
            {
                ListCertificatesRequest req = new ListCertificatesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxItems = maxItems
                };

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

                foreach (var obj in resp.CertificateSummaryList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }