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

            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("variables", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Variable, VariableUnmarshaller>(VariableUnmarshaller.Instance);
                    response.Variables = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Beispiel #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonFraudDetectorConfig config = new AmazonFraudDetectorConfig();

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

            GetVariablesResponse resp = new GetVariablesResponse();

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

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

                foreach (var obj in resp.Variables)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Beispiel #3
0
        public override Task <GetVariablesResponse> GetVariables(GetVariablesRequest request,
                                                                 ServerCallContext context)
        {
            RemoteFrame        frame     = frameStore.GetObject(request.Frame.Id);
            List <RemoteValue> variables =
                frame.GetVariables(
                    request.Arguments, request.Locals, request.Statics, request.OnlyInScope);

            var response = new GetVariablesResponse();

            response.Variables.Add(
                variables.Select(s => GrpcFactoryUtils.CreateValue(
                                     s, valueStore.AddObject(s))).ToList());

            return(Task.FromResult(response));
        }
        public List <RemoteValue> GetVariables(bool arguments, bool locals, bool statics,
                                               bool onlyInScope)
        {
            var request = new GetVariablesRequest
            {
                Frame       = grpcSbFrame,
                Arguments   = arguments,
                Locals      = locals,
                Statics     = statics,
                OnlyInScope = onlyInScope
            };
            GetVariablesResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.GetVariables(request);
            }))
            {
                return(response.Variables.Select(s => valueFactory.Create(connection, s)).ToList());
            }
            return(new List <RemoteValue>());
        }