Ejemplo n.º 1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonServerMigrationServiceConfig config = new AmazonServerMigrationServiceConfig();

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

            GetConnectorsResponse resp = new GetConnectorsResponse();

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

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

                foreach (var obj in resp.ConnectorList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetConnectorsResponse response = new GetConnectorsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("connectorList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Connector, ConnectorUnmarshaller>(ConnectorUnmarshaller.Instance);
                    response.ConnectorList = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Ejemplo n.º 3
0
        public static GetConnectorsResult ToDto(this GetConnectorsResponse resp)
        {
            if (resp == null)
            {
                throw new ArgumentNullException(nameof(resp));
            }

            return(new GetConnectorsResult
            {
                Connectors = resp.Connectors,
                TemplateConnectors = resp.TemplateConnectors
            });
        }
Ejemplo n.º 4
0
 public void SMSGetConnectors()
 {
     GetConnectorsResponse getConnectorResponse = Client.GetConnectors(new GetConnectorsRequest());
 }