google-cloud-monitoring-v3 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Monitoring
24
+ module V3
25
+ module SnoozeService
26
+ # Credentials for the SnoozeService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform",
30
+ "https://www.googleapis.com/auth/monitoring",
31
+ "https://www.googleapis.com/auth/monitoring.read"
32
+ ]
33
+ self.env_vars = [
34
+ "MONITORING_CREDENTIALS",
35
+ "MONITORING_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS",
37
+ "GOOGLE_CLOUD_KEYFILE",
38
+ "GCLOUD_KEYFILE",
39
+ "MONITORING_CREDENTIALS_JSON",
40
+ "MONITORING_KEYFILE_JSON",
41
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
42
+ "GOOGLE_CLOUD_KEYFILE_JSON",
43
+ "GCLOUD_KEYFILE_JSON"
44
+ ]
45
+ self.paths = [
46
+ "~/.config/google_cloud/application_default_credentials.json"
47
+ ]
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,149 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Monitoring
23
+ module V3
24
+ module SnoozeService
25
+ # Path helper methods for the SnoozeService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified AlertPolicy resource string.
29
+ #
30
+ # @overload alert_policy_path(project:, alert_policy:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/alertPolicies/{alert_policy}`
34
+ #
35
+ # @param project [String]
36
+ # @param alert_policy [String]
37
+ #
38
+ # @overload alert_policy_path(organization:, alert_policy:)
39
+ # The resource will be in the following format:
40
+ #
41
+ # `organizations/{organization}/alertPolicies/{alert_policy}`
42
+ #
43
+ # @param organization [String]
44
+ # @param alert_policy [String]
45
+ #
46
+ # @overload alert_policy_path(folder:, alert_policy:)
47
+ # The resource will be in the following format:
48
+ #
49
+ # `folders/{folder}/alertPolicies/{alert_policy}`
50
+ #
51
+ # @param folder [String]
52
+ # @param alert_policy [String]
53
+ #
54
+ # @return [::String]
55
+ def alert_policy_path **args
56
+ resources = {
57
+ "alert_policy:project" => (proc do |project:, alert_policy:|
58
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
59
+
60
+ "projects/#{project}/alertPolicies/#{alert_policy}"
61
+ end),
62
+ "alert_policy:organization" => (proc do |organization:, alert_policy:|
63
+ raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
64
+
65
+ "organizations/#{organization}/alertPolicies/#{alert_policy}"
66
+ end),
67
+ "alert_policy:folder" => (proc do |folder:, alert_policy:|
68
+ raise ::ArgumentError, "folder cannot contain /" if folder.to_s.include? "/"
69
+
70
+ "folders/#{folder}/alertPolicies/#{alert_policy}"
71
+ end)
72
+ }
73
+
74
+ resource = resources[args.keys.sort.join(":")]
75
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
76
+ resource.call(**args)
77
+ end
78
+
79
+ ##
80
+ # Create a fully-qualified Project resource string.
81
+ #
82
+ # The resource will be in the following format:
83
+ #
84
+ # `projects/{project}`
85
+ #
86
+ # @param project [String]
87
+ #
88
+ # @return [::String]
89
+ def project_path project:
90
+ "projects/#{project}"
91
+ end
92
+
93
+ ##
94
+ # Create a fully-qualified Snooze resource string.
95
+ #
96
+ # The resource will be in the following format:
97
+ #
98
+ # `projects/{project}/snoozes/{snooze}`
99
+ #
100
+ # @param project [String]
101
+ # @param snooze [String]
102
+ #
103
+ # @return [::String]
104
+ def snooze_path project:, snooze:
105
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
106
+
107
+ "projects/#{project}/snoozes/#{snooze}"
108
+ end
109
+
110
+ ##
111
+ # Create a fully-qualified Workspace resource string.
112
+ #
113
+ # @overload workspace_path(project:)
114
+ # The resource will be in the following format:
115
+ #
116
+ # `projects/{project}`
117
+ #
118
+ # @param project [String]
119
+ #
120
+ # @overload workspace_path(workspace:)
121
+ # The resource will be in the following format:
122
+ #
123
+ # `workspaces/{workspace}`
124
+ #
125
+ # @param workspace [String]
126
+ #
127
+ # @return [::String]
128
+ def workspace_path **args
129
+ resources = {
130
+ "project" => (proc do |project:|
131
+ "projects/#{project}"
132
+ end),
133
+ "workspace" => (proc do |workspace:|
134
+ "workspaces/#{workspace}"
135
+ end)
136
+ }
137
+
138
+ resource = resources[args.keys.sort.join(":")]
139
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
140
+ resource.call(**args)
141
+ end
142
+
143
+ extend self
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/monitoring/v3/version"
24
+
25
+ require "google/cloud/monitoring/v3/snooze_service/credentials"
26
+ require "google/cloud/monitoring/v3/snooze_service/paths"
27
+ require "google/cloud/monitoring/v3/snooze_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Monitoring
32
+ module V3
33
+ ##
34
+ # The SnoozeService API is used to temporarily prevent an alert policy from
35
+ # generating alerts. A Snooze is a description of the criteria under which one
36
+ # or more alert policies should not fire alerts for the specified duration.
37
+ #
38
+ # @example Load this service and instantiate a gRPC client
39
+ #
40
+ # require "google/cloud/monitoring/v3/snooze_service"
41
+ # client = ::Google::Cloud::Monitoring::V3::SnoozeService::Client.new
42
+ #
43
+ module SnoozeService
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ helper_path = ::File.join __dir__, "snooze_service", "helpers.rb"
51
+ require "google/cloud/monitoring/v3/snooze_service/helpers" if ::File.file? helper_path
@@ -40,7 +40,7 @@ module Google
40
40
  # clicking on "Monitoring" on the left-hand side to navigate to Stackdriver,
41
41
  # and then clicking on "Uptime".
42
42
  #
43
- # To load this service and instantiate a client:
43
+ # @example Load this service and instantiate a gRPC client
44
44
  #
45
45
  # require "google/cloud/monitoring/v3/uptime_check_service"
46
46
  # client = ::Google::Cloud::Monitoring::V3::UptimeCheckService::Client.new
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Monitoring
23
23
  module V3
24
- VERSION = "0.9.0"
24
+ VERSION = "0.10.0"
25
25
  end
26
26
  end
27
27
  end
@@ -22,6 +22,7 @@ require "google/cloud/monitoring/v3/metric_service"
22
22
  require "google/cloud/monitoring/v3/notification_channel_service"
23
23
  require "google/cloud/monitoring/v3/query_service"
24
24
  require "google/cloud/monitoring/v3/service_monitoring_service"
25
+ require "google/cloud/monitoring/v3/snooze_service"
25
26
  require "google/cloud/monitoring/v3/uptime_check_service"
26
27
  require "google/cloud/monitoring/v3/version"
27
28
 
@@ -29,9 +30,9 @@ module Google
29
30
  module Cloud
30
31
  module Monitoring
31
32
  ##
32
- # To load this package, including all its services, and instantiate a client:
33
+ # API client module.
33
34
  #
34
- # @example
35
+ # @example Load this package, including all its services, and instantiate a gRPC client
35
36
  #
36
37
  # require "google/cloud/monitoring/v3"
37
38
  # client = ::Google::Cloud::Monitoring::V3::AlertPolicyService::Client.new
