Ejemplo n.º 1
0
        /// <summary>Snippet for CreateWorkload</summary>
        public void CreateWorkload()
        {
            // Snippet: CreateWorkload(string, Workload, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            string   parent   = "organizations/[ORGANIZATION]/locations/[LOCATION]";
            Workload workload = new Workload();
            // Make the request
            Operation <Workload, CreateWorkloadOperationMetadata> response = assuredWorkloadsServiceClient.CreateWorkload(parent, workload);

            // Poll until the returned long-running operation is complete
            Operation <Workload, CreateWorkloadOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Workload 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 <Workload, CreateWorkloadOperationMetadata> retrievedResponse = assuredWorkloadsServiceClient.PollOnceCreateWorkload(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Workload retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Ejemplo n.º 2
0
        /// <summary>Snippet for CreateWorkload</summary>
        public void CreateWorkloadRequestObject()
        {
            // Snippet: CreateWorkload(CreateWorkloadRequest, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            CreateWorkloadRequest request = new CreateWorkloadRequest
            {
                ParentAsLocationName = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
                Workload             = new Workload(),
                ExternalId           = "",
            };
            // Make the request
            Operation <Workload, CreateWorkloadOperationMetadata> response = assuredWorkloadsServiceClient.CreateWorkload(request);

            // Poll until the returned long-running operation is complete
            Operation <Workload, CreateWorkloadOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Workload 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 <Workload, CreateWorkloadOperationMetadata> retrievedResponse = assuredWorkloadsServiceClient.PollOnceCreateWorkload(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Workload retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
 /// <summary>Snippet for GetWorkload</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetWorkloadResourceNames()
 {
     // Create client
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
     // Initialize request argument(s)
     WorkloadName name = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]");
     // Make the request
     Workload response = assuredWorkloadsServiceClient.GetWorkload(name);
 }
Ejemplo n.º 4
0
 /// <summary>Snippet for GetWorkload</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetWorkload()
 {
     // Create client
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
     // Initialize request argument(s)
     string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/workloads/[WORKLOAD]";
     // Make the request
     Workload response = assuredWorkloadsServiceClient.GetWorkload(name);
 }
 /// <summary>Snippet for UpdateWorkload</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void UpdateWorkload()
 {
     // Create client
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
     // Initialize request argument(s)
     Workload workload = new Workload();
     FieldMask updateMask = new FieldMask();
     // Make the request
     Workload response = assuredWorkloadsServiceClient.UpdateWorkload(workload, updateMask);
 }
Ejemplo n.º 6
0
        /// <summary>Snippet for DeleteWorkload</summary>
        public void DeleteWorkloadResourceNames()
        {
            // Snippet: DeleteWorkload(WorkloadName, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            WorkloadName name = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]");

            // Make the request
            assuredWorkloadsServiceClient.DeleteWorkload(name);
            // End snippet
        }
Ejemplo n.º 7
0
        /// <summary>Snippet for DeleteWorkload</summary>
        public void DeleteWorkload()
        {
            // Snippet: DeleteWorkload(string, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            string name = "organizations/[ORGANIZATION]/locations/[LOCATION]/workloads/[WORKLOAD]";

            // Make the request
            assuredWorkloadsServiceClient.DeleteWorkload(name);
            // End snippet
        }
Ejemplo n.º 8
0
 /// <summary>Snippet for GetWorkload</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetWorkloadRequestObject()
 {
     // Create client
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
     // Initialize request argument(s)
     GetWorkloadRequest request = new GetWorkloadRequest
     {
         WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"),
     };
     // Make the request
     Workload response = assuredWorkloadsServiceClient.GetWorkload(request);
 }
 /// <summary>Snippet for UpdateWorkload</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void UpdateWorkloadRequestObject()
 {
     // Create client
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
     // Initialize request argument(s)
     UpdateWorkloadRequest request = new UpdateWorkloadRequest
     {
         Workload   = new Workload(),
         UpdateMask = new FieldMask(),
     };
     // Make the request
     Workload response = assuredWorkloadsServiceClient.UpdateWorkload(request);
 }
Ejemplo n.º 10
0
        /// <summary>Snippet for ListWorkloads</summary>
        public void ListWorkloadsRequestObject()
        {
            // Snippet: ListWorkloads(ListWorkloadsRequest, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            ListWorkloadsRequest request = new ListWorkloadsRequest
            {
                ParentAsLocationName = LocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]"),
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListWorkloadsResponse, Workload> response = assuredWorkloadsServiceClient.ListWorkloads(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Workload 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 (ListWorkloadsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Workload 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 <Workload> 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 (Workload 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
        }
Ejemplo n.º 11
0
        /// <summary>Snippet for DeleteWorkload</summary>
        public void DeleteWorkloadRequestObject()
        {
            // Snippet: DeleteWorkload(DeleteWorkloadRequest, CallSettings)
            // Create client
            AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.Create();
            // Initialize request argument(s)
            DeleteWorkloadRequest request = new DeleteWorkloadRequest
            {
                WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"),
                Etag         = "",
            };

            // Make the request
            assuredWorkloadsServiceClient.DeleteWorkload(request);
            // End snippet
        }