Skip to content

Commit

Permalink
feat: ScheduleService (schedule_service.proto) creates and manages Sc…
Browse files Browse the repository at this point in the history
…hedule resources to launch scheduled pipelines runs

feat: Schedule (schedule.proto) periodically schedules runs to make API calls

PiperOrigin-RevId: 550058610

Source-Link: googleapis/googleapis@5b24e63

Source-Link: googleapis/googleapis-gen@4c5f6f9
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQUlQbGF0Zm9ybS5WMS8uT3dsQm90LnlhbWwiLCJoIjoiNGM1ZjZmOWM0MjkyYzE0Mjg3MjE3YjU2ZjJkY2IwNGNkNzcyNzgzMiJ9
  • Loading branch information
gcf-owl-bot[bot] authored and amanda-tarafa committed Jul 22, 2023
1 parent 510e913 commit dc5bfd6
Show file tree
Hide file tree
Showing 55 changed files with 11,932 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_async_flattened]
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateScheduleAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateScheduleAsync()
{
// Create client
ScheduleServiceClient scheduleServiceClient = await ScheduleServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Schedule schedule = new Schedule();
// Make the request
Schedule response = await scheduleServiceClient.CreateScheduleAsync(parent, schedule);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_async]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateScheduleAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateScheduleRequestObjectAsync()
{
// Create client
ScheduleServiceClient scheduleServiceClient = await ScheduleServiceClient.CreateAsync();
// Initialize request argument(s)
CreateScheduleRequest request = new CreateScheduleRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Schedule = new Schedule(),
};
// Make the request
Schedule response = await scheduleServiceClient.CreateScheduleAsync(request);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_sync]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateSchedule</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateScheduleRequestObject()
{
// Create client
ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.Create();
// Initialize request argument(s)
CreateScheduleRequest request = new CreateScheduleRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Schedule = new Schedule(),
};
// Make the request
Schedule response = scheduleServiceClient.CreateSchedule(request);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_async_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateScheduleAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateScheduleResourceNamesAsync()
{
// Create client
ScheduleServiceClient scheduleServiceClient = await ScheduleServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Schedule schedule = new Schedule();
// Make the request
Schedule response = await scheduleServiceClient.CreateScheduleAsync(parent, schedule);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_async_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_sync_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateSchedule</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateScheduleResourceNames()
{
// Create client
ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Schedule schedule = new Schedule();
// Make the request
Schedule response = scheduleServiceClient.CreateSchedule(parent, schedule);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_sync_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_CreateSchedule_sync_flattened]
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for CreateSchedule</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateSchedule()
{
// Create client
ScheduleServiceClient scheduleServiceClient = ScheduleServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Schedule schedule = new Schedule();
// Make the request
Schedule response = scheduleServiceClient.CreateSchedule(parent, schedule);
}
}
// [END aiplatform_v1_generated_ScheduleService_CreateSchedule_sync_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_ScheduleService_DeleteSchedule_async_flattened]
using Google.Cloud.AIPlatform.V1;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
using System.Threading.Tasks;

public sealed partial class GeneratedScheduleServiceClientSnippets
{
/// <summary>Snippet for DeleteScheduleAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task DeleteScheduleAsync()
{
// Create client
ScheduleServiceClient scheduleServiceClient = await ScheduleServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/schedules/[SCHEDULE]";
// Make the request
Operation<Empty, DeleteOperationMetadata> response = await scheduleServiceClient.DeleteScheduleAsync(name);

// Poll until the returned long-running operation is complete
Operation<Empty, DeleteOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty 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<Empty, DeleteOperationMetadata> retrievedResponse = await scheduleServiceClient.PollOnceDeleteScheduleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
}
}
// [END aiplatform_v1_generated_ScheduleService_DeleteSchedule_async_flattened]
}
Loading

0 comments on commit dc5bfd6

Please sign in to comment.