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

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

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

            return(response);
        }
Ejemplo n.º 2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonServiceDiscoveryConfig config = new AmazonServiceDiscoveryConfig();

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

            ListOperationsResponse resp = new ListOperationsResponse();

            do
            {
                ListOperationsRequest req = new ListOperationsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

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

                foreach (var obj in resp.Operations)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Ejemplo n.º 3
0
        private void ListOperationsSuccessEventHandler(ListOperationsResponse operationsResponse)
        {
            _resultText.text = "List Operations Success.\n";

            if (operationsResponse.operations != null)
            {
                _resultText.text += "Operations:\n";

                foreach (var item in operationsResponse.operations)
                {
                    _resultText.text += "name: " + item.name + "; done: " + item.done + "\n";
                }
            }
        }