/// <summary>Snippet for StopExperiment</summary> public void StopExperimentResourceNames() { // Snippet: StopExperiment(ExperimentName, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) ExperimentName name = ExperimentName.FromProjectLocationAgentEnvironmentExperiment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"); // Make the request Experiment response = experimentsClient.StopExperiment(name); // End snippet }
/// <summary>Snippet for StopExperiment</summary> public void StopExperiment() { // Snippet: StopExperiment(string, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/environments/[ENVIRONMENT]/experiments/[EXPERIMENT]"; // Make the request Experiment response = experimentsClient.StopExperiment(name); // End snippet }
/// <summary>Snippet for UpdateExperiment</summary> public void UpdateExperiment() { // Snippet: UpdateExperiment(Experiment, FieldMask, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) Experiment experiment = new Experiment(); FieldMask updateMask = new FieldMask(); // Make the request Experiment response = experimentsClient.UpdateExperiment(experiment, updateMask); // End snippet }
/// <summary>Snippet for CreateExperiment</summary> public void CreateExperimentResourceNames() { // Snippet: CreateExperiment(EnvironmentName, Experiment, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) EnvironmentName parent = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"); Experiment experiment = new Experiment(); // Make the request Experiment response = experimentsClient.CreateExperiment(parent, experiment); // End snippet }
/// <summary>Snippet for CreateExperiment</summary> public void CreateExperiment() { // Snippet: CreateExperiment(string, Experiment, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/environments/[ENVIRONMENT]"; Experiment experiment = new Experiment(); // Make the request Experiment response = experimentsClient.CreateExperiment(parent, experiment); // End snippet }
/// <summary>Snippet for StartExperiment</summary> public void StartExperimentRequestObject() { // Snippet: StartExperiment(StartExperimentRequest, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) StartExperimentRequest request = new StartExperimentRequest { ExperimentName = ExperimentName.FromProjectLocationAgentEnvironmentExperiment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]", "[EXPERIMENT]"), }; // Make the request Experiment response = experimentsClient.StartExperiment(request); // End snippet }
/// <summary>Snippet for UpdateExperiment</summary> public void UpdateExperimentRequestObject() { // Snippet: UpdateExperiment(UpdateExperimentRequest, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) UpdateExperimentRequest request = new UpdateExperimentRequest { Experiment = new Experiment(), UpdateMask = new FieldMask(), }; // Make the request Experiment response = experimentsClient.UpdateExperiment(request); // End snippet }
/// <summary>Snippet for ListExperiments</summary> public void ListExperimentsRequestObject() { // Snippet: ListExperiments(ListExperimentsRequest, CallSettings) // Create client ExperimentsClient experimentsClient = ExperimentsClient.Create(); // Initialize request argument(s) ListExperimentsRequest request = new ListExperimentsRequest { ParentAsEnvironmentName = EnvironmentName.FromProjectLocationAgentEnvironment("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]"), }; // Make the request PagedEnumerable <ListExperimentsResponse, Experiment> response = experimentsClient.ListExperiments(request); // Iterate over all response items, lazily performing RPCs as required foreach (Experiment 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 (ListExperimentsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Experiment 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 <Experiment> 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 (Experiment 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 }