/// <summary> /// Initiates the asynchronous execution of the GetNode operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetNode operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-2018-09-24/GetNode">REST API Reference for GetNode Operation</seealso> public virtual Task <GetNodeResponse> GetNodeAsync(GetNodeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetNodeRequestMarshaller.Instance; options.ResponseUnmarshaller = GetNodeResponseUnmarshaller.Instance; return(InvokeAsync <GetNodeResponse>(request, options, cancellationToken)); }
internal virtual GetNodeResponse GetNode(GetNodeRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetNodeRequestMarshaller.Instance; options.ResponseUnmarshaller = GetNodeResponseUnmarshaller.Instance; return(Invoke <GetNodeResponse>(request, options)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns> /// <c>GetCategoryNodeResponse</c> with category node data. /// </returns> public GetNodeResponse Get(GetNodeRequest request) { // IEnumerable<NodeTranslationModel> translationsFuture = null; // if (request.Data.IncludeTranslations) // { // translationsFuture = // repository.AsQueryable<Module.Root.Models.CategoryNodeTranslation>() // .Where(t => t.Node.Id == request.NodeId && !t.IsDeleted) // .Select( // t => // new NodeTranslationModel // { // Id = t.Id, // Version = t.Version, // CreatedBy = t.CreatedByUser, // CreatedOn = t.CreatedOn, // LastModifiedBy = t.ModifiedByUser, // LastModifiedOn = t.ModifiedOn, // Title = t.Title, // Url = t.Url, // UsePageTitleAsNodeTitle = t.UsePageTitleAsNodeTitle, // Macro = t.Macro, // LanguageId = t.Language.Id // }) // .ToFuture(); // } var model = repository .AsQueryable<Module.Root.Models.Category>() .Where(node => node.CategoryTree.Id == request.CategoryTreeId && node.Id == request.NodeId && !node.IsDeleted) .Select(node => new NodeModel { Id = node.Id, Version = node.Version, CreatedBy = node.CreatedByUser, CreatedOn = node.CreatedOn, LastModifiedBy = node.ModifiedByUser, LastModifiedOn = node.ModifiedOn, CategoryTreeId = node.CategoryTree.Id, ParentId = node.ParentCategory != null && !node.ParentCategory.IsDeleted ? node.ParentCategory.Id : (Guid?)null, Name = node.Name, DisplayOrder = node.DisplayOrder, Macro = node.Macro, }) .ToFuture() .FirstOne(); var response = new GetNodeResponse { Data = model }; // if (request.Data.IncludeTranslations && translationsFuture != null) // { // response.Translations = translationsFuture.ToList(); // } return response; }
public async stt::Task GetNodeRequestObjectAsync() { moq::Mock <Tpu.TpuClient> mockGrpcClient = new moq::Mock <Tpu.TpuClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetNodeRequest request = new GetNodeRequest { NodeName = NodeName.FromProjectLocationNode("[PROJECT]", "[LOCATION]", "[NODE]"), }; Node expectedResponse = new Node { NodeName = NodeName.FromProjectLocationNode("[PROJECT]", "[LOCATION]", "[NODE]"), Description = "description2cf9da67", AcceleratorType = "accelerator_type68a25f42", #pragma warning disable CS0612 IpAddress = "ip_address46a72553", #pragma warning restore CS0612 State = Node.Types.State.Restarting, HealthDescription = "health_descriptionb522cddb", TensorflowVersion = "tensorflow_version878dc75b", Network = "networkd22ce091", CidrBlock = "cidr_block0fc04814", #pragma warning disable CS0612 Port = "portfb551590", #pragma warning restore CS0612 ServiceAccount = "service_accounta3c1b923", CreateTime = new wkt::Timestamp(), SchedulingConfig = new SchedulingConfig(), NetworkEndpoints = { new NetworkEndpoint(), }, Health = Node.Types.Health.UnhealthyMaintenance, Labels = { { "key8a0b6e3c", "value60c16320" }, }, UseServiceNetworking = true, ApiVersion = Node.Types.ApiVersion.V2Alpha1, Symptoms = { new Symptom(), }, }; mockGrpcClient.Setup(x => x.GetNodeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Node>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TpuClient client = new TpuClientImpl(mockGrpcClient.Object, null); Node responseCallSettings = await client.GetNodeAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Node responseCancellationToken = await client.GetNodeAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Gets the specified node. /// </summary> /// <param name="forestID">The forest ID of the node.</param> /// <param name="treeID">The tree ID of the node.</param> /// <param name="nodeID">The node's ID.</param> /// <returns>The node to get.</returns> private async Task <Node> GetNode(string forestID, string treeID, string nodeID) { var getNodeRequest = new GetNodeRequest { ForestId = forestID, TreeId = treeID, NodeId = nodeID, }; Console.WriteLine($"Getting node with ForestId={getNodeRequest.ForestId}, TreeId={getNodeRequest.TreeId}, NodeId={getNodeRequest.NodeId}..."); Node node = await this.orgClient.GetNodeAsync(getNodeRequest).ConfigureAwait(false); Console.Write($"Got node: "); this.PrintNode(node); Console.WriteLine(); return(node); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns> /// <c>GetSitemapNodeResponse</c> with sitemap node data. /// </returns> public GetNodeResponse Get(GetNodeRequest request) { IEnumerable<NodeTranslationModel> translationsFuture = null; if (request.Data.IncludeTranslations) { translationsFuture = repository.AsQueryable<Module.Pages.Models.SitemapNodeTranslation>() .Where(t => t.Node.Id == request.NodeId && !t.IsDeleted) .Select( t => new NodeTranslationModel { Id = t.Id, Version = t.Version, CreatedBy = t.CreatedByUser, CreatedOn = t.CreatedOn, LastModifiedBy = t.ModifiedByUser, LastModifiedOn = t.ModifiedOn, Title = t.Title, Url = t.Url, UsePageTitleAsNodeTitle = t.UsePageTitleAsNodeTitle, Macro = t.Macro, LanguageId = t.Language.Id }) .ToFuture(); } var model = repository .AsQueryable<SitemapNode>() .Where(node => node.Sitemap.Id == request.SitemapId && node.Id == request.NodeId && !node.IsDeleted) .Select(node => new NodeModel { Id = node.Id, Version = node.Version, CreatedBy = node.CreatedByUser, CreatedOn = node.CreatedOn, LastModifiedBy = node.ModifiedByUser, LastModifiedOn = node.ModifiedOn, SitemapId = node.Sitemap.Id, ParentId = node.ParentNode != null && !node.ParentNode.IsDeleted ? node.ParentNode.Id : (Guid?)null, PageId = node.Page != null && !node.Page.IsDeleted ? node.Page.Id : (Guid?)null, PageIsPublished = node.Page != null && !node.Page.IsDeleted && node.Page.Status == PageStatus.Published, PageLanguageId = node.Page != null && !node.Page.IsDeleted && node.Page.Language != null ? node.Page.Language.Id : (Guid?)null, Title = node.Page != null && node.UsePageTitleAsNodeTitle ? node.Page.Title : node.Title, Url = node.Page != null ? node.Page.PageUrl : node.Url, DisplayOrder = node.DisplayOrder, Macro = node.Macro, NodeTitle = node.Title, NodeUrl = node.Url, UsePageTitleAsNodeTitle = node.UsePageTitleAsNodeTitle, }) .ToFuture() .FirstOne(); var response = new GetNodeResponse { Data = model }; if (request.Data.IncludeTranslations && translationsFuture != null) { response.Translations = translationsFuture.ToList(); } return response; }