/// <summary>Snippet for PatchAsync</summary> public async Task PatchAsync() { // Snippet: PatchAsync(string, string, PublicDelegatedPrefix, CallSettings) // Additional: PatchAsync(string, string, PublicDelegatedPrefix, CancellationToken) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = await GlobalPublicDelegatedPrefixesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string publicDelegatedPrefix = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request lro::Operation <Operation, Operation> response = await globalPublicDelegatedPrefixesClient.PatchAsync(project, publicDelegatedPrefix, publicDelegatedPrefixResource); // Poll until the returned long-running operation is complete lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation <Operation, Operation> retrievedResponse = await globalPublicDelegatedPrefixesClient.PollOncePatchAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } // End snippet }
public void Get() { moq::Mock <GlobalPublicDelegatedPrefixes.GlobalPublicDelegatedPrefixesClient> mockGrpcClient = new moq::Mock <GlobalPublicDelegatedPrefixes.GlobalPublicDelegatedPrefixesClient>(moq::MockBehavior.Strict); GetGlobalPublicDelegatedPrefixeRequest request = new GetGlobalPublicDelegatedPrefixeRequest { PublicDelegatedPrefix = "public_delegated_prefixff04d704", Project = "projectaa6ff846", }; PublicDelegatedPrefix expectedResponse = new PublicDelegatedPrefix { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", ParentPrefix = "parent_prefix33eed533", CreationTimestamp = "creation_timestamp235e59a1", IpCidrRange = "ip_cidr_range745a04d3", Region = "regionedb20d96", Status = PublicDelegatedPrefix.Types.Status.Deleting, PublicDelegatedSubPrefixs = { new PublicDelegatedPrefixPublicDelegatedSubPrefix(), }, Fingerprint = "fingerprint009e6052", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", IsLiveMigration = true, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GlobalPublicDelegatedPrefixesClient client = new GlobalPublicDelegatedPrefixesClientImpl(mockGrpcClient.Object, null); PublicDelegatedPrefix response = client.Get(request.Project, request.PublicDelegatedPrefix); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, PublicDelegatedPrefix, CallSettings) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = GlobalPublicDelegatedPrefixesClient.Create(); // Initialize request argument(s) string project = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request lro::Operation <Operation, Operation> response = globalPublicDelegatedPrefixesClient.Insert(project, publicDelegatedPrefixResource); // Poll until the returned long-running operation is complete lro::Operation <Operation, Operation> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation <Operation, Operation> retrievedResponse = globalPublicDelegatedPrefixesClient.PollOnceInsert(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for Get</summary> public void Get() { // Snippet: Get(string, string, CallSettings) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = GlobalPublicDelegatedPrefixesClient.Create(); // Initialize request argument(s) string project = ""; string publicDelegatedPrefix = ""; // Make the request PublicDelegatedPrefix response = globalPublicDelegatedPrefixesClient.Get(project, publicDelegatedPrefix); // End snippet }
/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, PublicDelegatedPrefix, CallSettings) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = GlobalPublicDelegatedPrefixesClient.Create(); // Initialize request argument(s) string project = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request Operation response = globalPublicDelegatedPrefixesClient.Insert(project, publicDelegatedPrefixResource); // End snippet }
/// <summary>Snippet for Patch</summary> public void Patch() { // Snippet: Patch(string, string, string, PublicDelegatedPrefix, CallSettings) // Create client PublicDelegatedPrefixesClient publicDelegatedPrefixesClient = PublicDelegatedPrefixesClient.Create(); // Initialize request argument(s) string project = ""; string region = ""; string publicDelegatedPrefix = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request Operation response = publicDelegatedPrefixesClient.Patch(project, region, publicDelegatedPrefix, publicDelegatedPrefixResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, CallSettings) // Additional: GetAsync(string, string, CancellationToken) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = await GlobalPublicDelegatedPrefixesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string publicDelegatedPrefix = ""; // Make the request PublicDelegatedPrefix response = await globalPublicDelegatedPrefixesClient.GetAsync(project, publicDelegatedPrefix); // End snippet }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetGlobalPublicDelegatedPrefixeRequest, CallSettings) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = GlobalPublicDelegatedPrefixesClient.Create(); // Initialize request argument(s) GetGlobalPublicDelegatedPrefixeRequest request = new GetGlobalPublicDelegatedPrefixeRequest { PublicDelegatedPrefix = "", Project = "", }; // Make the request PublicDelegatedPrefix response = globalPublicDelegatedPrefixesClient.Get(request); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, PublicDelegatedPrefix, CallSettings) // Additional: InsertAsync(string, PublicDelegatedPrefix, CancellationToken) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = await GlobalPublicDelegatedPrefixesClient.CreateAsync(); // Initialize request argument(s) string project = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request Operation response = await globalPublicDelegatedPrefixesClient.InsertAsync(project, publicDelegatedPrefixResource); // End snippet }
/// <summary>Snippet for PatchAsync</summary> public async Task PatchAsync() { // Snippet: PatchAsync(string, string, string, PublicDelegatedPrefix, CallSettings) // Additional: PatchAsync(string, string, string, PublicDelegatedPrefix, CancellationToken) // Create client PublicDelegatedPrefixesClient publicDelegatedPrefixesClient = await PublicDelegatedPrefixesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; string publicDelegatedPrefix = ""; PublicDelegatedPrefix publicDelegatedPrefixResource = new PublicDelegatedPrefix(); // Make the request Operation response = await publicDelegatedPrefixesClient.PatchAsync(project, region, publicDelegatedPrefix, publicDelegatedPrefixResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetGlobalPublicDelegatedPrefixeRequest, CallSettings) // Additional: GetAsync(GetGlobalPublicDelegatedPrefixeRequest, CancellationToken) // Create client GlobalPublicDelegatedPrefixesClient globalPublicDelegatedPrefixesClient = await GlobalPublicDelegatedPrefixesClient.CreateAsync(); // Initialize request argument(s) GetGlobalPublicDelegatedPrefixeRequest request = new GetGlobalPublicDelegatedPrefixeRequest { PublicDelegatedPrefix = "", Project = "", }; // Make the request PublicDelegatedPrefix response = await globalPublicDelegatedPrefixesClient.GetAsync(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <PublicDelegatedPrefixes.PublicDelegatedPrefixesClient> mockGrpcClient = new moq::Mock <PublicDelegatedPrefixes.PublicDelegatedPrefixesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetPublicDelegatedPrefixeRequest request = new GetPublicDelegatedPrefixeRequest { Region = "regionedb20d96", PublicDelegatedPrefix = "public_delegated_prefixff04d704", Project = "projectaa6ff846", }; PublicDelegatedPrefix expectedResponse = new PublicDelegatedPrefix { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", ParentPrefix = "parent_prefix33eed533", CreationTimestamp = "creation_timestamp235e59a1", IpCidrRange = "ip_cidr_range745a04d3", Region = "regionedb20d96", Status = PublicDelegatedPrefix.Types.Status.ReadyToAnnounce, PublicDelegatedSubPrefixs = { new PublicDelegatedPrefixPublicDelegatedSubPrefix(), }, Fingerprint = "fingerprint009e6052", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", IsLiveMigration = true, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <PublicDelegatedPrefix>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PublicDelegatedPrefixesClient client = new PublicDelegatedPrefixesClientImpl(mockGrpcClient.Object, null); PublicDelegatedPrefix responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); PublicDelegatedPrefix responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }