示例#1
0
 /// <summary>Snippet for GetScanConfig</summary>
 public void GetScanConfig()
 {
     // Snippet: GetScanConfig(ScanConfigName,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     ScanConfigName name = new ScanConfigName("[PROJECT]", "[SCAN_CONFIG]");
     // Make the request
     ScanConfig response = containerAnalysisV1Beta1Client.GetScanConfig(name);
     // End snippet
 }
示例#2
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy()
 {
     // Snippet: GetIamPolicy(IamResourceNameOneof,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     IamResourceNameOneof resource = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]"));
     // Make the request
     Policy response = containerAnalysisV1Beta1Client.GetIamPolicy(resource);
     // End snippet
 }
示例#3
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissions()
 {
     // Snippet: TestIamPermissions(IamResourceNameOneof,IEnumerable<string>,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     IamResourceNameOneof resource    = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]"));
     IEnumerable <string> permissions = new List <string>();
     // Make the request
     TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.TestIamPermissions(resource, permissions);
     // End snippet
 }
示例#4
0
 /// <summary>Snippet for GetScanConfig</summary>
 public void GetScanConfig_RequestObject()
 {
     // Snippet: GetScanConfig(GetScanConfigRequest,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     GetScanConfigRequest request = new GetScanConfigRequest
     {
         ScanConfigName = new ScanConfigName("[PROJECT]", "[SCAN_CONFIG]"),
     };
     // Make the request
     ScanConfig response = containerAnalysisV1Beta1Client.GetScanConfig(request);
     // End snippet
 }
示例#5
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         ResourceAsIamResourceNameOneof = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
     };
     // Make the request
     Policy response = containerAnalysisV1Beta1Client.GetIamPolicy(request);
     // End snippet
 }
示例#6
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissions_RequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsRequest,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     TestIamPermissionsRequest request = new TestIamPermissionsRequest
     {
         ResourceAsIamResourceNameOneof = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
         Permissions = { },
     };
     // Make the request
     TestIamPermissionsResponse response = containerAnalysisV1Beta1Client.TestIamPermissions(request);
     // End snippet
 }
示例#7
0
        /// <summary>Snippet for ListScanConfigs</summary>
        public void ListScanConfigs_RequestObject()
        {
            // Snippet: ListScanConfigs(ListScanConfigsRequest,CallSettings)
            // Create client
            ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
            // Initialize request argument(s)
            ListScanConfigsRequest request = new ListScanConfigsRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
            };
            // Make the request
            PagedEnumerable <ListScanConfigsResponse, ScanConfig> response =
                containerAnalysisV1Beta1Client.ListScanConfigs(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (ScanConfig 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 (ListScanConfigsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (ScanConfig item in page)
                {
                    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 <ScanConfig> 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 (ScanConfig item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }