/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranchResourceNames() { // Snippet: GetDefaultBranch(CatalogName, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) CatalogName catalog = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranch() { // Snippet: GetDefaultBranch(string, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) string catalog = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranchAsync</summary> public async Task GetDefaultBranchResourceNamesAsync() { // Snippet: GetDefaultBranchAsync(CatalogName, CallSettings) // Additional: GetDefaultBranchAsync(CatalogName, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) CatalogName catalog = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"); // Make the request GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranchAsync</summary> public async Task GetDefaultBranchAsync() { // Snippet: GetDefaultBranchAsync(string, CallSettings) // Additional: GetDefaultBranchAsync(string, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) string catalog = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]"; // Make the request GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(catalog); // End snippet }
/// <summary>Snippet for GetDefaultBranch</summary> public void GetDefaultBranchRequestObject() { // Snippet: GetDefaultBranch(GetDefaultBranchRequest, CallSettings) // Create client CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create(); // Initialize request argument(s) GetDefaultBranchRequest request = new GetDefaultBranchRequest { CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), }; // Make the request GetDefaultBranchResponse response = catalogServiceClient.GetDefaultBranch(request); // End snippet }
/// <summary>Snippet for GetDefaultBranchAsync</summary> public async Task GetDefaultBranchRequestObjectAsync() { // Snippet: GetDefaultBranchAsync(GetDefaultBranchRequest, CallSettings) // Additional: GetDefaultBranchAsync(GetDefaultBranchRequest, CancellationToken) // Create client CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync(); // Initialize request argument(s) GetDefaultBranchRequest request = new GetDefaultBranchRequest { CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), }; // Make the request GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(request); // End snippet }
public void GetDefaultBranchResourceNames() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); GetDefaultBranchRequest request = new GetDefaultBranchRequest { CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), }; GetDefaultBranchResponse expectedResponse = new GetDefaultBranchResponse { BranchAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"), SetTime = new wkt::Timestamp(), Note = "noteca53d6aa", }; mockGrpcClient.Setup(x => x.GetDefaultBranch(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); GetDefaultBranchResponse response = client.GetDefaultBranch(request.CatalogAsCatalogName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetDefaultBranchResourceNamesAsync() { moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict); GetDefaultBranchRequest request = new GetDefaultBranchRequest { CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"), }; GetDefaultBranchResponse expectedResponse = new GetDefaultBranchResponse { BranchAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"), SetTime = new wkt::Timestamp(), Note = "noteca53d6aa", }; mockGrpcClient.Setup(x => x.GetDefaultBranchAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GetDefaultBranchResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null); GetDefaultBranchResponse responseCallSettings = await client.GetDefaultBranchAsync(request.CatalogAsCatalogName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); GetDefaultBranchResponse responseCancellationToken = await client.GetDefaultBranchAsync(request.CatalogAsCatalogName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }