示例#1
0
        /// <summary>Snippet for AnalyzeIamPolicyLongrunningAsync</summary>
        public async Task AnalyzeIamPolicyLongrunningRequestObjectAsync()
        {
            // Snippet: AnalyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest, CallSettings)
            // Additional: AnalyzeIamPolicyLongrunningAsync(AnalyzeIamPolicyLongrunningRequest, CancellationToken)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AnalyzeIamPolicyLongrunningRequest request = new AnalyzeIamPolicyLongrunningRequest
            {
                AnalysisQuery = new IamPolicyAnalysisQuery(),
                OutputConfig  = new IamPolicyAnalysisOutputConfig(),
            };
            // Make the request
            Operation <AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningRequest> response = await assetServiceClient.AnalyzeIamPolicyLongrunningAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningRequest> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            AnalyzeIamPolicyLongrunningResponse 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
            Operation <AnalyzeIamPolicyLongrunningResponse, AnalyzeIamPolicyLongrunningRequest> retrievedResponse = await assetServiceClient.PollOnceAnalyzeIamPolicyLongrunningAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                AnalyzeIamPolicyLongrunningResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
示例#2
0
        /// <summary>Snippet for ExportAssetsAsync</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 ExportAssetsRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            ExportAssetsRequest request = new ExportAssetsRequest
            {
                ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
                ReadTime             = new Timestamp(),
                AssetTypes           = { "", },
                ContentType          = ContentType.Unspecified,
                OutputConfig         = new OutputConfig(),
            };
            // Make the request
            Operation <ExportAssetsResponse, ExportAssetsRequest> response = await assetServiceClient.ExportAssetsAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <ExportAssetsResponse, ExportAssetsRequest> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ExportAssetsResponse 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
            Operation <ExportAssetsResponse, ExportAssetsRequest> retrievedResponse = await assetServiceClient.PollOnceExportAssetsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportAssetsResponse retrievedResult = retrievedResponse.Result;
            }
        }
示例#3
0
        /// <summary>Snippet for ExportIamPolicyAnalysisAsync</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 ExportIamPolicyAnalysisRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            ExportIamPolicyAnalysisRequest request = new ExportIamPolicyAnalysisRequest
            {
                AnalysisQuery = new IamPolicyAnalysisQuery(),
                Options       = new ExportIamPolicyAnalysisRequest.Types.Options(),
                OutputConfig  = new IamPolicyAnalysisOutputConfig(),
            };
            // Make the request
            Operation <ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> response = await assetServiceClient.ExportIamPolicyAnalysisAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ExportIamPolicyAnalysisResponse 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
            Operation <ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> retrievedResponse = await assetServiceClient.PollOnceExportIamPolicyAnalysisAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportIamPolicyAnalysisResponse retrievedResult = retrievedResponse.Result;
            }
        }
示例#4
0
        /// <summary>Snippet for DeleteFeedAsync</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 DeleteFeedResourceNamesAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            FeedName name = FeedName.FromProjectFeed("[PROJECT]", "[FEED]");
            // Make the request
            await assetServiceClient.DeleteFeedAsync(name);
        }
        /// <summary>Snippet for GetFeedAsync</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 GetFeedAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/feeds/[FEED]";
            // Make the request
            Feed response = await assetServiceClient.GetFeedAsync(name);
        }
示例#6
0
        /// <summary>Snippet for GetAssetAsync</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 GetAssetAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/assets/[ASSET_ID]";
            // Make the request
            Asset response = await assetServiceClient.GetAssetAsync(resourceName);
        }