@@ -0,0 +1,33 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/monitoring/v3/snooze.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/field_behavior_pb'
7
+ require 'google/api/resource_pb'
8
+ require 'google/monitoring/v3/common_pb'
9
+
10
+ Google::Protobuf::DescriptorPool.generated_pool.build do
11
+ add_file("google/monitoring/v3/snooze.proto", :syntax => :proto3) do
12
+ add_message "google.monitoring.v3.Snooze" do
13
+ optional :name, :string, 1
14
+ optional :criteria, :message, 3, "google.monitoring.v3.Snooze.Criteria"
15
+ optional :interval, :message, 4, "google.monitoring.v3.TimeInterval"
16
+ optional :display_name, :string, 5
17
+ end
18
+ add_message "google.monitoring.v3.Snooze.Criteria" do
19
+ repeated :policies, :string, 1
20
+ end
21
+ end
22
+ end
23
+
24
+ module Google
25
+ module Cloud
26
+ module Monitoring
27
+ module V3
28
+ Snooze = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.Snooze").msgclass
29
+ Snooze::Criteria = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.Snooze.Criteria").msgclass
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,51 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/monitoring/v3/snooze_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/api/annotations_pb'
7
+ require 'google/api/client_pb'
8
+ require 'google/api/field_behavior_pb'
9
+ require 'google/api/resource_pb'
10
+ require 'google/monitoring/v3/snooze_pb'
11
+ require 'google/protobuf/field_mask_pb'
12
+
13
+ Google::Protobuf::DescriptorPool.generated_pool.build do
14
+ add_file("google/monitoring/v3/snooze_service.proto", :syntax => :proto3) do
15
+ add_message "google.monitoring.v3.CreateSnoozeRequest" do
16
+ optional :parent, :string, 1
17
+ optional :snooze, :message, 2, "google.monitoring.v3.Snooze"
18
+ end
19
+ add_message "google.monitoring.v3.ListSnoozesRequest" do
20
+ optional :parent, :string, 1
21
+ optional :filter, :string, 2
22
+ optional :page_size, :int32, 4
23
+ optional :page_token, :string, 5
24
+ end
25
+ add_message "google.monitoring.v3.ListSnoozesResponse" do
26
+ repeated :snoozes, :message, 1, "google.monitoring.v3.Snooze"
27
+ optional :next_page_token, :string, 2
28
+ end
29
+ add_message "google.monitoring.v3.GetSnoozeRequest" do
30
+ optional :name, :string, 1
31
+ end
32
+ add_message "google.monitoring.v3.UpdateSnoozeRequest" do
33
+ optional :snooze, :message, 1, "google.monitoring.v3.Snooze"
34
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
35
+ end
36
+ end
37
+ end
38
+
39
+ module Google
40
+ module Cloud
41
+ module Monitoring
42
+ module V3
43
+ CreateSnoozeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.CreateSnoozeRequest").msgclass
44
+ ListSnoozesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.ListSnoozesRequest").msgclass
45
+ ListSnoozesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.ListSnoozesResponse").msgclass
46
+ GetSnoozeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.GetSnoozeRequest").msgclass
47
+ UpdateSnoozeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.monitoring.v3.UpdateSnoozeRequest").msgclass
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/monitoring/v3/snooze_service.proto for package 'Google.Cloud.Monitoring.V3'
3
+ # Original file comments:
4
+ # Copyright 2022 Google LLC
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/monitoring/v3/snooze_service_pb'
21
+
22
+ module Google
23
+ module Cloud
24
+ module Monitoring
25
+ module V3
26
+ module SnoozeService
27
+ # The SnoozeService API is used to temporarily prevent an alert policy from
28
+ # generating alerts. A Snooze is a description of the criteria under which one
29
+ # or more alert policies should not fire alerts for the specified duration.
30
+ class Service
31
+
32
+ include ::GRPC::GenericService
33
+
34
+ self.marshal_class_method = :encode
35
+ self.unmarshal_class_method = :decode
36
+ self.service_name = 'google.monitoring.v3.SnoozeService'
37
+
38
+ # Creates a `Snooze` that will prevent alerts, which match the provided
39
+ # criteria, from being opened. The `Snooze` applies for a specific time
40
+ # interval.
41
+ rpc :CreateSnooze, ::Google::Cloud::Monitoring::V3::CreateSnoozeRequest, ::Google::Cloud::Monitoring::V3::Snooze
42
+ # Lists the `Snooze`s associated with a project. Can optionally pass in
43
+ # `filter`, which specifies predicates to match `Snooze`s.
44
+ rpc :ListSnoozes, ::Google::Cloud::Monitoring::V3::ListSnoozesRequest, ::Google::Cloud::Monitoring::V3::ListSnoozesResponse
45
+ # Retrieves a `Snooze` by `name`.
46
+ rpc :GetSnooze, ::Google::Cloud::Monitoring::V3::GetSnoozeRequest, ::Google::Cloud::Monitoring::V3::Snooze
47
+ # Updates a `Snooze`, identified by its `name`, with the parameters in the
48
+ # given `Snooze` object.
49
+ rpc :UpdateSnooze, ::Google::Cloud::Monitoring::V3::UpdateSnoozeRequest, ::Google::Cloud::Monitoring::V3::Snooze
50
+ end
51
+
52
+ Stub = Service.rpc_stub_class
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end