Skip to content

Commit

Permalink
feat: Log Analytics features of the Cloud Logging API
Browse files Browse the repository at this point in the history
feat: Add ConfigServiceV2.CreateBucketAsync method for creating Log Buckets asynchronously
feat: Add ConfigServiceV2.UpdateBucketAsync method for creating Log Buckets asynchronously
feat: Add ConfigServiceV2.CreateLink method for creating linked datasets for Log Analytics Buckets
feat: Add ConfigServiceV2.DeleteLink method for deleting linked datasets
feat: Add ConfigServiceV2.ListLinks method for listing linked datasets
feat: Add ConfigServiceV2.GetLink methods for describing linked datasets
feat: Add LogBucket.analytics_enabled field that specifies whether Log Bucket's Analytics features are enabled
feat: Add LogBucket.index_configs field that contains a list of Log Bucket's indexed fields and related configuration data
docs: Documentation for the Log Analytics features of the Cloud Logging API

PiperOrigin-RevId: 529851525

Source-Link: googleapis/googleapis@1c7ee99

Source-Link: googleapis/googleapis-gen@4a2a3a0
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuTG9nZ2luZy5WMi8uT3dsQm90LnlhbWwiLCJoIjoiNGEyYTNhMDViOTE4MDQzMzNhMWIzOWI2MzVkOGZlMjI0M2Q0YjRmZCJ9
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed May 12, 2023
1 parent 9bb8f0e commit 5a7f88f
Show file tree
Hide file tree
Showing 42 changed files with 14,206 additions and 4,470 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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 logging_v2_generated_ConfigServiceV2_BeginCreateBucket_async]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Logging.V2;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedConfigServiceV2ClientSnippets
{
/// <summary>Snippet for BeginCreateBucketAsync</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 BeginCreateBucketRequestObjectAsync()
{
// Create client
ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync();
// Initialize request argument(s)
CreateBucketRequest request = new CreateBucketRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
BucketId = "",
Bucket = new LogBucket(),
};
// Make the request
Operation<LogBucket, BucketMetadata> response = await configServiceV2Client.BeginCreateBucketAsync(request);

// Poll until the returned long-running operation is complete
Operation<LogBucket, BucketMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
LogBucket 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<LogBucket, BucketMetadata> retrievedResponse = await configServiceV2Client.PollOnceBeginCreateBucketAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
LogBucket retrievedResult = retrievedResponse.Result;
}
}
}
// [END logging_v2_generated_ConfigServiceV2_BeginCreateBucket_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// 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 logging_v2_generated_ConfigServiceV2_BeginCreateBucket_sync]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Logging.V2;
using Google.LongRunning;

public sealed partial class GeneratedConfigServiceV2ClientSnippets
{
/// <summary>Snippet for BeginCreateBucket</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 BeginCreateBucketRequestObject()
{
// Create client
ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create();
// Initialize request argument(s)
CreateBucketRequest request = new CreateBucketRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
BucketId = "",
Bucket = new LogBucket(),
};
// Make the request
Operation<LogBucket, BucketMetadata> response = configServiceV2Client.BeginCreateBucket(request);

// Poll until the returned long-running operation is complete
Operation<LogBucket, BucketMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
LogBucket 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<LogBucket, BucketMetadata> retrievedResponse = configServiceV2Client.PollOnceBeginCreateBucket(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
LogBucket retrievedResult = retrievedResponse.Result;
}
}
}
// [END logging_v2_generated_ConfigServiceV2_BeginCreateBucket_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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 logging_v2_generated_ConfigServiceV2_BeginUpdateBucket_async]
using Google.Cloud.Logging.V2;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;
using System.Threading.Tasks;

public sealed partial class GeneratedConfigServiceV2ClientSnippets
{
/// <summary>Snippet for BeginUpdateBucketAsync</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 BeginUpdateBucketRequestObjectAsync()
{
// Create client
ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync();
// Initialize request argument(s)
UpdateBucketRequest request = new UpdateBucketRequest
{
LogBucketName = LogBucketName.FromProjectLocationBucket("[PROJECT]", "[LOCATION]", "[BUCKET]"),
Bucket = new LogBucket(),
UpdateMask = new FieldMask(),
};
// Make the request
Operation<LogBucket, BucketMetadata> response = await configServiceV2Client.BeginUpdateBucketAsync(request);

// Poll until the returned long-running operation is complete
Operation<LogBucket, BucketMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
LogBucket 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<LogBucket, BucketMetadata> retrievedResponse = await configServiceV2Client.PollOnceBeginUpdateBucketAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
LogBucket retrievedResult = retrievedResponse.Result;
}
}
}
// [END logging_v2_generated_ConfigServiceV2_BeginUpdateBucket_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// 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 logging_v2_generated_ConfigServiceV2_BeginUpdateBucket_sync]
using Google.Cloud.Logging.V2;
using Google.LongRunning;
using Google.Protobuf.WellKnownTypes;

public sealed partial class GeneratedConfigServiceV2ClientSnippets
{
/// <summary>Snippet for BeginUpdateBucket</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 BeginUpdateBucketRequestObject()
{
// Create client
ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create();
// Initialize request argument(s)
UpdateBucketRequest request = new UpdateBucketRequest
{
LogBucketName = LogBucketName.FromProjectLocationBucket("[PROJECT]", "[LOCATION]", "[BUCKET]"),
Bucket = new LogBucket(),
UpdateMask = new FieldMask(),
};
// Make the request
Operation<LogBucket, BucketMetadata> response = configServiceV2Client.BeginUpdateBucket(request);

// Poll until the returned long-running operation is complete
Operation<LogBucket, BucketMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
LogBucket 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<LogBucket, BucketMetadata> retrievedResponse = configServiceV2Client.PollOnceBeginUpdateBucket(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
LogBucket retrievedResult = retrievedResponse.Result;
}
}
}
// [END logging_v2_generated_ConfigServiceV2_BeginUpdateBucket_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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 logging_v2_generated_ConfigServiceV2_CreateLink_async_flattened]
using Google.Cloud.Logging.V2;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedConfigServiceV2ClientSnippets
{
/// <summary>Snippet for CreateLinkAsync</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 CreateLinkAsync()
{
// Create client
ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/buckets/[BUCKET]";
Link link = new Link();
string linkId = "";
// Make the request
Operation<Link, LinkMetadata> response = await configServiceV2Client.CreateLinkAsync(parent, link, linkId);

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

0 comments on commit 5a7f88f

Please sign in to comment.