示例#7
0
        /// <summary>Snippet for UpdateFeedAsync</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 UpdateFeedAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            Feed feed = new Feed();
            // Make the request
            Feed response = await assetServiceClient.UpdateFeedAsync(feed);
        }
        /// <summary>Snippet for GetAssetAsync</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 GetAssetResourceNamesAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AssetName resourceName = AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]");
            // Make the request
            Asset response = await assetServiceClient.GetAssetAsync(resourceName);
        }
        /// <summary>Snippet for CreateFeedAsync</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 CreateFeedAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string parent = "";
            // Make the request
            Feed response = await assetServiceClient.CreateFeedAsync(parent);
        }
 /// <summary>Snippet for ListFeedsAsync</summary>
 public async Task ListFeedsRequestObjectAsync()
 {
     // Snippet: ListFeedsAsync(ListFeedsRequest, CallSettings)
     // Additional: ListFeedsAsync(ListFeedsRequest, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     ListFeedsRequest request = new ListFeedsRequest { Parent = "", };
     // Make the request
     ListFeedsResponse response = await assetServiceClient.ListFeedsAsync(request);
     // End snippet
 }
 /// <summary>Snippet for DeleteFeedAsync</summary>
 public async Task DeleteFeedResourceNamesAsync()
 {
     // Snippet: DeleteFeedAsync(FeedName, CallSettings)
     // Additional: DeleteFeedAsync(FeedName, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     FeedName name = FeedName.FromProjectFeed("[PROJECT]", "[FEED]");
     // Make the request
     await assetServiceClient.DeleteFeedAsync(name);
     // End snippet
 }
 /// <summary>Snippet for DeleteFeedAsync</summary>
 public async Task DeleteFeedAsync()
 {
     // Snippet: DeleteFeedAsync(string, CallSettings)
     // Additional: DeleteFeedAsync(string, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/feeds/[FEED]";
     // Make the request
     await assetServiceClient.DeleteFeedAsync(name);
     // End snippet
 }
 /// <summary>Snippet for UpdateFeedAsync</summary>
 public async Task UpdateFeedAsync()
 {
     // Snippet: UpdateFeedAsync(Feed, CallSettings)
     // Additional: UpdateFeedAsync(Feed, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     Feed feed = new Feed();
     // Make the request
     Feed response = await assetServiceClient.UpdateFeedAsync(feed);
     // End snippet
 }
 /// <summary>Snippet for ListFeedsAsync</summary>
 public async Task ListFeedsAsync()
 {
     // Snippet: ListFeedsAsync(string, CallSettings)
     // Additional: ListFeedsAsync(string, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     string parent = "";
     // Make the request
     ListFeedsResponse response = await assetServiceClient.ListFeedsAsync(parent);
     // End snippet
 }
        /// <summary>Snippet for ListFeedsAsync</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 ListFeedsRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListFeedsRequest request = new ListFeedsRequest {
                Parent = "",
            };
            // Make the request
            ListFeedsResponse response = await assetServiceClient.ListFeedsAsync(request);
        }
        /// <summary>Snippet for GetAssetAsync</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 GetAssetRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAssetRequest request = new GetAssetRequest
            {
                ResourceNameAsAssetName = AssetName.FromCustomerAsset("[CUSTOMER]", "[ASSET]"),
            };
            // Make the request
            Asset response = await assetServiceClient.GetAssetAsync(request);
        }
示例#17
0
        /// <summary>Snippet for GetFeedAsync</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 GetFeedRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetFeedRequest request = new GetFeedRequest
            {
                FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"),
            };
            // Make the request
            Feed response = await assetServiceClient.GetFeedAsync(request);
        }
