google-cloud-monitoring 0.38.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -54
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +361 -0
  6. data/README.md +34 -50
  7. data/lib/google-cloud-monitoring.rb +6 -5
  8. data/lib/google/cloud/monitoring.rb +255 -443
  9. data/lib/google/cloud/monitoring/dashboard.rb +88 -117
  10. data/lib/google/cloud/monitoring/{v3/doc/google/protobuf/wrappers.rb → dashboard/version.rb} +12 -9
  11. data/lib/google/cloud/monitoring/version.rb +6 -2
  12. metadata +71 -128
  13. data/LICENSE +0 -201
  14. data/lib/google/cloud/monitoring/dashboard/v1.rb +0 -148
  15. data/lib/google/cloud/monitoring/dashboard/v1/credentials.rb +0 -46
  16. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client.rb +0 -457
  17. data/lib/google/cloud/monitoring/dashboard/v1/dashboards_service_client_config.json +0 -51
  18. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/common.rb +0 -394
  19. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboard.rb +0 -53
  20. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/dashboards_service.rb +0 -82
  21. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/layouts.rb +0 -71
  22. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/metrics.rb +0 -151
  23. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/scorecard.rb +0 -102
  24. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/text.rb +0 -43
  25. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/widget.rb +0 -41
  26. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/monitoring/dashboard/v1/xychart.rb +0 -141
  27. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/duration.rb +0 -91
  28. data/lib/google/cloud/monitoring/dashboard/v1/doc/google/protobuf/empty.rb +0 -29
  29. data/lib/google/cloud/monitoring/v3.rb +0 -532
  30. data/lib/google/cloud/monitoring/v3/alert_policy_service_client.rb +0 -553
  31. data/lib/google/cloud/monitoring/v3/alert_policy_service_client_config.json +0 -51
  32. data/lib/google/cloud/monitoring/v3/credentials.rb +0 -44
  33. data/lib/google/cloud/monitoring/v3/doc/google/api/distribution.rb +0 -200
  34. data/lib/google/cloud/monitoring/v3/doc/google/api/label.rb +0 -42
  35. data/lib/google/cloud/monitoring/v3/doc/google/api/metric.rb +0 -245
  36. data/lib/google/cloud/monitoring/v3/doc/google/api/monitored_resource.rb +0 -108
  37. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb +0 -344
  38. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert_service.rb +0 -138
  39. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/common.rb +0 -449
  40. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group.rb +0 -75
  41. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/group_service.rb +0 -167
  42. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric.rb +0 -85
  43. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/metric_service.rb +0 -230
  44. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/mutation_record.rb +0 -29
  45. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification.rb +0 -156
  46. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/notification_service.rb +0 -221
  47. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service.rb +0 -361
  48. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/service_service.rb +0 -197
  49. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime.rb +0 -364
  50. data/lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/uptime_service.rb +0 -136
  51. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/any.rb +0 -131
  52. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/duration.rb +0 -91
  53. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/empty.rb +0 -29
  54. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/field_mask.rb +0 -222
  55. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/struct.rb +0 -74
  56. data/lib/google/cloud/monitoring/v3/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/monitoring/v3/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/monitoring/v3/group_service_client.rb +0 -606
  59. data/lib/google/cloud/monitoring/v3/group_service_client_config.json +0 -56
  60. data/lib/google/cloud/monitoring/v3/metric_service_client.rb +0 -750
  61. data/lib/google/cloud/monitoring/v3/metric_service_client_config.json +0 -66
  62. data/lib/google/cloud/monitoring/v3/notification_channel_service_client.rb +0 -811
  63. data/lib/google/cloud/monitoring/v3/notification_channel_service_client_config.json +0 -76
  64. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client.rb +0 -788
  65. data/lib/google/cloud/monitoring/v3/service_monitoring_service_client_config.json +0 -76
  66. data/lib/google/cloud/monitoring/v3/uptime_check_service_client.rb +0 -550
  67. data/lib/google/cloud/monitoring/v3/uptime_check_service_client_config.json +0 -56
  68. data/lib/google/monitoring/dashboard/v1/common_pb.rb +0 -95
  69. data/lib/google/monitoring/dashboard/v1/dashboard_pb.rb +0 -29
  70. data/lib/google/monitoring/dashboard/v1/dashboards_service_pb.rb +0 -51
  71. data/lib/google/monitoring/dashboard/v1/dashboards_service_services_pb.rb +0 -76
  72. data/lib/google/monitoring/dashboard/v1/drilldowns_pb.rb +0 -17
  73. data/lib/google/monitoring/dashboard/v1/layouts_pb.rb +0 -41
  74. data/lib/google/monitoring/dashboard/v1/metrics_pb.rb +0 -76
  75. data/lib/google/monitoring/dashboard/v1/scorecard_pb.rb +0 -38
  76. data/lib/google/monitoring/dashboard/v1/service_pb.rb +0 -17
  77. data/lib/google/monitoring/dashboard/v1/text_pb.rb +0 -28
  78. data/lib/google/monitoring/dashboard/v1/widget_pb.rb +0 -32
  79. data/lib/google/monitoring/dashboard/v1/xychart_pb.rb +0 -66
  80. data/lib/google/monitoring/v3/alert_pb.rb +0 -87
  81. data/lib/google/monitoring/v3/alert_service_pb.rb +0 -53
  82. data/lib/google/monitoring/v3/alert_service_services_pb.rb +0 -63
  83. data/lib/google/monitoring/v3/common_pb.rb +0 -95
  84. data/lib/google/monitoring/v3/dropped_labels_pb.rb +0 -19
  85. data/lib/google/monitoring/v3/group_pb.rb +0 -24
  86. data/lib/google/monitoring/v3/group_service_pb.rb +0 -73
  87. data/lib/google/monitoring/v3/group_service_services_pb.rb +0 -66
  88. data/lib/google/monitoring/v3/metric_pb.rb +0 -82
  89. data/lib/google/monitoring/v3/metric_service_pb.rb +0 -130
  90. data/lib/google/monitoring/v3/metric_service_services_pb.rb +0 -66
  91. data/lib/google/monitoring/v3/mutation_record_pb.rb +0 -21
  92. data/lib/google/monitoring/v3/notification_pb.rb +0 -47
  93. data/lib/google/monitoring/v3/notification_service_pb.rb +0 -90
  94. data/lib/google/monitoring/v3/notification_service_services_pb.rb +0 -94
  95. data/lib/google/monitoring/v3/service_pb.rb +0 -149
  96. data/lib/google/monitoring/v3/service_service_pb.rb +0 -86
  97. data/lib/google/monitoring/v3/service_service_services_pb.rb +0 -65
  98. data/lib/google/monitoring/v3/span_context_pb.rb +0 -19
  99. data/lib/google/monitoring/v3/uptime_pb.rb +0 -123
  100. data/lib/google/monitoring/v3/uptime_service_pb.rb +0 -63
  101. data/lib/google/monitoring/v3/uptime_service_services_pb.rb +0 -67
