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();
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListModelsRequest request;

            try
            {
                request = new ListModelsRequest
                {
                    CompartmentId  = CompartmentId,
                    Id             = Id,
                    ProjectId      = ProjectId,
                    DisplayName    = DisplayName,
                    LifecycleState = LifecycleState,
                    CreatedBy      = CreatedBy,
                    Limit          = Limit,
                    Page           = Page,
                    SortOrder      = SortOrder,
                    SortBy         = SortBy,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListModelsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        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));
        }
Exemple #4
0
        /// <summary>Snippet for ListModels</summary>
        public async Task ListModelsRequestObjectAsync()
        {
            // Snippet: ListModelsAsync(ListModelsRequest, CallSettings)
            // Create client
            AutoMlClient autoMlClient = await AutoMlClient.CreateAsync();

            // Initialize request argument(s)
            ListModelsRequest request = new ListModelsRequest
            {
                Parent = "",
                Filter = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListModelsResponse, Model> response = autoMlClient.ListModelsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Model item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListModelsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Model item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int          pageSize   = 10;
            Page <Model> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Model item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Exemple #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 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);
 }
Exemple #6
0
        /// <summary>
        /// ListModels接口的同步版本,用以列举已经部署的模型。而部署有两种模式:`无服务器模式` 和 `集群模式`。`无服务器模式` 下,模型文件被部署到无服务器云函数,即 [SCF](https://cloud.tencent.com/product/scf),用户可以在其控制台上进一步操作。`集群模式` 下,模型文件被部署到 TI-A 的计算集群中。不同部署模式下的模型分开列出。
        /// </summary>
        /// <param name="req">参考<see cref="ListModelsRequest"/></param>
        /// <returns>参考<see cref="ListModelsResponse"/>实例</returns>
        public ListModelsResponse ListModelsSync(ListModelsRequest req)
        {
            JsonResponseModel <ListModelsResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "ListModels");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <ListModelsResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListModels operation. This enumerable
 /// will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ListModelsResponse> ListModelsResponseEnumerator(ListModelsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListModelsRequest, ListModelsResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListModels(request, retryConfiguration, cancellationToken)
                ));
 }
Exemple #8
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);
        }
Exemple #9
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
            AutoMlClient autoMlClient = AutoMlClient.Create();
            // Initialize request argument(s)
            ListModelsRequest request = new ListModelsRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListModelsResponse, Model> response = autoMlClient.ListModels(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Model item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListModelsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Model item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int          pageSize   = 10;
            Page <Model> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Model item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
        }
        /// <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();
        }
Exemple #12
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListModelsRequest request;

            try
            {
                request = new ListModelsRequest
                {
                    CompartmentId  = CompartmentId,
                    Id             = Id,
                    ProjectId      = ProjectId,
                    DisplayName    = DisplayName,
                    LifecycleState = LifecycleState,
                    CreatedBy      = CreatedBy,
                    Limit          = Limit,
                    Page           = Page,
                    SortOrder      = SortOrder,
                    SortBy         = SortBy,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListModelsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemple #13
0
 partial void Modify_ListModelsRequest(ref ListModelsRequest request, ref gaxgrpc::CallSettings settings);
Exemple #14
0
 /// <summary>
 /// Lists all models in the specified dataset. Requires the READER dataset
 /// role.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual ListModelsResponse ListModels(ListModelsRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Exemple #15
0
 /// <summary>
 /// Lists all models in the specified dataset. Requires the READER dataset
 /// role.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <ListModelsResponse> ListModelsAsync(ListModelsRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Exemple #16
0
 /// <summary>
 /// Lists all models in the specified dataset. Requires the READER dataset
 /// role.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <ListModelsResponse> ListModelsAsync(ListModelsRequest request, st::CancellationToken cancellationToken) =>
 ListModelsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Exemple #17
0
 /// <summary>
 /// Lists all models in the specified dataset. Requires the READER dataset
 /// role.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override ListModelsResponse ListModels(ListModelsRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListModelsRequest(ref request, ref callSettings);
     return(_callListModels.Sync(request, callSettings));
 }
Exemple #18
0
 /// <summary>
 /// Lists all models in the specified dataset. Requires the READER dataset
 /// role.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <ListModelsResponse> ListModelsAsync(ListModelsRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_ListModelsRequest(ref request, ref callSettings);
     return(_callListModels.Async(request, callSettings));
 }