示例#18
0
        /// <summary>Snippet for SearchAllResources</summary>
        public async Task SearchAllResourcesRequestObjectAsync()
        {
            // Snippet: SearchAllResourcesAsync(SearchAllResourcesRequest, CallSettings)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            SearchAllResourcesRequest request = new SearchAllResourcesRequest
            {
                Scope      = "",
                Query      = "",
                AssetTypes = { "", },
                OrderBy    = "",
            };
            // Make the request
            PagedAsyncEnumerable <SearchAllResourcesResponse, ResourceSearchResult> response = assetServiceClient.SearchAllResourcesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((ResourceSearchResult 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((SearchAllResourcesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ResourceSearchResult 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 <ResourceSearchResult> 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 (ResourceSearchResult 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
        }
示例#19
0
        /// <summary>Snippet for AnalyzeIamPolicyAsync</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 AnalyzeIamPolicyRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
            {
                AnalysisQuery = new IamPolicyAnalysisQuery(),
                Options       = new AnalyzeIamPolicyRequest.Types.Options(),
            };
            // Make the request
            AnalyzeIamPolicyResponse response = await assetServiceClient.AnalyzeIamPolicyAsync(request);
        }
        /// <summary>Snippet for GetAssetAsync</summary>
        public async Task GetAssetAsync()
        {
            // Snippet: GetAssetAsync(string, CallSettings)
            // Additional: GetAssetAsync(string, CancellationToken)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/assets/[ASSET]";
            // Make the request
            Asset response = await assetServiceClient.GetAssetAsync(resourceName);

            // End snippet
        }
示例#21
0
        /// <summary>Snippet for BatchGetAssetsHistoryAsync</summary>
        public async Task BatchGetAssetsHistoryAsync()
        {
            // Snippet: BatchGetAssetsHistoryAsync(string,CallSettings)
            // Additional: BatchGetAssetsHistoryAsync(string,CancellationToken)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string formattedParent = new Google.Api.Gax.ResourceNames.ProjectName("[PROJECT]").ToString();
            // Make the request
            BatchGetAssetsHistoryResponse response = await assetServiceClient.BatchGetAssetsHistoryAsync(formattedParent);

            // End snippet
        }
示例#22
0
        /// <summary>Snippet for DeleteFeedAsync</summary>
        public async Task DeleteFeedAsync()
        {
            // Snippet: DeleteFeedAsync(string,CallSettings)
            // Additional: DeleteFeedAsync(string,CancellationToken)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new FeedName("[PROJECT]", "[FEED]").ToString();
            // Make the request
            await assetServiceClient.DeleteFeedAsync(formattedName);

            // End snippet
        }
        /// <summary>Snippet for GetAssetAsync</summary>
        public async Task GetAssetResourceNamesAsync()
        {
            // Snippet: GetAssetAsync(AssetName, CallSettings)
            // Additional: GetAssetAsync(AssetName, CancellationToken)
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            AssetName resourceName = AssetName.FromCustomerAsset("[CUSTOMER]", "[ASSET]");
            // Make the request
            Asset response = await assetServiceClient.GetAssetAsync(resourceName);

            // End snippet
        }
示例#24
0
        /// <summary>Snippet for MutateAssetsAsync</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 MutateAssetsAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            IEnumerable <AssetOperation> operations = new AssetOperation[]
            {
                new AssetOperation(),
            };
            // Make the request
            MutateAssetsResponse response = await assetServiceClient.MutateAssetsAsync(customerId, operations);
        }
        /// <summary>Snippet for UpdateFeedAsync</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 UpdateFeedRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateFeedRequest request = new UpdateFeedRequest
            {
                Feed       = new Feed(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Feed response = await assetServiceClient.UpdateFeedAsync(request);
        }
        /// <summary>Snippet for ListAssetsAsync</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 ListAssetsRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListAssetsRequest request = new ListAssetsRequest
            {
                ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
                ReadTime             = new Timestamp(),
                AssetTypes           = { "", },
                ContentType          = ContentType.Unspecified,
            };
            // Make the request
            PagedAsyncEnumerable <ListAssetsResponse, Asset> response = assetServiceClient.ListAssetsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Asset 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((ListAssetsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Asset 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 <Asset> 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 (Asset 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 DeleteFeedAsync</summary>
 public async Task DeleteFeedRequestObjectAsync()
 {
     // Snippet: DeleteFeedAsync(DeleteFeedRequest, CallSettings)
     // Additional: DeleteFeedAsync(DeleteFeedRequest, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     DeleteFeedRequest request = new DeleteFeedRequest
     {
         FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"),
     };
     // Make the request
     await assetServiceClient.DeleteFeedAsync(request);
     // End snippet
 }
        /// <summary>Snippet for CreateFeedAsync</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 CreateFeedRequestObjectAsync()
        {
            // Create client
            AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateFeedRequest request = new CreateFeedRequest
            {
                Parent = "",
                FeedId = "",
                Feed   = new Feed(),
            };
            // Make the request
            Feed response = await assetServiceClient.CreateFeedAsync(request);
        }
 /// <summary>Snippet for UpdateFeedAsync</summary>
 public async Task UpdateFeedRequestObjectAsync()
 {
     // Snippet: UpdateFeedAsync(UpdateFeedRequest, CallSettings)
     // Additional: UpdateFeedAsync(UpdateFeedRequest, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     UpdateFeedRequest request = new UpdateFeedRequest
     {
         Feed = new Feed(),
         UpdateMask = new FieldMask(),
     };
     // Make the request
     Feed response = await assetServiceClient.UpdateFeedAsync(request);
     // End snippet
 }
 /// <summary>Snippet for AnalyzeIamPolicyAsync</summary>
 public async Task AnalyzeIamPolicyRequestObjectAsync()
 {
     // Snippet: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CallSettings)
     // Additional: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CancellationToken)
     // Create client
     AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
     // Initialize request argument(s)
     AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
     {
         AnalysisQuery = new IamPolicyAnalysisQuery(),
         ExecutionTimeout = new Duration(),
     };
     // Make the request
     AnalyzeIamPolicyResponse response = await assetServiceClient.AnalyzeIamPolicyAsync(request);
     // End snippet
 }