@@ -1,74 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `Struct` represents a structured data value, consisting of fields
19
- # which map to dynamically typed values. In some languages, `Struct`
20
- # might be supported by a native representation. For example, in
21
- # scripting languages like JS a struct is represented as an
22
- # object. The details of that representation are described together
23
- # with the proto support for the language.
24
- #
25
- # The JSON representation for `Struct` is JSON object.
26
- # @!attribute [rw] fields
27
- # @return [Hash{String => Google::Protobuf::Value}]
28
- # Unordered map of dynamically typed values.
29
- class Struct; end
30
-
31
- # `Value` represents a dynamically typed value which can be either
32
- # null, a number, a string, a boolean, a recursive struct value, or a
33
- # list of values. A producer of value is expected to set one of that
34
- # variants, absence of any variant indicates an error.
35
- #
36
- # The JSON representation for `Value` is JSON value.
37
- # @!attribute [rw] null_value
38
- # @return [Google::Protobuf::NullValue]
39
- # Represents a null value.
40
- # @!attribute [rw] number_value
41
- # @return [Float]
42
- # Represents a double value.
43
- # @!attribute [rw] string_value
44
- # @return [String]
45
- # Represents a string value.
46
- # @!attribute [rw] bool_value
47
- # @return [true, false]
48
- # Represents a boolean value.
49
- # @!attribute [rw] struct_value
50
- # @return [Google::Protobuf::Struct]
51
- # Represents a structured value.
52
- # @!attribute [rw] list_value
53
- # @return [Google::Protobuf::ListValue]
54
- # Represents a repeated `Value`.
55
- class Value; end
56
-
57
- # `ListValue` is a wrapper around a repeated field of values.
58
- #
59
- # The JSON representation for `ListValue` is JSON array.
60
- # @!attribute [rw] values
61
- # @return [Array<Google::Protobuf::Value>]
62
- # Repeated field of dynamically typed values.
63
- class ListValue; end
64
-
65
- # `NullValue` is a singleton enumeration to represent the null value for the
66
- # `Value` type union.
67
- #
68
- # The JSON representation for `NullValue` is JSON `null`.
69
- module NullValue
70
- # Null value.
71
- NULL_VALUE = 0
72
- end
73
- end
74
- end
@@ -1,113 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone or local
19
- # calendar, encoded as a count of seconds and fractions of seconds at
20
- # nanosecond resolution. The count is relative to an epoch at UTC midnight on
21
- # January 1, 1970, in the proleptic Gregorian calendar which extends the
22
- # Gregorian calendar backwards to year one.
23
- #
24
- # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
25
- # second table is needed for interpretation, using a [24-hour linear
26
- # smear](https://developers.google.com/time/smear).
27
- #
28
- # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
29
- # restricting to that range, we ensure that we can convert to and from [RFC
30
- # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
31
- #
32
- # = Examples
33
- #
34
- # Example 1: Compute Timestamp from POSIX `time()`.
35
- #
36
- # Timestamp timestamp;
37
- # timestamp.set_seconds(time(NULL));
38
- # timestamp.set_nanos(0);
39
- #
40
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
41
- #
42
- # struct timeval tv;
43
- # gettimeofday(&tv, NULL);
44
- #
45
- # Timestamp timestamp;
46
- # timestamp.set_seconds(tv.tv_sec);
47
- # timestamp.set_nanos(tv.tv_usec * 1000);
48
- #
49
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
50
- #
51
- # FILETIME ft;
52
- # GetSystemTimeAsFileTime(&ft);
53
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
54
- #
55
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
56
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
57
- # Timestamp timestamp;
58
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
59
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
60
- #
61
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
62
- #
63
- # long millis = System.currentTimeMillis();
64
- #
65
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
66
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
67
- #
68
- #
69
- # Example 5: Compute Timestamp from current time in Python.
70
- #
71
- # timestamp = Timestamp()
72
- # timestamp.GetCurrentTime()
73
- #
74
- # = JSON Mapping
75
- #
76
- # In JSON format, the Timestamp type is encoded as a string in the
77
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
79
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
80
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
81
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
84
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
- # able to accept both UTC and other timezones (as indicated by an offset).
86
- #
87
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
- # 01:30 UTC on January 15, 2017.
89
- #
90
- # In JavaScript, one can convert a Date object to this format using the
91
- # standard
92
- # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
- # method. In Python, a standard `datetime.datetime` object can be converted
94
- # to this format using
95
- # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
- # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
- # the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
- # ) to obtain a formatter capable of generating timestamps in this format.
100
- # @!attribute [rw] seconds
101
- # @return [Integer]
102
- # Represents seconds of UTC time since Unix epoch
103
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
104
- # 9999-12-31T23:59:59Z inclusive.
105
- # @!attribute [rw] nanos
106
- # @return [Integer]
107
- # Non-negative fractions of a second at nanosecond resolution. Negative
108
- # second values with fractions must still have non-negative nanos values
109
- # that count forward in time. Must be from 0 to 999,999,999
110
- # inclusive.
111
- class Timestamp; end
112
- end
113
- end
@@ -1,39 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Rpc
18
- # The `Status` type defines a logical error model that is suitable for
19
- # different programming environments, including REST APIs and RPC APIs. It is
20
- # used by [gRPC](https://github.com/grpc). Each `Status` message contains
21
- # three pieces of data: error code, error message, and error details.
22
- #
23
- # You can find out more about this error model and how to work with it in the
24
- # [API Design Guide](https://cloud.google.com/apis/design/errors).
25
- # @!attribute [rw] code
26
- # @return [Integer]
27
- # The status code, which should be an enum value of {Google::Rpc::Code}.
28
- # @!attribute [rw] message
29
- # @return [String]
30
- # A developer-facing error message, which should be in English. Any
31
- # user-facing error message should be localized and sent in the
32
- # {Google::Rpc::Status#details} field, or localized by the client.
33
- # @!attribute [rw] details
34
- # @return [Array<Google::Protobuf::Any>]
35
- # A list of messages that carry the error details. There is a common set of
36
- # message types for APIs to use.
37
- class Status; end
38
- end
39
- end
@@ -1,606 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/monitoring/v3/group_service.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/monitoring/v3/group_service_pb"
29
- require "google/cloud/monitoring/v3/credentials"
30
- require "google/cloud/monitoring/version"
31
-
32
- module Google
33
- module Cloud
34
- module Monitoring
35
- module V3
36
- # The Group API lets you inspect and manage your
37
- # [groups](https://cloud.google.com#google.monitoring.v3.Group).
38
- #
39
- # A group is a named filter that is used to identify
40
- # a collection of monitored resources. Groups are typically used to
41
- # mirror the physical and/or logical topology of the environment.
42
- # Because group membership is computed dynamically, monitored
43
- # resources that are started in the future are automatically placed
44
- # in matching groups. By using a group to name monitored resources in,
45
- # for example, an alert policy, the target of that alert policy is
46
- # updated automatically as monitored resources are added and removed
47
- # from the infrastructure.
48
- #
49
- # @!attribute [r] group_service_stub
50
- # @return [Google::Monitoring::V3::GroupService::Stub]
51
- class GroupServiceClient
52
- # @private
53
- attr_reader :group_service_stub
54
-
55
- # The default address of the service.
56
- SERVICE_ADDRESS = "monitoring.googleapis.com".freeze
57
-
58
- # The default port of the service.
59
- DEFAULT_SERVICE_PORT = 443
60
-
61
- # The default set of gRPC interceptors.
62
- GRPC_INTERCEPTORS = []
63
-
64
- DEFAULT_TIMEOUT = 30
65
-
66
- PAGE_DESCRIPTORS = {
67
- "list_groups" => Google::Gax::PageDescriptor.new(
68
- "page_token",
69
- "next_page_token",
70
- "group"),
71
- "list_group_members" => Google::Gax::PageDescriptor.new(
72
- "page_token",
73
- "next_page_token",
74
- "members")
75
- }.freeze
76
-
77
- private_constant :PAGE_DESCRIPTORS
78
-
79
- # The scopes needed to make gRPC calls to all of the methods defined in
80
- # this service.
81
- ALL_SCOPES = [
82
- "https://www.googleapis.com/auth/cloud-platform",
83
- "https://www.googleapis.com/auth/monitoring",
84
- "https://www.googleapis.com/auth/monitoring.read",
85
- "https://www.googleapis.com/auth/monitoring.write"
86
- ].freeze
87
-
88
-
89
- GROUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
90
- "projects/{project}/groups/{group}"
91
- )
92
-
93
- private_constant :GROUP_PATH_TEMPLATE
94
-
95
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
- "projects/{project}"
97
- )
98
-
99
- private_constant :PROJECT_PATH_TEMPLATE
100
-
101
- # Returns a fully-qualified group resource name string.
102
- # @param project [String]
103
- # @param group [String]
104
- # @return [String]
105
- def self.group_path project, group
106
- GROUP_PATH_TEMPLATE.render(
107
- :"project" => project,
108
- :"group" => group
109
- )
110
- end
111
-
112
- # Returns a fully-qualified project resource name string.
113
- # @param project [String]
114
- # @return [String]
115
- def self.project_path project
116
- PROJECT_PATH_TEMPLATE.render(
117
- :"project" => project
118
- )
119
- end
120
-
121
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
122
- # Provides the means for authenticating requests made by the client. This parameter can
123
- # be many types.
124
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
125
- # authenticating requests made by this client.
126
- # A `String` will be treated as the path to the keyfile to be used for the construction of
127
- # credentials for this client.
128
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
129
- # credentials for this client.
130
- # A `GRPC::Core::Channel` will be used to make calls through.
131
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
132
- # should already be composed with a `GRPC::Core::CallCredentials` object.
133
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
134
- # metadata for requests, generally, to give OAuth credentials.
135
- # @param scopes [Array<String>]
136
- # The OAuth scopes for this service. This parameter is ignored if
137
- # an updater_proc is supplied.
138
- # @param client_config [Hash]
139
- # A Hash for call options for each method. See
140
- # Google::Gax#construct_settings for the structure of
141
- # this data. Falls back to the default config if not specified
142
- # or the specified config is missing data points.
143
- # @param timeout [Numeric]
144
- # The default timeout, in seconds, for calls made through this client.
145
- # @param metadata [Hash]
146
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
147
- # @param service_address [String]
148
- # Override for the service hostname, or `nil` to leave as the default.
149
- # @param service_port [Integer]
150
- # Override for the service port, or `nil` to leave as the default.
151
- # @param exception_transformer [Proc]
152
- # An optional proc that intercepts any exceptions raised during an API call to inject
153
- # custom error handling.
154
- def initialize \
155
- credentials: nil,
156
- scopes: ALL_SCOPES,
157
- client_config: {},
158
- timeout: DEFAULT_TIMEOUT,
159
- metadata: nil,
160
- service_address: nil,
161
- service_port: nil,
162
- exception_transformer: nil,
163
- lib_name: nil,
164
- lib_version: ""
165
- # These require statements are intentionally placed here to initialize
166
- # the gRPC module only when it's required.
167
- # See https://github.com/googleapis/toolkit/issues/446
168
- require "google/gax/grpc"
169
- require "google/monitoring/v3/group_service_services_pb"
170
-
171
- credentials ||= Google::Cloud::Monitoring::V3::Credentials.default
172
-
173
- if credentials.is_a?(String) || credentials.is_a?(Hash)
174
- updater_proc = Google::Cloud::Monitoring::V3::Credentials.new(credentials).updater_proc
175
- end
176
- if credentials.is_a?(GRPC::Core::Channel)
177
- channel = credentials
178
- end
179
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
180
- chan_creds = credentials
181
- end
182
- if credentials.is_a?(Proc)
183
- updater_proc = credentials
184
- end
185
- if credentials.is_a?(Google::Auth::Credentials)
186
- updater_proc = credentials.updater_proc
187
- end
188
-
189
- package_version = Google::Cloud::Monitoring::VERSION
190
-
191
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
192
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
193
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
194
- google_api_client << " grpc/#{GRPC::VERSION}"
195
- google_api_client.freeze
196
-
197
- headers = { :"x-goog-api-client" => google_api_client }
198
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
199
- headers[:"x-goog-user-project"] = credentials.quota_project_id
200
- end
201
- headers.merge!(metadata) unless metadata.nil?
202
- client_config_file = Pathname.new(__dir__).join(
203
- "group_service_client_config.json"
204
- )
205
- defaults = client_config_file.open do |f|
206
- Google::Gax.construct_settings(
207
- "google.monitoring.v3.GroupService",
208
- JSON.parse(f.read),
209
- client_config,
210
- Google::Gax::Grpc::STATUS_CODE_NAMES,
211
- timeout,
212
- page_descriptors: PAGE_DESCRIPTORS,
213
- errors: Google::Gax::Grpc::API_ERRORS,
214
- metadata: headers
215
- )
216
- end
217
-
218
- # Allow overriding the service path/port in subclasses.
219
- service_path = service_address || self.class::SERVICE_ADDRESS
220
- port = service_port || self.class::DEFAULT_SERVICE_PORT
221
- interceptors = self.class::GRPC_INTERCEPTORS
222
- @group_service_stub = Google::Gax::Grpc.create_stub(
223
- service_path,
224
- port,
225
- chan_creds: chan_creds,
226
- channel: channel,
227
- updater_proc: updater_proc,
228
- scopes: scopes,
229
- interceptors: interceptors,
230
- &Google::Monitoring::V3::GroupService::Stub.method(:new)
231
- )
232
-
233
- @list_groups = Google::Gax.create_api_call(
234
- @group_service_stub.method(:list_groups),
235
- defaults["list_groups"],
236
- exception_transformer: exception_transformer,
237
- params_extractor: proc do |request|
238
- {'name' => request.name}
239
- end
240
- )
241
- @get_group = Google::Gax.create_api_call(
242
- @group_service_stub.method(:get_group),
243
- defaults["get_group"],
244
- exception_transformer: exception_transformer,
245
- params_extractor: proc do |request|
246
- {'name' => request.name}
247
- end
248
- )
249
- @create_group = Google::Gax.create_api_call(
250
- @group_service_stub.method(:create_group),
251
- defaults["create_group"],
252
- exception_transformer: exception_transformer,
253
- params_extractor: proc do |request|
254
- {'name' => request.name}
255
- end
256
- )
257
- @update_group = Google::Gax.create_api_call(
258
- @group_service_stub.method(:update_group),
259
- defaults["update_group"],
260
- exception_transformer: exception_transformer,
261
- params_extractor: proc do |request|
262
- {'group.name' => request.group.name}
263
- end
264
- )
265
- @delete_group = Google::Gax.create_api_call(
266
- @group_service_stub.method(:delete_group),
267
- defaults["delete_group"],
268
- exception_transformer: exception_transformer,
269
- params_extractor: proc do |request|
270
- {'name' => request.name}
271
- end
272
- )
273
- @list_group_members = Google::Gax.create_api_call(
274
- @group_service_stub.method(:list_group_members),
275
- defaults["list_group_members"],
276
- exception_transformer: exception_transformer,
277
- params_extractor: proc do |request|
278
- {'name' => request.name}
279
- end
280
- )
281
- end
282
-
283
- # Service calls
284
-
285
- # Lists the existing groups.
286
- #
287
- # @param name [String]
288
- # Required. The project whose groups are to be listed. The format is:
289
- #
290
- # projects/[PROJECT_ID_OR_NUMBER]
291
- # @param children_of_group [String]
292
- # A group name. The format is:
293
- #
294
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
295
- #
296
- # Returns groups whose `parent_name` field contains the group
297
- # name. If no groups have this parent, the results are empty.
298
- # @param ancestors_of_group [String]
299
- # A group name. The format is:
300
- #
301
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
302
- #
303
- # Returns groups that are ancestors of the specified group.
304
- # The groups are returned in order, starting with the immediate parent and
305
- # ending with the most distant ancestor. If the specified group has no
306
- # immediate parent, the results are empty.
307
- # @param descendants_of_group [String]
308
- # A group name. The format is:
309
- #
310
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
311
- #
312
- # Returns the descendants of the specified group. This is a superset of
313
- # the results returned by the `children_of_group` filter, and includes
314
- # children-of-children, and so forth.
315
- # @param page_size [Integer]
316
- # The maximum number of resources contained in the underlying API
317
- # response. If page streaming is performed per-resource, this
318
- # parameter does not affect the return value. If page streaming is
319
- # performed per-page, this determines the maximum number of
320
- # resources in a page.
321
- # @param options [Google::Gax::CallOptions]
322
- # Overrides the default settings for this call, e.g, timeout,
323
- # retries, etc.
324
- # @yield [result, operation] Access the result along with the RPC operation
325
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Group>]
326
- # @yieldparam operation [GRPC::ActiveCall::Operation]
327
- # @return [Google::Gax::PagedEnumerable<Google::Monitoring::V3::Group>]
328
- # An enumerable of Google::Monitoring::V3::Group instances.
329
- # See Google::Gax::PagedEnumerable documentation for other
330
- # operations such as per-page iteration or access to the response
331
- # object.
332
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
333
- # @example
334
- # require "google/cloud/monitoring"
335
- #
336
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
337
- # formatted_name = Google::Cloud::Monitoring::V3::GroupServiceClient.project_path("[PROJECT]")
338
- #
339
- # # Iterate over all results.
340
- # group_client.list_groups(formatted_name).each do |element|
341
- # # Process element.
342
- # end
343
- #
344
- # # Or iterate over results one page at a time.
345
- # group_client.list_groups(formatted_name).each_page do |page|
346
- # # Process each page at a time.
347
- # page.each do |element|
348
- # # Process element.
349
- # end
350
- # end
351
-
352
- def list_groups \
353
- name,
354
- children_of_group: nil,
355
- ancestors_of_group: nil,
356
- descendants_of_group: nil,
357
- page_size: nil,
358
- options: nil,
359
- &block
360
- req = {
361
- name: name,
362
- children_of_group: children_of_group,
363
- ancestors_of_group: ancestors_of_group,
364
- descendants_of_group: descendants_of_group,
365
- page_size: page_size
366
- }.delete_if { |_, v| v.nil? }
367
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListGroupsRequest)
368
- @list_groups.call(req, options, &block)
369
- end
370
-
371
- # Gets a single group.
372
- #
373
- # @param name [String]
374
- # Required. The group to retrieve. The format is:
375
- #
376
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
377
- # @param options [Google::Gax::CallOptions]
378
- # Overrides the default settings for this call, e.g, timeout,
379
- # retries, etc.
380
- # @yield [result, operation] Access the result along with the RPC operation
381
- # @yieldparam result [Google::Monitoring::V3::Group]
382
- # @yieldparam operation [GRPC::ActiveCall::Operation]
383
- # @return [Google::Monitoring::V3::Group]
384
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
385
- # @example
386
- # require "google/cloud/monitoring"
387
- #
388
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
389
- # formatted_name = Google::Cloud::Monitoring::V3::GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
390
- # response = group_client.get_group(formatted_name)
391
-
392
- def get_group \
393
- name,
394
- options: nil,
395
- &block
396
- req = {
397
- name: name
398
- }.delete_if { |_, v| v.nil? }
399
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::GetGroupRequest)
400
- @get_group.call(req, options, &block)
401
- end
402
-
403
- # Creates a new group.
404
- #
405
- # @param name [String]
406
- # Required. The project in which to create the group. The format is:
407
- #
408
- # projects/[PROJECT_ID_OR_NUMBER]
409
- # @param group [Google::Monitoring::V3::Group | Hash]
410
- # Required. A group definition. It is an error to define the `name` field because
411
- # the system assigns the name.
412
- # A hash of the same form as `Google::Monitoring::V3::Group`
413
- # can also be provided.
414
- # @param validate_only [true, false]
415
- # If true, validate this request but do not create the group.
416
- # @param options [Google::Gax::CallOptions]
417
- # Overrides the default settings for this call, e.g, timeout,
418
- # retries, etc.
419
- # @yield [result, operation] Access the result along with the RPC operation
420
- # @yieldparam result [Google::Monitoring::V3::Group]
421
- # @yieldparam operation [GRPC::ActiveCall::Operation]
422
- # @return [Google::Monitoring::V3::Group]
423
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
424
- # @example
425
- # require "google/cloud/monitoring"
426
- #
427
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
428
- # formatted_name = Google::Cloud::Monitoring::V3::GroupServiceClient.project_path("[PROJECT]")
429
- #
430
- # # TODO: Initialize `group`:
431
- # group = {}
432
- # response = group_client.create_group(formatted_name, group)
433
-
434
- def create_group \
435
- name,
436
- group,
437
- validate_only: nil,
438
- options: nil,
439
- &block
440
- req = {
441
- name: name,
442
- group: group,
443
- validate_only: validate_only
444
- }.delete_if { |_, v| v.nil? }
445
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::CreateGroupRequest)
446
- @create_group.call(req, options, &block)
447
- end
448
-
449
- # Updates an existing group.
450
- # You can change any group attributes except `name`.
451
- #
452
- # @param group [Google::Monitoring::V3::Group | Hash]
453
- # Required. The new definition of the group. All fields of the existing group,
454
- # excepting `name`, are replaced with the corresponding fields of this group.
455
- # A hash of the same form as `Google::Monitoring::V3::Group`
456
- # can also be provided.
457
- # @param validate_only [true, false]
458
- # If true, validate this request but do not update the existing group.
459
- # @param options [Google::Gax::CallOptions]
460
- # Overrides the default settings for this call, e.g, timeout,
461
- # retries, etc.
462
- # @yield [result, operation] Access the result along with the RPC operation
463
- # @yieldparam result [Google::Monitoring::V3::Group]
464
- # @yieldparam operation [GRPC::ActiveCall::Operation]
465
- # @return [Google::Monitoring::V3::Group]
466
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
467
- # @example
468
- # require "google/cloud/monitoring"
469
- #
470
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
471
- #
472
- # # TODO: Initialize `group`:
473
- # group = {}
474
- # response = group_client.update_group(group)
475
-
476
- def update_group \
477
- group,
478
- validate_only: nil,
479
- options: nil,
480
- &block
481
- req = {
482
- group: group,
483
- validate_only: validate_only
484
- }.delete_if { |_, v| v.nil? }
485
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::UpdateGroupRequest)
486
- @update_group.call(req, options, &block)
487
- end
488
-
489
- # Deletes an existing group.
490
- #
491
- # @param name [String]
492
- # Required. The group to delete. The format is:
493
- #
494
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
495
- # @param recursive [true, false]
496
- # If this field is true, then the request means to delete a group with all
497
- # its descendants. Otherwise, the request means to delete a group only when
498
- # it has no descendants. The default value is false.
499
- # @param options [Google::Gax::CallOptions]
500
- # Overrides the default settings for this call, e.g, timeout,
501
- # retries, etc.
502
- # @yield [result, operation] Access the result along with the RPC operation
503
- # @yieldparam result []
504
- # @yieldparam operation [GRPC::ActiveCall::Operation]
505
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
506
- # @example
507
- # require "google/cloud/monitoring"
508
- #
509
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
510
- # formatted_name = Google::Cloud::Monitoring::V3::GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
511
- # group_client.delete_group(formatted_name)
512
-
513
- def delete_group \
514
- name,
515
- recursive: nil,
516
- options: nil,
517
- &block
518
- req = {
519
- name: name,
520
- recursive: recursive
521
- }.delete_if { |_, v| v.nil? }
522
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::DeleteGroupRequest)
523
- @delete_group.call(req, options, &block)
524
- nil
525
- end
526
-
527
- # Lists the monitored resources that are members of a group.
528
- #
529
- # @param name [String]
530
- # Required. The group whose members are listed. The format is:
531
- #
532
- # projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
533
- # @param page_size [Integer]
534
- # The maximum number of resources contained in the underlying API
535
- # response. If page streaming is performed per-resource, this
536
- # parameter does not affect the return value. If page streaming is
537
- # performed per-page, this determines the maximum number of
538
- # resources in a page.
539
- # @param filter [String]
540
- # An optional [list
541
- # filter](https://cloud.google.com/monitoring/api/learn_more#filtering)
542
- # describing the members to be returned. The filter may reference the type,
543
- # labels, and metadata of monitored resources that comprise the group. For
544
- # example, to return only resources representing Compute Engine VM instances,
545
- # use this filter:
546
- #
547
- # `resource.type = "gce_instance"`
548
- # @param interval [Google::Monitoring::V3::TimeInterval | Hash]
549
- # An optional time interval for which results should be returned. Only
550
- # members that were part of the group during the specified interval are
551
- # included in the response. If no interval is provided then the group
552
- # membership over the last minute is returned.
553
- # A hash of the same form as `Google::Monitoring::V3::TimeInterval`
554
- # can also be provided.
555
- # @param options [Google::Gax::CallOptions]
556
- # Overrides the default settings for this call, e.g, timeout,
557
- # retries, etc.
558
- # @yield [result, operation] Access the result along with the RPC operation
559
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Api::MonitoredResource>]
560
- # @yieldparam operation [GRPC::ActiveCall::Operation]
561
- # @return [Google::Gax::PagedEnumerable<Google::Api::MonitoredResource>]
562
- # An enumerable of Google::Api::MonitoredResource instances.
563
- # See Google::Gax::PagedEnumerable documentation for other
564
- # operations such as per-page iteration or access to the response
565
- # object.
566
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
567
- # @example
568
- # require "google/cloud/monitoring"
569
- #
570
- # group_client = Google::Cloud::Monitoring::Group.new(version: :v3)
571
- # formatted_name = Google::Cloud::Monitoring::V3::GroupServiceClient.group_path("[PROJECT]", "[GROUP]")
572
- #
573
- # # Iterate over all results.
574
- # group_client.list_group_members(formatted_name).each do |element|
575
- # # Process element.
576
- # end
577
- #
578
- # # Or iterate over results one page at a time.
579
- # group_client.list_group_members(formatted_name).each_page do |page|
580
- # # Process each page at a time.
581
- # page.each do |element|
582
- # # Process element.
583
- # end
584
- # end
585
-
586
- def list_group_members \
587
- name,
588
- page_size: nil,
589
- filter: nil,
590
- interval: nil,
591
- options: nil,
592
- &block
593
- req = {
594
- name: name,
595
- page_size: page_size,
596
- filter: filter,
597
- interval: interval
598
- }.delete_if { |_, v| v.nil? }
599
- req = Google::Gax::to_proto(req, Google::Monitoring::V3::ListGroupMembersRequest)
600
- @list_group_members.call(req, options, &block)
601
- end
602
- end
603
- end
604
- end
605
- end
606
- end