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

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

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

            return(response);
        }
        public static ListModelsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListModelsResponse listModelsResponse = new ListModelsResponse();

            listModelsResponse.HttpResponse = _ctx.HttpResponse;
            listModelsResponse.RequestId    = _ctx.StringValue("ListModels.requestId");

            List <Dictionary <string, string> > listModelsResponse_result = new List <Dictionary <string, string> >();

            for (int i = 0; i < _ctx.Length("ListModels.Result.Length"); i++)
            {
                Dictionary <string, string> tmp = new Dictionary <string, string>()
                {
                };
                foreach (var _item in _ctx.ResponseDictionary)
                {
                    string prefix = "ListModels.Result[" + i + "].";
                    if (_item.Key.IndexOf(prefix) == 0)
                    {
                        tmp.Add(_item.Key.Substring(prefix.Length), _item.Value);
                    }
                }
                if (tmp.Count > 0)
                {
                    listModelsResponse_result.Add(tmp);
                }
            }
            listModelsResponse.Result = listModelsResponse_result;

            return(listModelsResponse);
        }
Пример #3
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonSageMakerConfig config = new AmazonSageMakerConfig();

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

            ListModelsResponse resp = new ListModelsResponse();

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

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

                foreach (var obj in resp.Models)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        public async stt::Task ListModelsAsync()
        {
            moq::Mock <ModelService.ModelServiceClient> mockGrpcClient = new moq::Mock <ModelService.ModelServiceClient>(moq::MockBehavior.Strict);
            ListModelsRequest request = new ListModelsRequest
            {
                ProjectId  = "project_id43ad98b0",
                DatasetId  = "dataset_id08d366d3",
                MaxResults = 2806814450U,
            };
            ListModelsResponse expectedResponse = new ListModelsResponse
            {
                Models        = { new Model(), },
                NextPageToken = "next_page_tokendbee0940",
            };

            mockGrpcClient.Setup(x => x.ListModelsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListModelsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ModelServiceClient client = new ModelServiceClientImpl(mockGrpcClient.Object, null);
            ListModelsResponse responseCallSettings = await client.ListModelsAsync(request.ProjectId, request.DatasetId, request.MaxResults, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ListModelsResponse responseCancellationToken = await client.ListModelsAsync(request.ProjectId, request.DatasetId, request.MaxResults, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #5
0
 /// <summary>Snippet for ListModels</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void ListModels()
 {
     // Create client
     ModelServiceClient modelServiceClient = ModelServiceClient.Create();
     // Initialize request argument(s)
     string projectId  = "";
     string datasetId  = "";
     uint?  maxResults = 0U;
     // Make the request
     ListModelsResponse response = modelServiceClient.ListModels(projectId, datasetId, maxResults);
 }
        /// <summary>Snippet for ListModelsAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ListModelsAsync()
        {
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            string projectId  = "";
            string datasetId  = "";
            uint?  maxResults = 0U;
            // Make the request
            ListModelsResponse response = await modelServiceClient.ListModelsAsync(projectId, datasetId, maxResults);
        }
Пример #7
0
        public static ListModelsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListModelsResponse listModelsResponse = new ListModelsResponse();

            listModelsResponse.HttpResponse = _ctx.HttpResponse;
            listModelsResponse.RequestId    = _ctx.StringValue("ListModels.RequestId");
            listModelsResponse.Data         = _ctx.StringValue("ListModels.Data");
            listModelsResponse.Code         = _ctx.IntegerValue("ListModels.Code");
            listModelsResponse.Message      = _ctx.StringValue("ListModels.Message");
            listModelsResponse.Success      = _ctx.BooleanValue("ListModels.Success");

            return(listModelsResponse);
        }
Пример #8
0
 /// <summary>Snippet for ListModels</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void ListModelsRequestObject()
 {
     // Create client
     ModelServiceClient modelServiceClient = ModelServiceClient.Create();
     // Initialize request argument(s)
     ListModelsRequest request = new ListModelsRequest
     {
         ProjectId  = "",
         DatasetId  = "",
         MaxResults = 0U,
         PageToken  = "",
     };
     // Make the request
     ListModelsResponse response = modelServiceClient.ListModels(request);
 }
        /// <summary>Snippet for ListModelsAsync</summary>
        public async Task ListModelsAsync()
        {
            // Snippet: ListModelsAsync(string, string, uint?, CallSettings)
            // Additional: ListModelsAsync(string, string, uint?, CancellationToken)
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            string projectId  = "";
            string datasetId  = "";
            uint?  maxResults = 0U;
            // Make the request
            ListModelsResponse response = await modelServiceClient.ListModelsAsync(projectId, datasetId, maxResults);

            // End snippet
        }
Пример #10
0
        /// <summary>Snippet for ListModelsAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ListModelsRequestObjectAsync()
        {
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListModelsRequest request = new ListModelsRequest
            {
                ProjectId  = "",
                DatasetId  = "",
                MaxResults = 0U,
                PageToken  = "",
            };
            // Make the request
            ListModelsResponse response = await modelServiceClient.ListModelsAsync(request);
        }
        /// <summary>Snippet for ListModelsAsync</summary>
        public async Task ListModelsRequestObjectAsync()
        {
            // Snippet: ListModelsAsync(ListModelsRequest, CallSettings)
            // Additional: ListModelsAsync(ListModelsRequest, CancellationToken)
            // Create client
            ModelServiceClient modelServiceClient = await ModelServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListModelsRequest request = new ListModelsRequest
            {
                ProjectId  = "",
                DatasetId  = "",
                MaxResults = 0U,
                PageToken  = "",
            };
            // Make the request
            ListModelsResponse response = await modelServiceClient.ListModelsAsync(request);

            // End snippet
        }
        public void ListModels()
        {
            moq::Mock <ModelService.ModelServiceClient> mockGrpcClient = new moq::Mock <ModelService.ModelServiceClient>(moq::MockBehavior.Strict);
            ListModelsRequest request = new ListModelsRequest
            {
                ProjectId  = "project_id43ad98b0",
                DatasetId  = "dataset_id08d366d3",
                MaxResults = 2806814450U,
            };
            ListModelsResponse expectedResponse = new ListModelsResponse
            {
                Models        = { new Model(), },
                NextPageToken = "next_page_tokendbee0940",
            };

            mockGrpcClient.Setup(x => x.ListModels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ModelServiceClient client   = new ModelServiceClientImpl(mockGrpcClient.Object, null);
            ListModelsResponse response = client.ListModels(request.ProjectId, request.DatasetId, request.MaxResults);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }