Beispiel #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)
        {
            AddInstanceGroupsResponse response = new AddInstanceGroupsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("InstanceGroupIds", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.InstanceGroupIds = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("JobFlowId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.JobFlowId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        /// <summary>
        /// <para>AddInstanceGroups adds an instance group to a running
        /// cluster.</para>
        /// </summary>
        ///
        /// <param name="addInstanceGroupsRequest">Container for the necessary
        ///           parameters to execute the AddInstanceGroups service method on
        ///           AmazonElasticMapReduce.</param>
        ///
        /// <returns>The response from the AddInstanceGroups service method, as
        ///         returned by AmazonElasticMapReduce.</returns>
        ///
        /// <exception cref="InternalServerErrorException"/>
        public AddInstanceGroupsResponse AddInstanceGroups(AddInstanceGroupsRequest addInstanceGroupsRequest)
        {
            IRequest <AddInstanceGroupsRequest> request  = new AddInstanceGroupsRequestMarshaller().Marshall(addInstanceGroupsRequest);
            AddInstanceGroupsResponse           response = Invoke <AddInstanceGroupsRequest, AddInstanceGroupsResponse> (request, this.signer, AddInstanceGroupsResponseUnmarshaller.GetInstance());

            return(response);
        }
Beispiel #3
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            AddInstanceGroupsResponse response = new AddInstanceGroupsResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
Beispiel #4
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, AddInstanceGroupsResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("JobFlowId", targetDepth))
                {
                    context.Read();
                    response.JobFlowId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("InstanceGroupIds", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        response.InstanceGroupIds = null;
                        continue;
                    }
                    response.InstanceGroupIds = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.InstanceGroupIds.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            AddInstanceGroupsResponse response = new AddInstanceGroupsResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("AddInstanceGroupsResult", 2))
                    {
                        response.AddInstanceGroupsResult = AddInstanceGroupsResultUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }