You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

10115 lines
398 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package monitoring provides access to the Stackdriver Monitoring API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/monitoring/apiv3 instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/monitoring/api/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/monitoring/v3"
  16. // ...
  17. // ctx := context.Background()
  18. // monitoringService, err := monitoring.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // monitoringService, err := monitoring.NewService(ctx, option.WithScopes(monitoring.MonitoringWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // monitoringService, err := monitoring.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // monitoringService, err := monitoring.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package monitoring // import "google.golang.org/api/monitoring/v3"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "monitoring:v3"
  73. const apiName = "monitoring"
  74. const apiVersion = "v3"
  75. const basePath = "https://monitoring.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View and write monitoring data for all of your Google and third-party
  81. // Cloud and API projects
  82. MonitoringScope = "https://www.googleapis.com/auth/monitoring"
  83. // View monitoring data for all of your Google Cloud and third-party
  84. // projects
  85. MonitoringReadScope = "https://www.googleapis.com/auth/monitoring.read"
  86. // Publish metric data to your Google Cloud projects
  87. MonitoringWriteScope = "https://www.googleapis.com/auth/monitoring.write"
  88. )
  89. // NewService creates a new Service.
  90. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  91. scopesOption := option.WithScopes(
  92. "https://www.googleapis.com/auth/cloud-platform",
  93. "https://www.googleapis.com/auth/monitoring",
  94. "https://www.googleapis.com/auth/monitoring.read",
  95. "https://www.googleapis.com/auth/monitoring.write",
  96. )
  97. // NOTE: prepend, so we don't override user-specified scopes.
  98. opts = append([]option.ClientOption{scopesOption}, opts...)
  99. client, endpoint, err := htransport.NewClient(ctx, opts...)
  100. if err != nil {
  101. return nil, err
  102. }
  103. s, err := New(client)
  104. if err != nil {
  105. return nil, err
  106. }
  107. if endpoint != "" {
  108. s.BasePath = endpoint
  109. }
  110. return s, nil
  111. }
  112. // New creates a new Service. It uses the provided http.Client for requests.
  113. //
  114. // Deprecated: please use NewService instead.
  115. // To provide a custom HTTP client, use option.WithHTTPClient.
  116. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  117. func New(client *http.Client) (*Service, error) {
  118. if client == nil {
  119. return nil, errors.New("client is nil")
  120. }
  121. s := &Service{client: client, BasePath: basePath}
  122. s.Projects = NewProjectsService(s)
  123. s.UptimeCheckIps = NewUptimeCheckIpsService(s)
  124. return s, nil
  125. }
  126. type Service struct {
  127. client *http.Client
  128. BasePath string // API endpoint base URL
  129. UserAgent string // optional additional User-Agent fragment
  130. Projects *ProjectsService
  131. UptimeCheckIps *UptimeCheckIpsService
  132. }
  133. func (s *Service) userAgent() string {
  134. if s.UserAgent == "" {
  135. return googleapi.UserAgent
  136. }
  137. return googleapi.UserAgent + " " + s.UserAgent
  138. }
  139. func NewProjectsService(s *Service) *ProjectsService {
  140. rs := &ProjectsService{s: s}
  141. rs.AlertPolicies = NewProjectsAlertPoliciesService(s)
  142. rs.CollectdTimeSeries = NewProjectsCollectdTimeSeriesService(s)
  143. rs.Groups = NewProjectsGroupsService(s)
  144. rs.MetricDescriptors = NewProjectsMetricDescriptorsService(s)
  145. rs.MonitoredResourceDescriptors = NewProjectsMonitoredResourceDescriptorsService(s)
  146. rs.NotificationChannelDescriptors = NewProjectsNotificationChannelDescriptorsService(s)
  147. rs.NotificationChannels = NewProjectsNotificationChannelsService(s)
  148. rs.TimeSeries = NewProjectsTimeSeriesService(s)
  149. rs.UptimeCheckConfigs = NewProjectsUptimeCheckConfigsService(s)
  150. return rs
  151. }
  152. type ProjectsService struct {
  153. s *Service
  154. AlertPolicies *ProjectsAlertPoliciesService
  155. CollectdTimeSeries *ProjectsCollectdTimeSeriesService
  156. Groups *ProjectsGroupsService
  157. MetricDescriptors *ProjectsMetricDescriptorsService
  158. MonitoredResourceDescriptors *ProjectsMonitoredResourceDescriptorsService
  159. NotificationChannelDescriptors *ProjectsNotificationChannelDescriptorsService
  160. NotificationChannels *ProjectsNotificationChannelsService
  161. TimeSeries *ProjectsTimeSeriesService
  162. UptimeCheckConfigs *ProjectsUptimeCheckConfigsService
  163. }
  164. func NewProjectsAlertPoliciesService(s *Service) *ProjectsAlertPoliciesService {
  165. rs := &ProjectsAlertPoliciesService{s: s}
  166. return rs
  167. }
  168. type ProjectsAlertPoliciesService struct {
  169. s *Service
  170. }
  171. func NewProjectsCollectdTimeSeriesService(s *Service) *ProjectsCollectdTimeSeriesService {
  172. rs := &ProjectsCollectdTimeSeriesService{s: s}
  173. return rs
  174. }
  175. type ProjectsCollectdTimeSeriesService struct {
  176. s *Service
  177. }
  178. func NewProjectsGroupsService(s *Service) *ProjectsGroupsService {
  179. rs := &ProjectsGroupsService{s: s}
  180. rs.Members = NewProjectsGroupsMembersService(s)
  181. return rs
  182. }
  183. type ProjectsGroupsService struct {
  184. s *Service
  185. Members *ProjectsGroupsMembersService
  186. }
  187. func NewProjectsGroupsMembersService(s *Service) *ProjectsGroupsMembersService {
  188. rs := &ProjectsGroupsMembersService{s: s}
  189. return rs
  190. }
  191. type ProjectsGroupsMembersService struct {
  192. s *Service
  193. }
  194. func NewProjectsMetricDescriptorsService(s *Service) *ProjectsMetricDescriptorsService {
  195. rs := &ProjectsMetricDescriptorsService{s: s}
  196. return rs
  197. }
  198. type ProjectsMetricDescriptorsService struct {
  199. s *Service
  200. }
  201. func NewProjectsMonitoredResourceDescriptorsService(s *Service) *ProjectsMonitoredResourceDescriptorsService {
  202. rs := &ProjectsMonitoredResourceDescriptorsService{s: s}
  203. return rs
  204. }
  205. type ProjectsMonitoredResourceDescriptorsService struct {
  206. s *Service
  207. }
  208. func NewProjectsNotificationChannelDescriptorsService(s *Service) *ProjectsNotificationChannelDescriptorsService {
  209. rs := &ProjectsNotificationChannelDescriptorsService{s: s}
  210. return rs
  211. }
  212. type ProjectsNotificationChannelDescriptorsService struct {
  213. s *Service
  214. }
  215. func NewProjectsNotificationChannelsService(s *Service) *ProjectsNotificationChannelsService {
  216. rs := &ProjectsNotificationChannelsService{s: s}
  217. return rs
  218. }
  219. type ProjectsNotificationChannelsService struct {
  220. s *Service
  221. }
  222. func NewProjectsTimeSeriesService(s *Service) *ProjectsTimeSeriesService {
  223. rs := &ProjectsTimeSeriesService{s: s}
  224. return rs
  225. }
  226. type ProjectsTimeSeriesService struct {
  227. s *Service
  228. }
  229. func NewProjectsUptimeCheckConfigsService(s *Service) *ProjectsUptimeCheckConfigsService {
  230. rs := &ProjectsUptimeCheckConfigsService{s: s}
  231. return rs
  232. }
  233. type ProjectsUptimeCheckConfigsService struct {
  234. s *Service
  235. }
  236. func NewUptimeCheckIpsService(s *Service) *UptimeCheckIpsService {
  237. rs := &UptimeCheckIpsService{s: s}
  238. return rs
  239. }
  240. type UptimeCheckIpsService struct {
  241. s *Service
  242. }
  243. // Aggregation: Describes how to combine multiple time series to provide
  244. // different views of the data. Aggregation consists of an alignment
  245. // step on individual time series (alignment_period and
  246. // per_series_aligner) followed by an optional reduction step of the
  247. // data across the aligned time series (cross_series_reducer and
  248. // group_by_fields). For more details, see Aggregation.
  249. type Aggregation struct {
  250. // AlignmentPeriod: The alignment period for per-time series alignment.
  251. // If present, alignmentPeriod must be at least 60 seconds. After
  252. // per-time series alignment, each time series will contain data points
  253. // only on the period boundaries. If perSeriesAligner is not specified
  254. // or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner
  255. // is specified and does not equal ALIGN_NONE, then this field must be
  256. // defined; otherwise an error is returned.
  257. AlignmentPeriod string `json:"alignmentPeriod,omitempty"`
  258. // CrossSeriesReducer: The approach to be used to combine time series.
  259. // Not all reducer functions may be applied to all time series,
  260. // depending on the metric type and the value type of the original time
  261. // series. Reduction may change the metric type of value type of the
  262. // time series.Time series data must be aligned in order to perform
  263. // cross-time series reduction. If crossSeriesReducer is specified, then
  264. // perSeriesAligner must be specified and not equal ALIGN_NONE and
  265. // alignmentPeriod must be specified; otherwise, an error is returned.
  266. //
  267. // Possible values:
  268. // "REDUCE_NONE" - No cross-time series reduction. The output of the
  269. // aligner is returned.
  270. // "REDUCE_MEAN" - Reduce by computing the mean across time series for
  271. // each alignment period. This reducer is valid for delta and gauge
  272. // metrics with numeric or distribution values. The value type of the
  273. // output is DOUBLE.
  274. // "REDUCE_MIN" - Reduce by computing the minimum across time series
  275. // for each alignment period. This reducer is valid for delta and gauge
  276. // metrics with numeric values. The value type of the output is the same
  277. // as the value type of the input.
  278. // "REDUCE_MAX" - Reduce by computing the maximum across time series
  279. // for each alignment period. This reducer is valid for delta and gauge
  280. // metrics with numeric values. The value type of the output is the same
  281. // as the value type of the input.
  282. // "REDUCE_SUM" - Reduce by computing the sum across time series for
  283. // each alignment period. This reducer is valid for delta and gauge
  284. // metrics with numeric and distribution values. The value type of the
  285. // output is the same as the value type of the input.
  286. // "REDUCE_STDDEV" - Reduce by computing the standard deviation across
  287. // time series for each alignment period. This reducer is valid for
  288. // delta and gauge metrics with numeric or distribution values. The
  289. // value type of the output is DOUBLE.
  290. // "REDUCE_COUNT" - Reduce by computing the count of data points
  291. // across time series for each alignment period. This reducer is valid
  292. // for delta and gauge metrics of numeric, Boolean, distribution, and
  293. // string value type. The value type of the output is INT64.
  294. // "REDUCE_COUNT_TRUE" - Reduce by computing the count of True-valued
  295. // data points across time series for each alignment period. This
  296. // reducer is valid for delta and gauge metrics of Boolean value type.
  297. // The value type of the output is INT64.
  298. // "REDUCE_COUNT_FALSE" - Reduce by computing the count of
  299. // False-valued data points across time series for each alignment
  300. // period. This reducer is valid for delta and gauge metrics of Boolean
  301. // value type. The value type of the output is INT64.
  302. // "REDUCE_FRACTION_TRUE" - Reduce by computing the fraction of
  303. // True-valued data points across time series for each alignment period.
  304. // This reducer is valid for delta and gauge metrics of Boolean value
  305. // type. The output value is in the range 0, 1 and has value type
  306. // DOUBLE.
  307. // "REDUCE_PERCENTILE_99" - Reduce by computing 99th percentile of
  308. // data points across time series for each alignment period. This
  309. // reducer is valid for gauge and delta metrics of numeric and
  310. // distribution type. The value of the output is DOUBLE
  311. // "REDUCE_PERCENTILE_95" - Reduce by computing 95th percentile of
  312. // data points across time series for each alignment period. This
  313. // reducer is valid for gauge and delta metrics of numeric and
  314. // distribution type. The value of the output is DOUBLE
  315. // "REDUCE_PERCENTILE_50" - Reduce by computing 50th percentile of
  316. // data points across time series for each alignment period. This
  317. // reducer is valid for gauge and delta metrics of numeric and
  318. // distribution type. The value of the output is DOUBLE
  319. // "REDUCE_PERCENTILE_05" - Reduce by computing 5th percentile of data
  320. // points across time series for each alignment period. This reducer is
  321. // valid for gauge and delta metrics of numeric and distribution type.
  322. // The value of the output is DOUBLE
  323. CrossSeriesReducer string `json:"crossSeriesReducer,omitempty"`
  324. // GroupByFields: The set of fields to preserve when crossSeriesReducer
  325. // is specified. The groupByFields determine how the time series are
  326. // partitioned into subsets prior to applying the aggregation function.
  327. // Each subset contains time series that have the same value for each of
  328. // the grouping fields. Each individual time series is a member of
  329. // exactly one subset. The crossSeriesReducer is applied to each subset
  330. // of time series. It is not possible to reduce across different
  331. // resource types, so this field implicitly contains resource.type.
  332. // Fields not specified in groupByFields are aggregated away. If
  333. // groupByFields is not specified and all the time series have the same
  334. // resource type, then the time series are aggregated into a single
  335. // output time series. If crossSeriesReducer is not defined, this field
  336. // is ignored.
  337. GroupByFields []string `json:"groupByFields,omitempty"`
  338. // PerSeriesAligner: The approach to be used to align individual time
  339. // series. Not all alignment functions may be applied to all time
  340. // series, depending on the metric type and value type of the original
  341. // time series. Alignment may change the metric type or the value type
  342. // of the time series.Time series data must be aligned in order to
  343. // perform cross-time series reduction. If crossSeriesReducer is
  344. // specified, then perSeriesAligner must be specified and not equal
  345. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  346. // is returned.
  347. //
  348. // Possible values:
  349. // "ALIGN_NONE" - No alignment. Raw data is returned. Not valid if
  350. // cross-time series reduction is requested. The value type of the
  351. // result is the same as the value type of the input.
  352. // "ALIGN_DELTA" - Align and convert to delta metric type. This
  353. // alignment is valid for cumulative metrics and delta metrics. Aligning
  354. // an existing delta metric to a delta metric requires that the
  355. // alignment period be increased. The value type of the result is the
  356. // same as the value type of the input.One can think of this aligner as
  357. // a rate but without time units; that is, the output is conceptually
  358. // (second_point - first_point).
  359. // "ALIGN_RATE" - Align and convert to a rate. This alignment is valid
  360. // for cumulative metrics and delta metrics with numeric values. The
  361. // output is a gauge metric with value type DOUBLE.One can think of this
  362. // aligner as conceptually providing the slope of the line that passes
  363. // through the value at the start and end of the window. In other words,
  364. // this is conceptually ((y1 - y0)/(t1 - t0)), and the output unit is
  365. // one that has a "/time" dimension.If, by rate, you are looking for
  366. // percentage change, see the ALIGN_PERCENT_CHANGE aligner option.
  367. // "ALIGN_INTERPOLATE" - Align by interpolating between adjacent
  368. // points around the period boundary. This alignment is valid for gauge
  369. // metrics with numeric values. The value type of the result is the same
  370. // as the value type of the input.
  371. // "ALIGN_NEXT_OLDER" - Align by shifting the oldest data point before
  372. // the period boundary to the boundary. This alignment is valid for
  373. // gauge metrics. The value type of the result is the same as the value
  374. // type of the input.
  375. // "ALIGN_MIN" - Align time series via aggregation. The resulting data
  376. // point in the alignment period is the minimum of all data points in
  377. // the period. This alignment is valid for gauge and delta metrics with
  378. // numeric values. The value type of the result is the same as the value
  379. // type of the input.
  380. // "ALIGN_MAX" - Align time series via aggregation. The resulting data
  381. // point in the alignment period is the maximum of all data points in
  382. // the period. This alignment is valid for gauge and delta metrics with
  383. // numeric values. The value type of the result is the same as the value
  384. // type of the input.
  385. // "ALIGN_MEAN" - Align time series via aggregation. The resulting
  386. // data point in the alignment period is the average or arithmetic mean
  387. // of all data points in the period. This alignment is valid for gauge
  388. // and delta metrics with numeric values. The value type of the output
  389. // is DOUBLE.
  390. // "ALIGN_COUNT" - Align time series via aggregation. The resulting
  391. // data point in the alignment period is the count of all data points in
  392. // the period. This alignment is valid for gauge and delta metrics with
  393. // numeric or Boolean values. The value type of the output is INT64.
  394. // "ALIGN_SUM" - Align time series via aggregation. The resulting data
  395. // point in the alignment period is the sum of all data points in the
  396. // period. This alignment is valid for gauge and delta metrics with
  397. // numeric and distribution values. The value type of the output is the
  398. // same as the value type of the input.
  399. // "ALIGN_STDDEV" - Align time series via aggregation. The resulting
  400. // data point in the alignment period is the standard deviation of all
  401. // data points in the period. This alignment is valid for gauge and
  402. // delta metrics with numeric values. The value type of the output is
  403. // DOUBLE.
  404. // "ALIGN_COUNT_TRUE" - Align time series via aggregation. The
  405. // resulting data point in the alignment period is the count of
  406. // True-valued data points in the period. This alignment is valid for
  407. // gauge metrics with Boolean values. The value type of the output is
  408. // INT64.
  409. // "ALIGN_COUNT_FALSE" - Align time series via aggregation. The
  410. // resulting data point in the alignment period is the count of
  411. // False-valued data points in the period. This alignment is valid for
  412. // gauge metrics with Boolean values. The value type of the output is
  413. // INT64.
  414. // "ALIGN_FRACTION_TRUE" - Align time series via aggregation. The
  415. // resulting data point in the alignment period is the fraction of
  416. // True-valued data points in the period. This alignment is valid for
  417. // gauge metrics with Boolean values. The output value is in the range
  418. // 0, 1 and has value type DOUBLE.
  419. // "ALIGN_PERCENTILE_99" - Align time series via aggregation. The
  420. // resulting data point in the alignment period is the 99th percentile
  421. // of all data points in the period. This alignment is valid for gauge
  422. // and delta metrics with distribution values. The output is a gauge
  423. // metric with value type DOUBLE.
  424. // "ALIGN_PERCENTILE_95" - Align time series via aggregation. The
  425. // resulting data point in the alignment period is the 95th percentile
  426. // of all data points in the period. This alignment is valid for gauge
  427. // and delta metrics with distribution values. The output is a gauge
  428. // metric with value type DOUBLE.
  429. // "ALIGN_PERCENTILE_50" - Align time series via aggregation. The
  430. // resulting data point in the alignment period is the 50th percentile
  431. // of all data points in the period. This alignment is valid for gauge
  432. // and delta metrics with distribution values. The output is a gauge
  433. // metric with value type DOUBLE.
  434. // "ALIGN_PERCENTILE_05" - Align time series via aggregation. The
  435. // resulting data point in the alignment period is the 5th percentile of
  436. // all data points in the period. This alignment is valid for gauge and
  437. // delta metrics with distribution values. The output is a gauge metric
  438. // with value type DOUBLE.
  439. // "ALIGN_PERCENT_CHANGE" - Align and convert to a percentage change.
  440. // This alignment is valid for gauge and delta metrics with numeric
  441. // values. This alignment conceptually computes the equivalent of
  442. // "((current - previous)/previous)*100" where previous value is
  443. // determined based on the alignmentPeriod. In the event that previous
  444. // is 0 the calculated value is infinity with the exception that if both
  445. // (current - previous) and previous are 0 the calculated value is 0. A
  446. // 10 minute moving mean is computed at each point of the time window
  447. // prior to the above calculation to smooth the metric and prevent false
  448. // positives from very short lived spikes. Only applicable for data that
  449. // is >= 0. Any values < 0 are treated as no data. While delta metrics
  450. // are accepted by this alignment special care should be taken that the
  451. // values for the metric will always be positive. The output is a gauge
  452. // metric with value type DOUBLE.
  453. PerSeriesAligner string `json:"perSeriesAligner,omitempty"`
  454. // ForceSendFields is a list of field names (e.g. "AlignmentPeriod") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. // NullFields is a list of field names (e.g. "AlignmentPeriod") to
  462. // include in API requests with the JSON null value. By default, fields
  463. // with empty values are omitted from API requests. However, any field
  464. // with an empty value appearing in NullFields will be sent to the
  465. // server as null. It is an error if a field in this list has a
  466. // non-empty value. This may be used to include null fields in Patch
  467. // requests.
  468. NullFields []string `json:"-"`
  469. }
  470. func (s *Aggregation) MarshalJSON() ([]byte, error) {
  471. type NoMethod Aggregation
  472. raw := NoMethod(*s)
  473. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  474. }
  475. // AlertPolicy: A description of the conditions under which some aspect
  476. // of your system is considered to be "unhealthy" and the ways to notify
  477. // people or services about this state. For an overview of alert
  478. // policies, see Introduction to Alerting.
  479. type AlertPolicy struct {
  480. // Combiner: How to combine the results of multiple conditions to
  481. // determine if an incident should be opened.
  482. //
  483. // Possible values:
  484. // "COMBINE_UNSPECIFIED" - An unspecified combiner.
  485. // "AND" - Combine conditions using the logical AND operator. An
  486. // incident is created only if all conditions are met simultaneously.
  487. // This combiner is satisfied if all conditions are met, even if they
  488. // are met on completely different resources.
  489. // "OR" - Combine conditions using the logical OR operator. An
  490. // incident is created if any of the listed conditions is met.
  491. // "AND_WITH_MATCHING_RESOURCE" - Combine conditions using logical AND
  492. // operator, but unlike the regular AND option, an incident is created
  493. // only if all conditions are met simultaneously on at least one
  494. // resource.
  495. Combiner string `json:"combiner,omitempty"`
  496. // Conditions: A list of conditions for the policy. The conditions are
  497. // combined by AND or OR according to the combiner field. If the
  498. // combined conditions evaluate to true, then an incident is created. A
  499. // policy can have from one to six conditions.
  500. Conditions []*Condition `json:"conditions,omitempty"`
  501. // CreationRecord: A read-only record of the creation of the alerting
  502. // policy. If provided in a call to create or update, this field will be
  503. // ignored.
  504. CreationRecord *MutationRecord `json:"creationRecord,omitempty"`
  505. // DisplayName: A short name or phrase used to identify the policy in
  506. // dashboards, notifications, and incidents. To avoid confusion, don't
  507. // use the same display name for multiple policies in the same project.
  508. // The name is limited to 512 Unicode characters.
  509. DisplayName string `json:"displayName,omitempty"`
  510. // Documentation: Documentation that is included with notifications and
  511. // incidents related to this policy. Best practice is for the
  512. // documentation to include information to help responders understand,
  513. // mitigate, escalate, and correct the underlying problems detected by
  514. // the alerting policy. Notification channels that have limited capacity
  515. // might not show this documentation.
  516. Documentation *Documentation `json:"documentation,omitempty"`
  517. // Enabled: Whether or not the policy is enabled. On write, the default
  518. // interpretation if unset is that the policy is enabled. On read,
  519. // clients should not make any assumption about the state if it has not
  520. // been populated. The field should always be populated on List and Get
  521. // operations, unless a field projection has been specified that strips
  522. // it out.
  523. Enabled bool `json:"enabled,omitempty"`
  524. // MutationRecord: A read-only record of the most recent change to the
  525. // alerting policy. If provided in a call to create or update, this
  526. // field will be ignored.
  527. MutationRecord *MutationRecord `json:"mutationRecord,omitempty"`
  528. // Name: Required if the policy exists. The resource name for this
  529. // policy. The syntax
  530. // is:
  531. // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
  532. // [ALERT_POLIC
  533. // Y_ID] is assigned by Stackdriver Monitoring when the policy is
  534. // created. When calling the alertPolicies.create method, do not include
  535. // the name field in the alerting policy passed as part of the request.
  536. Name string `json:"name,omitempty"`
  537. // NotificationChannels: Identifies the notification channels to which
  538. // notifications should be sent when incidents are opened or closed or
  539. // when new violations occur on an already opened incident. Each element
  540. // of this array corresponds to the name field in each of the
  541. // NotificationChannel objects that are returned from the
  542. // ListNotificationChannels method. The syntax of the entries in this
  543. // field is:
  544. // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
  545. //
  546. NotificationChannels []string `json:"notificationChannels,omitempty"`
  547. // UserLabels: User-supplied key/value data to be used for organizing
  548. // and identifying the AlertPolicy objects.The field can contain up to
  549. // 64 entries. Each key and value is limited to 63 Unicode characters or
  550. // 128 bytes, whichever is smaller. Labels and values can contain only
  551. // lowercase letters, numerals, underscores, and dashes. Keys must begin
  552. // with a letter.
  553. UserLabels map[string]string `json:"userLabels,omitempty"`
  554. // ServerResponse contains the HTTP response code and headers from the
  555. // server.
  556. googleapi.ServerResponse `json:"-"`
  557. // ForceSendFields is a list of field names (e.g. "Combiner") to
  558. // unconditionally include in API requests. By default, fields with
  559. // empty values are omitted from API requests. However, any non-pointer,
  560. // non-interface field appearing in ForceSendFields will be sent to the
  561. // server regardless of whether the field is empty or not. This may be
  562. // used to include empty fields in Patch requests.
  563. ForceSendFields []string `json:"-"`
  564. // NullFields is a list of field names (e.g. "Combiner") to include in
  565. // API requests with the JSON null value. By default, fields with empty
  566. // values are omitted from API requests. However, any field with an
  567. // empty value appearing in NullFields will be sent to the server as
  568. // null. It is an error if a field in this list has a non-empty value.
  569. // This may be used to include null fields in Patch requests.
  570. NullFields []string `json:"-"`
  571. }
  572. func (s *AlertPolicy) MarshalJSON() ([]byte, error) {
  573. type NoMethod AlertPolicy
  574. raw := NoMethod(*s)
  575. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  576. }
  577. // BasicAuthentication: A type of authentication to perform against the
  578. // specified resource or URL that uses username and password. Currently,
  579. // only Basic authentication is supported in Uptime Monitoring.
  580. type BasicAuthentication struct {
  581. // Password: The password to authenticate.
  582. Password string `json:"password,omitempty"`
  583. // Username: The username to authenticate.
  584. Username string `json:"username,omitempty"`
  585. // ForceSendFields is a list of field names (e.g. "Password") to
  586. // unconditionally include in API requests. By default, fields with
  587. // empty values are omitted from API requests. However, any non-pointer,
  588. // non-interface field appearing in ForceSendFields will be sent to the
  589. // server regardless of whether the field is empty or not. This may be
  590. // used to include empty fields in Patch requests.
  591. ForceSendFields []string `json:"-"`
  592. // NullFields is a list of field names (e.g. "Password") to include in
  593. // API requests with the JSON null value. By default, fields with empty
  594. // values are omitted from API requests. However, any field with an
  595. // empty value appearing in NullFields will be sent to the server as
  596. // null. It is an error if a field in this list has a non-empty value.
  597. // This may be used to include null fields in Patch requests.
  598. NullFields []string `json:"-"`
  599. }
  600. func (s *BasicAuthentication) MarshalJSON() ([]byte, error) {
  601. type NoMethod BasicAuthentication
  602. raw := NoMethod(*s)
  603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  604. }
  605. // BucketOptions: BucketOptions describes the bucket boundaries used to
  606. // create a histogram for the distribution. The buckets can be in a
  607. // linear sequence, an exponential sequence, or each bucket can be
  608. // specified explicitly. BucketOptions does not include the number of
  609. // values in each bucket.A bucket has an inclusive lower bound and
  610. // exclusive upper bound for the values that are counted for that
  611. // bucket. The upper bound of a bucket must be strictly greater than the
  612. // lower bound. The sequence of N buckets for a distribution consists of
  613. // an underflow bucket (number 0), zero or more finite buckets (number 1
  614. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  615. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  616. // upper bound of bucket i - 1. The buckets span the whole range of
  617. // finite values: lower bound of the underflow bucket is -infinity and
  618. // the upper bound of the overflow bucket is +infinity. The finite
  619. // buckets are so-called because both bounds are finite.
  620. type BucketOptions struct {
  621. // ExplicitBuckets: The explicit buckets.
  622. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  623. // ExponentialBuckets: The exponential buckets.
  624. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  625. // LinearBuckets: The linear bucket.
  626. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  627. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  628. // unconditionally include in API requests. By default, fields with
  629. // empty values are omitted from API requests. However, any non-pointer,
  630. // non-interface field appearing in ForceSendFields will be sent to the
  631. // server regardless of whether the field is empty or not. This may be
  632. // used to include empty fields in Patch requests.
  633. ForceSendFields []string `json:"-"`
  634. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  635. // include in API requests with the JSON null value. By default, fields
  636. // with empty values are omitted from API requests. However, any field
  637. // with an empty value appearing in NullFields will be sent to the
  638. // server as null. It is an error if a field in this list has a
  639. // non-empty value. This may be used to include null fields in Patch
  640. // requests.
  641. NullFields []string `json:"-"`
  642. }
  643. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  644. type NoMethod BucketOptions
  645. raw := NoMethod(*s)
  646. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  647. }
  648. // CollectdPayload: A collection of data points sent from a
  649. // collectd-based plugin. See the collectd documentation for more
  650. // information.
  651. type CollectdPayload struct {
  652. // EndTime: The end time of the interval.
  653. EndTime string `json:"endTime,omitempty"`
  654. // Metadata: The measurement metadata. Example: "process_id" -> 12345
  655. Metadata map[string]TypedValue `json:"metadata,omitempty"`
  656. // Plugin: The name of the plugin. Example: "disk".
  657. Plugin string `json:"plugin,omitempty"`
  658. // PluginInstance: The instance name of the plugin Example: "hdcl".
  659. PluginInstance string `json:"pluginInstance,omitempty"`
  660. // StartTime: The start time of the interval.
  661. StartTime string `json:"startTime,omitempty"`
  662. // Type: The measurement type. Example: "memory".
  663. Type string `json:"type,omitempty"`
  664. // TypeInstance: The measurement type instance. Example: "used".
  665. TypeInstance string `json:"typeInstance,omitempty"`
  666. // Values: The measured values during this time interval. Each value
  667. // must have a different dataSourceName.
  668. Values []*CollectdValue `json:"values,omitempty"`
  669. // ForceSendFields is a list of field names (e.g. "EndTime") to
  670. // unconditionally include in API requests. By default, fields with
  671. // empty values are omitted from API requests. However, any non-pointer,
  672. // non-interface field appearing in ForceSendFields will be sent to the
  673. // server regardless of whether the field is empty or not. This may be
  674. // used to include empty fields in Patch requests.
  675. ForceSendFields []string `json:"-"`
  676. // NullFields is a list of field names (e.g. "EndTime") to include in
  677. // API requests with the JSON null value. By default, fields with empty
  678. // values are omitted from API requests. However, any field with an
  679. // empty value appearing in NullFields will be sent to the server as
  680. // null. It is an error if a field in this list has a non-empty value.
  681. // This may be used to include null fields in Patch requests.
  682. NullFields []string `json:"-"`
  683. }
  684. func (s *CollectdPayload) MarshalJSON() ([]byte, error) {
  685. type NoMethod CollectdPayload
  686. raw := NoMethod(*s)
  687. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  688. }
  689. // CollectdPayloadError: Describes the error status for payloads that
  690. // were not written.
  691. type CollectdPayloadError struct {
  692. // Error: Records the error status for the payload. If this field is
  693. // present, the partial errors for nested values won't be populated.
  694. Error *Status `json:"error,omitempty"`
  695. // Index: The zero-based index in
  696. // CreateCollectdTimeSeriesRequest.collectd_payloads.
  697. Index int64 `json:"index,omitempty"`
  698. // ValueErrors: Records the error status for values that were not
  699. // written due to an error.Failed payloads for which nothing is written
  700. // will not include partial value errors.
  701. ValueErrors []*CollectdValueError `json:"valueErrors,omitempty"`
  702. // ForceSendFields is a list of field names (e.g. "Error") to
  703. // unconditionally include in API requests. By default, fields with
  704. // empty values are omitted from API requests. However, any non-pointer,
  705. // non-interface field appearing in ForceSendFields will be sent to the
  706. // server regardless of whether the field is empty or not. This may be
  707. // used to include empty fields in Patch requests.
  708. ForceSendFields []string `json:"-"`
  709. // NullFields is a list of field names (e.g. "Error") to include in API
  710. // requests with the JSON null value. By default, fields with empty
  711. // values are omitted from API requests. However, any field with an
  712. // empty value appearing in NullFields will be sent to the server as
  713. // null. It is an error if a field in this list has a non-empty value.
  714. // This may be used to include null fields in Patch requests.
  715. NullFields []string `json:"-"`
  716. }
  717. func (s *CollectdPayloadError) MarshalJSON() ([]byte, error) {
  718. type NoMethod CollectdPayloadError
  719. raw := NoMethod(*s)
  720. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  721. }
  722. // CollectdValue: A single data point from a collectd-based plugin.
  723. type CollectdValue struct {
  724. // DataSourceName: The data source for the collectd value. For example
  725. // there are two data sources for network measurements: "rx" and "tx".
  726. DataSourceName string `json:"dataSourceName,omitempty"`
  727. // DataSourceType: The type of measurement.
  728. //
  729. // Possible values:
  730. // "UNSPECIFIED_DATA_SOURCE_TYPE" - An unspecified data source type.
  731. // This corresponds to
  732. // google.api.MetricDescriptor.MetricKind.METRIC_KIND_UNSPECIFIED.
  733. // "GAUGE" - An instantaneous measurement of a varying quantity. This
  734. // corresponds to google.api.MetricDescriptor.MetricKind.GAUGE.
  735. // "COUNTER" - A cumulative value over time. This corresponds to
  736. // google.api.MetricDescriptor.MetricKind.CUMULATIVE.
  737. // "DERIVE" - A rate of change of the measurement.
  738. // "ABSOLUTE" - An amount of change since the last measurement
  739. // interval. This corresponds to
  740. // google.api.MetricDescriptor.MetricKind.DELTA.
  741. DataSourceType string `json:"dataSourceType,omitempty"`
  742. // Value: The measurement value.
  743. Value *TypedValue `json:"value,omitempty"`
  744. // ForceSendFields is a list of field names (e.g. "DataSourceName") to
  745. // unconditionally include in API requests. By default, fields with
  746. // empty values are omitted from API requests. However, any non-pointer,
  747. // non-interface field appearing in ForceSendFields will be sent to the
  748. // server regardless of whether the field is empty or not. This may be
  749. // used to include empty fields in Patch requests.
  750. ForceSendFields []string `json:"-"`
  751. // NullFields is a list of field names (e.g. "DataSourceName") to
  752. // include in API requests with the JSON null value. By default, fields
  753. // with empty values are omitted from API requests. However, any field
  754. // with an empty value appearing in NullFields will be sent to the
  755. // server as null. It is an error if a field in this list has a
  756. // non-empty value. This may be used to include null fields in Patch
  757. // requests.
  758. NullFields []string `json:"-"`
  759. }
  760. func (s *CollectdValue) MarshalJSON() ([]byte, error) {
  761. type NoMethod CollectdValue
  762. raw := NoMethod(*s)
  763. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  764. }
  765. // CollectdValueError: Describes the error status for values that were
  766. // not written.
  767. type CollectdValueError struct {
  768. // Error: Records the error status for the value.
  769. Error *Status `json:"error,omitempty"`
  770. // Index: The zero-based index in CollectdPayload.values within the
  771. // parent CreateCollectdTimeSeriesRequest.collectd_payloads.
  772. Index int64 `json:"index,omitempty"`
  773. // ForceSendFields is a list of field names (e.g. "Error") to
  774. // unconditionally include in API requests. By default, fields with
  775. // empty values are omitted from API requests. However, any non-pointer,
  776. // non-interface field appearing in ForceSendFields will be sent to the
  777. // server regardless of whether the field is empty or not. This may be
  778. // used to include empty fields in Patch requests.
  779. ForceSendFields []string `json:"-"`
  780. // NullFields is a list of field names (e.g. "Error") to include in API
  781. // requests with the JSON null value. By default, fields with empty
  782. // values are omitted from API requests. However, any field with an
  783. // empty value appearing in NullFields will be sent to the server as
  784. // null. It is an error if a field in this list has a non-empty value.
  785. // This may be used to include null fields in Patch requests.
  786. NullFields []string `json:"-"`
  787. }
  788. func (s *CollectdValueError) MarshalJSON() ([]byte, error) {
  789. type NoMethod CollectdValueError
  790. raw := NoMethod(*s)
  791. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  792. }
  793. // Condition: A condition is a true/false test that determines when an
  794. // alerting policy should open an incident. If a condition evaluates to
  795. // true, it signifies that something is wrong.
  796. type Condition struct {
  797. // ConditionAbsent: A condition that checks that a time series continues
  798. // to receive new data points.
  799. ConditionAbsent *MetricAbsence `json:"conditionAbsent,omitempty"`
  800. // ConditionThreshold: A condition that compares a time series against a
  801. // threshold.
  802. ConditionThreshold *MetricThreshold `json:"conditionThreshold,omitempty"`
  803. // DisplayName: A short name or phrase used to identify the condition in
  804. // dashboards, notifications, and incidents. To avoid confusion, don't
  805. // use the same display name for multiple conditions in the same policy.
  806. DisplayName string `json:"displayName,omitempty"`
  807. // Name: Required if the condition exists. The unique resource name for
  808. // this condition. Its syntax
  809. // is:
  810. // projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDIT
  811. // ION_ID]
  812. // [CONDITION_ID] is assigned by Stackdriver Monitoring when the
  813. // condition is created as part of a new or updated alerting policy.When
  814. // calling the alertPolicies.create method, do not include the name
  815. // field in the conditions of the requested alerting policy. Stackdriver
  816. // Monitoring creates the condition identifiers and includes them in the
  817. // new policy.When calling the alertPolicies.update method to update a
  818. // policy, including a condition name causes the existing condition to
  819. // be updated. Conditions without names are added to the updated policy.
  820. // Existing conditions are deleted if they are not updated.Best practice
  821. // is to preserve [CONDITION_ID] if you make only small changes, such as
  822. // those to condition thresholds, durations, or trigger values.
  823. // Otherwise, treat the change as a new condition and let the existing
  824. // condition be deleted.
  825. Name string `json:"name,omitempty"`
  826. // ForceSendFields is a list of field names (e.g. "ConditionAbsent") to
  827. // unconditionally include in API requests. By default, fields with
  828. // empty values are omitted from API requests. However, any non-pointer,
  829. // non-interface field appearing in ForceSendFields will be sent to the
  830. // server regardless of whether the field is empty or not. This may be
  831. // used to include empty fields in Patch requests.
  832. ForceSendFields []string `json:"-"`
  833. // NullFields is a list of field names (e.g. "ConditionAbsent") to
  834. // include in API requests with the JSON null value. By default, fields
  835. // with empty values are omitted from API requests. However, any field
  836. // with an empty value appearing in NullFields will be sent to the
  837. // server as null. It is an error if a field in this list has a
  838. // non-empty value. This may be used to include null fields in Patch
  839. // requests.
  840. NullFields []string `json:"-"`
  841. }
  842. func (s *Condition) MarshalJSON() ([]byte, error) {
  843. type NoMethod Condition
  844. raw := NoMethod(*s)
  845. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  846. }
  847. // ContentMatcher: Used to perform string matching. It allows substring
  848. // and regular expressions, together with their negations.
  849. type ContentMatcher struct {
  850. // Content: String or regex content to match (max 1024 bytes)
  851. Content string `json:"content,omitempty"`
  852. // ForceSendFields is a list of field names (e.g. "Content") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. // NullFields is a list of field names (e.g. "Content") to include in
  860. // API requests with the JSON null value. By default, fields with empty
  861. // values are omitted from API requests. However, any field with an
  862. // empty value appearing in NullFields will be sent to the server as
  863. // null. It is an error if a field in this list has a non-empty value.
  864. // This may be used to include null fields in Patch requests.
  865. NullFields []string `json:"-"`
  866. }
  867. func (s *ContentMatcher) MarshalJSON() ([]byte, error) {
  868. type NoMethod ContentMatcher
  869. raw := NoMethod(*s)
  870. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  871. }
  872. // CreateCollectdTimeSeriesRequest: The CreateCollectdTimeSeries
  873. // request.
  874. type CreateCollectdTimeSeriesRequest struct {
  875. // CollectdPayloads: The collectd payloads representing the time series
  876. // data. You must not include more than a single point for each time
  877. // series, so no two payloads can have the same values for all of the
  878. // fields plugin, plugin_instance, type, and type_instance.
  879. CollectdPayloads []*CollectdPayload `json:"collectdPayloads,omitempty"`
  880. // CollectdVersion: The version of collectd that collected the data.
  881. // Example: "5.3.0-192.el6".
  882. CollectdVersion string `json:"collectdVersion,omitempty"`
  883. // Resource: The monitored resource associated with the time series.
  884. Resource *MonitoredResource `json:"resource,omitempty"`
  885. // ForceSendFields is a list of field names (e.g. "CollectdPayloads") to
  886. // unconditionally include in API requests. By default, fields with
  887. // empty values are omitted from API requests. However, any non-pointer,
  888. // non-interface field appearing in ForceSendFields will be sent to the
  889. // server regardless of whether the field is empty or not. This may be
  890. // used to include empty fields in Patch requests.
  891. ForceSendFields []string `json:"-"`
  892. // NullFields is a list of field names (e.g. "CollectdPayloads") to
  893. // include in API requests with the JSON null value. By default, fields
  894. // with empty values are omitted from API requests. However, any field
  895. // with an empty value appearing in NullFields will be sent to the
  896. // server as null. It is an error if a field in this list has a
  897. // non-empty value. This may be used to include null fields in Patch
  898. // requests.
  899. NullFields []string `json:"-"`
  900. }
  901. func (s *CreateCollectdTimeSeriesRequest) MarshalJSON() ([]byte, error) {
  902. type NoMethod CreateCollectdTimeSeriesRequest
  903. raw := NoMethod(*s)
  904. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  905. }
  906. // CreateCollectdTimeSeriesResponse: The CreateCollectdTimeSeries
  907. // response.
  908. type CreateCollectdTimeSeriesResponse struct {
  909. // PayloadErrors: Records the error status for points that were not
  910. // written due to an error.Failed requests for which nothing is written
  911. // will return an error response instead.
  912. PayloadErrors []*CollectdPayloadError `json:"payloadErrors,omitempty"`
  913. // ServerResponse contains the HTTP response code and headers from the
  914. // server.
  915. googleapi.ServerResponse `json:"-"`
  916. // ForceSendFields is a list of field names (e.g. "PayloadErrors") to
  917. // unconditionally include in API requests. By default, fields with
  918. // empty values are omitted from API requests. However, any non-pointer,
  919. // non-interface field appearing in ForceSendFields will be sent to the
  920. // server regardless of whether the field is empty or not. This may be
  921. // used to include empty fields in Patch requests.
  922. ForceSendFields []string `json:"-"`
  923. // NullFields is a list of field names (e.g. "PayloadErrors") to include
  924. // in API requests with the JSON null value. By default, fields with
  925. // empty values are omitted from API requests. However, any field with
  926. // an empty value appearing in NullFields will be sent to the server as
  927. // null. It is an error if a field in this list has a non-empty value.
  928. // This may be used to include null fields in Patch requests.
  929. NullFields []string `json:"-"`
  930. }
  931. func (s *CreateCollectdTimeSeriesResponse) MarshalJSON() ([]byte, error) {
  932. type NoMethod CreateCollectdTimeSeriesResponse
  933. raw := NoMethod(*s)
  934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  935. }
  936. // CreateTimeSeriesRequest: The CreateTimeSeries request.
  937. type CreateTimeSeriesRequest struct {
  938. // TimeSeries: The new data to be added to a list of time series. Adds
  939. // at most one data point to each of several time series. The new data
  940. // point must be more recent than any other point in its time series.
  941. // Each TimeSeries value must fully specify a unique time series by
  942. // supplying all label values for the metric and the monitored
  943. // resource.The maximum number of TimeSeries objects per Create request
  944. // is 200.
  945. TimeSeries []*TimeSeries `json:"timeSeries,omitempty"`
  946. // ForceSendFields is a list of field names (e.g. "TimeSeries") to
  947. // unconditionally include in API requests. By default, fields with
  948. // empty values are omitted from API requests. However, any non-pointer,
  949. // non-interface field appearing in ForceSendFields will be sent to the
  950. // server regardless of whether the field is empty or not. This may be
  951. // used to include empty fields in Patch requests.
  952. ForceSendFields []string `json:"-"`
  953. // NullFields is a list of field names (e.g. "TimeSeries") to include in
  954. // API requests with the JSON null value. By default, fields with empty
  955. // values are omitted from API requests. However, any field with an
  956. // empty value appearing in NullFields will be sent to the server as
  957. // null. It is an error if a field in this list has a non-empty value.
  958. // This may be used to include null fields in Patch requests.
  959. NullFields []string `json:"-"`
  960. }
  961. func (s *CreateTimeSeriesRequest) MarshalJSON() ([]byte, error) {
  962. type NoMethod CreateTimeSeriesRequest
  963. raw := NoMethod(*s)
  964. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  965. }
  966. // Distribution: Distribution contains summary statistics for a
  967. // population of values. It optionally contains a histogram representing
  968. // the distribution of those values across a set of buckets.The summary
  969. // statistics are the count, mean, sum of the squared deviation from the
  970. // mean, the minimum, and the maximum of the set of population of
  971. // values. The histogram is based on a sequence of buckets and gives a
  972. // count of values that fall into each bucket. The boundaries of the
  973. // buckets are given either explicitly or by formulas for buckets of
  974. // fixed or exponentially increasing widths.Although it is not
  975. // forbidden, it is generally a bad idea to include non-finite values
  976. // (infinities or NaNs) in the population of values, as this will render
  977. // the mean and sum_of_squared_deviation fields meaningless.
  978. type Distribution struct {
  979. // BucketCounts: Required in the Stackdriver Monitoring API v3. The
  980. // values for each bucket specified in bucket_options. The sum of the
  981. // values in bucketCounts must equal the value in the count field of the
  982. // Distribution object. The order of the bucket counts follows the
  983. // numbering schemes described for the three bucket types. The underflow
  984. // bucket has number 0; the finite buckets, if any, have numbers 1
  985. // through N-2; and the overflow bucket has number N-1. The size of
  986. // bucket_counts must not be greater than N. If the size is less than N,
  987. // then the remaining buckets are assigned values of zero.
  988. BucketCounts googleapi.Int64s `json:"bucketCounts,omitempty"`
  989. // BucketOptions: Required in the Stackdriver Monitoring API v3. Defines
  990. // the histogram bucket boundaries.
  991. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  992. // Count: The number of values in the population. Must be non-negative.
  993. // This value must equal the sum of the values in bucket_counts if a
  994. // histogram is provided.
  995. Count int64 `json:"count,omitempty,string"`
  996. // Exemplars: Must be in increasing order of value field.
  997. Exemplars []*Exemplar `json:"exemplars,omitempty"`
  998. // Mean: The arithmetic mean of the values in the population. If count
  999. // is zero then this field must be zero.
  1000. Mean float64 `json:"mean,omitempty"`
  1001. // Range: If specified, contains the range of the population values. The
  1002. // field must not be present if the count is zero. This field is
  1003. // presently ignored by the Stackdriver Monitoring API v3.
  1004. Range *Range `json:"range,omitempty"`
  1005. // SumOfSquaredDeviation: The sum of squared deviations from the mean of
  1006. // the values in the population. For values x_i this
  1007. // is:
  1008. // Sum[i=1..n]((x_i - mean)^2)
  1009. // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd
  1010. // edition describes Welford's method for accumulating this sum in one
  1011. // pass.If count is zero then this field must be zero.
  1012. SumOfSquaredDeviation float64 `json:"sumOfSquaredDeviation,omitempty"`
  1013. // ForceSendFields is a list of field names (e.g. "BucketCounts") to
  1014. // unconditionally include in API requests. By default, fields with
  1015. // empty values are omitted from API requests. However, any non-pointer,
  1016. // non-interface field appearing in ForceSendFields will be sent to the
  1017. // server regardless of whether the field is empty or not. This may be
  1018. // used to include empty fields in Patch requests.
  1019. ForceSendFields []string `json:"-"`
  1020. // NullFields is a list of field names (e.g. "BucketCounts") to include
  1021. // in API requests with the JSON null value. By default, fields with
  1022. // empty values are omitted from API requests. However, any field with
  1023. // an empty value appearing in NullFields will be sent to the server as
  1024. // null. It is an error if a field in this list has a non-empty value.
  1025. // This may be used to include null fields in Patch requests.
  1026. NullFields []string `json:"-"`
  1027. }
  1028. func (s *Distribution) MarshalJSON() ([]byte, error) {
  1029. type NoMethod Distribution
  1030. raw := NoMethod(*s)
  1031. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1032. }
  1033. func (s *Distribution) UnmarshalJSON(data []byte) error {
  1034. type NoMethod Distribution
  1035. var s1 struct {
  1036. Mean gensupport.JSONFloat64 `json:"mean"`
  1037. SumOfSquaredDeviation gensupport.JSONFloat64 `json:"sumOfSquaredDeviation"`
  1038. *NoMethod
  1039. }
  1040. s1.NoMethod = (*NoMethod)(s)
  1041. if err := json.Unmarshal(data, &s1); err != nil {
  1042. return err
  1043. }
  1044. s.Mean = float64(s1.Mean)
  1045. s.SumOfSquaredDeviation = float64(s1.SumOfSquaredDeviation)
  1046. return nil
  1047. }
  1048. // Documentation: A content string and a MIME type that describes the
  1049. // content string's format.
  1050. type Documentation struct {
  1051. // Content: The text of the documentation, interpreted according to
  1052. // mime_type. The content may not exceed 8,192 Unicode characters and
  1053. // may not exceed more than 10,240 bytes when encoded in UTF-8 format,
  1054. // whichever is smaller.
  1055. Content string `json:"content,omitempty"`
  1056. // MimeType: The format of the content field. Presently, only the value
  1057. // "text/markdown" is supported. See Markdown
  1058. // (https://en.wikipedia.org/wiki/Markdown) for more information.
  1059. MimeType string `json:"mimeType,omitempty"`
  1060. // ForceSendFields is a list of field names (e.g. "Content") to
  1061. // unconditionally include in API requests. By default, fields with
  1062. // empty values are omitted from API requests. However, any non-pointer,
  1063. // non-interface field appearing in ForceSendFields will be sent to the
  1064. // server regardless of whether the field is empty or not. This may be
  1065. // used to include empty fields in Patch requests.
  1066. ForceSendFields []string `json:"-"`
  1067. // NullFields is a list of field names (e.g. "Content") to include in
  1068. // API requests with the JSON null value. By default, fields with empty
  1069. // values are omitted from API requests. However, any field with an
  1070. // empty value appearing in NullFields will be sent to the server as
  1071. // null. It is an error if a field in this list has a non-empty value.
  1072. // This may be used to include null fields in Patch requests.
  1073. NullFields []string `json:"-"`
  1074. }
  1075. func (s *Documentation) MarshalJSON() ([]byte, error) {
  1076. type NoMethod Documentation
  1077. raw := NoMethod(*s)
  1078. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1079. }
  1080. // DroppedLabels: A set of (label, value) pairs which were dropped
  1081. // during aggregation, attached to google.api.Distribution.Exemplars in
  1082. // google.api.Distribution values during aggregation.These values are
  1083. // used in combination with the label values that remain on the
  1084. // aggregated Distribution timeseries to construct the full label set
  1085. // for the exemplar values. The resulting full label set may be used to
  1086. // identify the specific task/job/instance (for example) which may be
  1087. // contributing to a long-tail, while allowing the storage savings of
  1088. // only storing aggregated distribution values for a large group.Note
  1089. // that there are no guarantees on ordering of the labels from
  1090. // exemplar-to-exemplar and from distribution-to-distribution in the
  1091. // same stream, and there may be duplicates. It is up to clients to
  1092. // resolve any ambiguities.
  1093. type DroppedLabels struct {
  1094. // Label: Map from label to its value, for all labels dropped in any
  1095. // aggregation.
  1096. Label map[string]string `json:"label,omitempty"`
  1097. // ForceSendFields is a list of field names (e.g. "Label") to
  1098. // unconditionally include in API requests. By default, fields with
  1099. // empty values are omitted from API requests. However, any non-pointer,
  1100. // non-interface field appearing in ForceSendFields will be sent to the
  1101. // server regardless of whether the field is empty or not. This may be
  1102. // used to include empty fields in Patch requests.
  1103. ForceSendFields []string `json:"-"`
  1104. // NullFields is a list of field names (e.g. "Label") to include in API
  1105. // requests with the JSON null value. By default, fields with empty
  1106. // values are omitted from API requests. However, any field with an
  1107. // empty value appearing in NullFields will be sent to the server as
  1108. // null. It is an error if a field in this list has a non-empty value.
  1109. // This may be used to include null fields in Patch requests.
  1110. NullFields []string `json:"-"`
  1111. }
  1112. func (s *DroppedLabels) MarshalJSON() ([]byte, error) {
  1113. type NoMethod DroppedLabels
  1114. raw := NoMethod(*s)
  1115. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1116. }
  1117. // Empty: A generic empty message that you can re-use to avoid defining
  1118. // duplicated empty messages in your APIs. A typical example is to use
  1119. // it as the request or the response type of an API method. For
  1120. // instance:
  1121. // service Foo {
  1122. // rpc Bar(google.protobuf.Empty) returns
  1123. // (google.protobuf.Empty);
  1124. // }
  1125. // The JSON representation for Empty is empty JSON object {}.
  1126. type Empty struct {
  1127. // ServerResponse contains the HTTP response code and headers from the
  1128. // server.
  1129. googleapi.ServerResponse `json:"-"`
  1130. }
  1131. // Exemplar: Exemplars are example points that may be used to annotate
  1132. // aggregated distribution values. They are metadata that gives
  1133. // information about a particular value added to a Distribution bucket,
  1134. // such as a trace ID that was active when a value was added. They may
  1135. // contain further information, such as a example values and timestamps,
  1136. // origin, etc.
  1137. type Exemplar struct {
  1138. // Attachments: Contextual information about the example value. Examples
  1139. // are:Trace:
  1140. // type.googleapis.com/google.monitoring.v3.SpanContextLiteral string:
  1141. // type.googleapis.com/google.protobuf.StringValueLabels dropped during
  1142. // aggregation:
  1143. // type.googleapis.com/google.monitoring.v3.DroppedLabelsThere may be
  1144. // only a single attachment of any given message type in a single
  1145. // exemplar, and this is enforced by the system.
  1146. Attachments []googleapi.RawMessage `json:"attachments,omitempty"`
  1147. // Timestamp: The observation (sampling) time of the above value.
  1148. Timestamp string `json:"timestamp,omitempty"`
  1149. // Value: Value of the exemplar point. This value determines to which
  1150. // bucket the exemplar belongs.
  1151. Value float64 `json:"value,omitempty"`
  1152. // ForceSendFields is a list of field names (e.g. "Attachments") to
  1153. // unconditionally include in API requests. By default, fields with
  1154. // empty values are omitted from API requests. However, any non-pointer,
  1155. // non-interface field appearing in ForceSendFields will be sent to the
  1156. // server regardless of whether the field is empty or not. This may be
  1157. // used to include empty fields in Patch requests.
  1158. ForceSendFields []string `json:"-"`
  1159. // NullFields is a list of field names (e.g. "Attachments") to include
  1160. // in API requests with the JSON null value. By default, fields with
  1161. // empty values are omitted from API requests. However, any field with
  1162. // an empty value appearing in NullFields will be sent to the server as
  1163. // null. It is an error if a field in this list has a non-empty value.
  1164. // This may be used to include null fields in Patch requests.
  1165. NullFields []string `json:"-"`
  1166. }
  1167. func (s *Exemplar) MarshalJSON() ([]byte, error) {
  1168. type NoMethod Exemplar
  1169. raw := NoMethod(*s)
  1170. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1171. }
  1172. func (s *Exemplar) UnmarshalJSON(data []byte) error {
  1173. type NoMethod Exemplar
  1174. var s1 struct {
  1175. Value gensupport.JSONFloat64 `json:"value"`
  1176. *NoMethod
  1177. }
  1178. s1.NoMethod = (*NoMethod)(s)
  1179. if err := json.Unmarshal(data, &s1); err != nil {
  1180. return err
  1181. }
  1182. s.Value = float64(s1.Value)
  1183. return nil
  1184. }
  1185. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  1186. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  1187. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  1188. // N); boundsi - 1The bounds field must contain at least one element. If
  1189. // bounds has only one element, then there are no finite buckets, and
  1190. // that single element is the common boundary of the overflow and
  1191. // underflow buckets.
  1192. type Explicit struct {
  1193. // Bounds: The values must be monotonically increasing.
  1194. Bounds []float64 `json:"bounds,omitempty"`
  1195. // ForceSendFields is a list of field names (e.g. "Bounds") to
  1196. // unconditionally include in API requests. By default, fields with
  1197. // empty values are omitted from API requests. However, any non-pointer,
  1198. // non-interface field appearing in ForceSendFields will be sent to the
  1199. // server regardless of whether the field is empty or not. This may be
  1200. // used to include empty fields in Patch requests.
  1201. ForceSendFields []string `json:"-"`
  1202. // NullFields is a list of field names (e.g. "Bounds") to include in API
  1203. // requests with the JSON null value. By default, fields with empty
  1204. // values are omitted from API requests. However, any field with an
  1205. // empty value appearing in NullFields will be sent to the server as
  1206. // null. It is an error if a field in this list has a non-empty value.
  1207. // This may be used to include null fields in Patch requests.
  1208. NullFields []string `json:"-"`
  1209. }
  1210. func (s *Explicit) MarshalJSON() ([]byte, error) {
  1211. type NoMethod Explicit
  1212. raw := NoMethod(*s)
  1213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1214. }
  1215. // Exponential: Specifies an exponential sequence of buckets that have a
  1216. // width that is proportional to the value of the lower bound. Each
  1217. // bucket represents a constant relative uncertainty on a specific value
  1218. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  1219. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  1220. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  1221. // (growth_factor ^ (i - 1)).
  1222. type Exponential struct {
  1223. // GrowthFactor: Must be greater than 1.
  1224. GrowthFactor float64 `json:"growthFactor,omitempty"`
  1225. // NumFiniteBuckets: Must be greater than 0.
  1226. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  1227. // Scale: Must be greater than 0.
  1228. Scale float64 `json:"scale,omitempty"`
  1229. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  1230. // unconditionally include in API requests. By default, fields with
  1231. // empty values are omitted from API requests. However, any non-pointer,
  1232. // non-interface field appearing in ForceSendFields will be sent to the
  1233. // server regardless of whether the field is empty or not. This may be
  1234. // used to include empty fields in Patch requests.
  1235. ForceSendFields []string `json:"-"`
  1236. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  1237. // in API requests with the JSON null value. By default, fields with
  1238. // empty values are omitted from API requests. However, any field with
  1239. // an empty value appearing in NullFields will be sent to the server as
  1240. // null. It is an error if a field in this list has a non-empty value.
  1241. // This may be used to include null fields in Patch requests.
  1242. NullFields []string `json:"-"`
  1243. }
  1244. func (s *Exponential) MarshalJSON() ([]byte, error) {
  1245. type NoMethod Exponential
  1246. raw := NoMethod(*s)
  1247. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1248. }
  1249. func (s *Exponential) UnmarshalJSON(data []byte) error {
  1250. type NoMethod Exponential
  1251. var s1 struct {
  1252. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  1253. Scale gensupport.JSONFloat64 `json:"scale"`
  1254. *NoMethod
  1255. }
  1256. s1.NoMethod = (*NoMethod)(s)
  1257. if err := json.Unmarshal(data, &s1); err != nil {
  1258. return err
  1259. }
  1260. s.GrowthFactor = float64(s1.GrowthFactor)
  1261. s.Scale = float64(s1.Scale)
  1262. return nil
  1263. }
  1264. // Field: A single field of a message type.
  1265. type Field struct {
  1266. // Cardinality: The field cardinality.
  1267. //
  1268. // Possible values:
  1269. // "CARDINALITY_UNKNOWN" - For fields with unknown cardinality.
  1270. // "CARDINALITY_OPTIONAL" - For optional fields.
  1271. // "CARDINALITY_REQUIRED" - For required fields. Proto2 syntax only.
  1272. // "CARDINALITY_REPEATED" - For repeated fields.
  1273. Cardinality string `json:"cardinality,omitempty"`
  1274. // DefaultValue: The string value of the default value of this field.
  1275. // Proto2 syntax only.
  1276. DefaultValue string `json:"defaultValue,omitempty"`
  1277. // JsonName: The field JSON name.
  1278. JsonName string `json:"jsonName,omitempty"`
  1279. // Kind: The field type.
  1280. //
  1281. // Possible values:
  1282. // "TYPE_UNKNOWN" - Field type unknown.
  1283. // "TYPE_DOUBLE" - Field type double.
  1284. // "TYPE_FLOAT" - Field type float.
  1285. // "TYPE_INT64" - Field type int64.
  1286. // "TYPE_UINT64" - Field type uint64.
  1287. // "TYPE_INT32" - Field type int32.
  1288. // "TYPE_FIXED64" - Field type fixed64.
  1289. // "TYPE_FIXED32" - Field type fixed32.
  1290. // "TYPE_BOOL" - Field type bool.
  1291. // "TYPE_STRING" - Field type string.
  1292. // "TYPE_GROUP" - Field type group. Proto2 syntax only, and
  1293. // deprecated.
  1294. // "TYPE_MESSAGE" - Field type message.
  1295. // "TYPE_BYTES" - Field type bytes.
  1296. // "TYPE_UINT32" - Field type uint32.
  1297. // "TYPE_ENUM" - Field type enum.
  1298. // "TYPE_SFIXED32" - Field type sfixed32.
  1299. // "TYPE_SFIXED64" - Field type sfixed64.
  1300. // "TYPE_SINT32" - Field type sint32.
  1301. // "TYPE_SINT64" - Field type sint64.
  1302. Kind string `json:"kind,omitempty"`
  1303. // Name: The field name.
  1304. Name string `json:"name,omitempty"`
  1305. // Number: The field number.
  1306. Number int64 `json:"number,omitempty"`
  1307. // OneofIndex: The index of the field type in Type.oneofs, for message
  1308. // or enumeration types. The first type has index 1; zero means the type
  1309. // is not in the list.
  1310. OneofIndex int64 `json:"oneofIndex,omitempty"`
  1311. // Options: The protocol buffer options.
  1312. Options []*Option `json:"options,omitempty"`
  1313. // Packed: Whether to use alternative packed wire representation.
  1314. Packed bool `json:"packed,omitempty"`
  1315. // TypeUrl: The field type URL, without the scheme, for message or
  1316. // enumeration types. Example:
  1317. // "type.googleapis.com/google.protobuf.Timestamp".
  1318. TypeUrl string `json:"typeUrl,omitempty"`
  1319. // ForceSendFields is a list of field names (e.g. "Cardinality") to
  1320. // unconditionally include in API requests. By default, fields with
  1321. // empty values are omitted from API requests. However, any non-pointer,
  1322. // non-interface field appearing in ForceSendFields will be sent to the
  1323. // server regardless of whether the field is empty or not. This may be
  1324. // used to include empty fields in Patch requests.
  1325. ForceSendFields []string `json:"-"`
  1326. // NullFields is a list of field names (e.g. "Cardinality") to include
  1327. // in API requests with the JSON null value. By default, fields with
  1328. // empty values are omitted from API requests. However, any field with
  1329. // an empty value appearing in NullFields will be sent to the server as
  1330. // null. It is an error if a field in this list has a non-empty value.
  1331. // This may be used to include null fields in Patch requests.
  1332. NullFields []string `json:"-"`
  1333. }
  1334. func (s *Field) MarshalJSON() ([]byte, error) {
  1335. type NoMethod Field
  1336. raw := NoMethod(*s)
  1337. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1338. }
  1339. // GetNotificationChannelVerificationCodeRequest: The
  1340. // GetNotificationChannelVerificationCode request.
  1341. type GetNotificationChannelVerificationCodeRequest struct {
  1342. // ExpireTime: The desired expiration time. If specified, the API will
  1343. // guarantee that the returned code will not be valid after the
  1344. // specified timestamp; however, the API cannot guarantee that the
  1345. // returned code will be valid for at least as long as the requested
  1346. // time (the API puts an upper bound on the amount of time for which a
  1347. // code may be valid). If omitted, a default expiration will be used,
  1348. // which may be less than the max permissible expiration (so specifying
  1349. // an expiration may extend the code's lifetime over omitting an
  1350. // expiration, even though the API does impose an upper limit on the
  1351. // maximum expiration that is permitted).
  1352. ExpireTime string `json:"expireTime,omitempty"`
  1353. // ForceSendFields is a list of field names (e.g. "ExpireTime") to
  1354. // unconditionally include in API requests. By default, fields with
  1355. // empty values are omitted from API requests. However, any non-pointer,
  1356. // non-interface field appearing in ForceSendFields will be sent to the
  1357. // server regardless of whether the field is empty or not. This may be
  1358. // used to include empty fields in Patch requests.
  1359. ForceSendFields []string `json:"-"`
  1360. // NullFields is a list of field names (e.g. "ExpireTime") to include in
  1361. // API requests with the JSON null value. By default, fields with empty
  1362. // values are omitted from API requests. However, any field with an
  1363. // empty value appearing in NullFields will be sent to the server as
  1364. // null. It is an error if a field in this list has a non-empty value.
  1365. // This may be used to include null fields in Patch requests.
  1366. NullFields []string `json:"-"`
  1367. }
  1368. func (s *GetNotificationChannelVerificationCodeRequest) MarshalJSON() ([]byte, error) {
  1369. type NoMethod GetNotificationChannelVerificationCodeRequest
  1370. raw := NoMethod(*s)
  1371. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1372. }
  1373. // GetNotificationChannelVerificationCodeResponse: The
  1374. // GetNotificationChannelVerificationCode request.
  1375. type GetNotificationChannelVerificationCodeResponse struct {
  1376. // Code: The verification code, which may be used to verify other
  1377. // channels that have an equivalent identity (i.e. other channels of the
  1378. // same type with the same fingerprint such as other email channels with
  1379. // the same email address or other sms channels with the same number).
  1380. Code string `json:"code,omitempty"`
  1381. // ExpireTime: The expiration time associated with the code that was
  1382. // returned. If an expiration was provided in the request, this is the
  1383. // minimum of the requested expiration in the request and the max
  1384. // permitted expiration.
  1385. ExpireTime string `json:"expireTime,omitempty"`
  1386. // ServerResponse contains the HTTP response code and headers from the
  1387. // server.
  1388. googleapi.ServerResponse `json:"-"`
  1389. // ForceSendFields is a list of field names (e.g. "Code") to
  1390. // unconditionally include in API requests. By default, fields with
  1391. // empty values are omitted from API requests. However, any non-pointer,
  1392. // non-interface field appearing in ForceSendFields will be sent to the
  1393. // server regardless of whether the field is empty or not. This may be
  1394. // used to include empty fields in Patch requests.
  1395. ForceSendFields []string `json:"-"`
  1396. // NullFields is a list of field names (e.g. "Code") to include in API
  1397. // requests with the JSON null value. By default, fields with empty
  1398. // values are omitted from API requests. However, any field with an
  1399. // empty value appearing in NullFields will be sent to the server as
  1400. // null. It is an error if a field in this list has a non-empty value.
  1401. // This may be used to include null fields in Patch requests.
  1402. NullFields []string `json:"-"`
  1403. }
  1404. func (s *GetNotificationChannelVerificationCodeResponse) MarshalJSON() ([]byte, error) {
  1405. type NoMethod GetNotificationChannelVerificationCodeResponse
  1406. raw := NoMethod(*s)
  1407. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1408. }
  1409. // Group: The description of a dynamic collection of monitored
  1410. // resources. Each group has a filter that is matched against monitored
  1411. // resources and their associated metadata. If a group's filter matches
  1412. // an available monitored resource, then that resource is a member of
  1413. // that group. Groups can contain any number of monitored resources, and
  1414. // each monitored resource can be a member of any number of
  1415. // groups.Groups can be nested in parent-child hierarchies. The
  1416. // parentName field identifies an optional parent for each group. If a
  1417. // group has a parent, then the only monitored resources available to be
  1418. // matched by the group's filter are the resources contained in the
  1419. // parent group. In other words, a group contains the monitored
  1420. // resources that match its filter and the filters of all the group's
  1421. // ancestors. A group without a parent can contain any monitored
  1422. // resource.For example, consider an infrastructure running a set of
  1423. // instances with two user-defined tags: "environment" and "role". A
  1424. // parent group has a filter, environment="production". A child of that
  1425. // parent group has a filter, role="transcoder". The parent group
  1426. // contains all instances in the production environment, regardless of
  1427. // their roles. The child group contains instances that have the
  1428. // transcoder role and are in the production environment.The monitored
  1429. // resources contained in a group can change at any moment, depending on
  1430. // what resources exist and what filters are associated with the group
  1431. // and its ancestors.
  1432. type Group struct {
  1433. // DisplayName: A user-assigned name for this group, used only for
  1434. // display purposes.
  1435. DisplayName string `json:"displayName,omitempty"`
  1436. // Filter: The filter used to determine which monitored resources belong
  1437. // to this group.
  1438. Filter string `json:"filter,omitempty"`
  1439. // IsCluster: If true, the members of this group are considered to be a
  1440. // cluster. The system can perform additional analysis on groups that
  1441. // are clusters.
  1442. IsCluster bool `json:"isCluster,omitempty"`
  1443. // Name: Output only. The name of this group. The format is
  1444. // "projects/{project_id_or_number}/groups/{group_id}". When creating a
  1445. // group, this field is ignored and a new name is created consisting of
  1446. // the project specified in the call to CreateGroup and a unique
  1447. // {group_id} that is generated automatically.
  1448. Name string `json:"name,omitempty"`
  1449. // ParentName: The name of the group's parent, if it has one. The format
  1450. // is "projects/{project_id_or_number}/groups/{group_id}". For groups
  1451. // with no parent, parentName is the empty string, "".
  1452. ParentName string `json:"parentName,omitempty"`
  1453. // ServerResponse contains the HTTP response code and headers from the
  1454. // server.
  1455. googleapi.ServerResponse `json:"-"`
  1456. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1457. // unconditionally include in API requests. By default, fields with
  1458. // empty values are omitted from API requests. However, any non-pointer,
  1459. // non-interface field appearing in ForceSendFields will be sent to the
  1460. // server regardless of whether the field is empty or not. This may be
  1461. // used to include empty fields in Patch requests.
  1462. ForceSendFields []string `json:"-"`
  1463. // NullFields is a list of field names (e.g. "DisplayName") to include
  1464. // in API requests with the JSON null value. By default, fields with
  1465. // empty values are omitted from API requests. However, any field with
  1466. // an empty value appearing in NullFields will be sent to the server as
  1467. // null. It is an error if a field in this list has a non-empty value.
  1468. // This may be used to include null fields in Patch requests.
  1469. NullFields []string `json:"-"`
  1470. }
  1471. func (s *Group) MarshalJSON() ([]byte, error) {
  1472. type NoMethod Group
  1473. raw := NoMethod(*s)
  1474. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1475. }
  1476. // HttpCheck: Information involved in an HTTP/HTTPS uptime check
  1477. // request.
  1478. type HttpCheck struct {
  1479. // AuthInfo: The authentication information. Optional when creating an
  1480. // HTTP check; defaults to empty.
  1481. AuthInfo *BasicAuthentication `json:"authInfo,omitempty"`
  1482. // Headers: The list of headers to send as part of the uptime check
  1483. // request. If two headers have the same key and different values, they
  1484. // should be entered as a single header, with the value being a
  1485. // comma-separated list of all the desired values as described at
  1486. // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering
  1487. // two separate headers with the same key in a Create call will cause
  1488. // the first to be overwritten by the second. The maximum number of
  1489. // headers allowed is 100.
  1490. Headers map[string]string `json:"headers,omitempty"`
  1491. // MaskHeaders: Boolean specifiying whether to encrypt the header
  1492. // information. Encryption should be specified for any headers related
  1493. // to authentication that you do not wish to be seen when retrieving the
  1494. // configuration. The server will be responsible for encrypting the
  1495. // headers. On Get/List calls, if mask_headers is set to True then the
  1496. // headers will be obscured with ******.
  1497. MaskHeaders bool `json:"maskHeaders,omitempty"`
  1498. // Path: The path to the page to run the check against. Will be combined
  1499. // with the host (specified within the MonitoredResource) and port to
  1500. // construct the full URL. Optional (defaults to "/"). If the provided
  1501. // path does not begin with "/", it will be prepended automatically.
  1502. Path string `json:"path,omitempty"`
  1503. // Port: The port to the page to run the check against. Will be combined
  1504. // with host (specified within the MonitoredResource) and path to
  1505. // construct the full URL. Optional (defaults to 80 without SSL, or 443
  1506. // with SSL).
  1507. Port int64 `json:"port,omitempty"`
  1508. // UseSsl: If true, use HTTPS instead of HTTP to run the check.
  1509. UseSsl bool `json:"useSsl,omitempty"`
  1510. // ForceSendFields is a list of field names (e.g. "AuthInfo") to
  1511. // unconditionally include in API requests. By default, fields with
  1512. // empty values are omitted from API requests. However, any non-pointer,
  1513. // non-interface field appearing in ForceSendFields will be sent to the
  1514. // server regardless of whether the field is empty or not. This may be
  1515. // used to include empty fields in Patch requests.
  1516. ForceSendFields []string `json:"-"`
  1517. // NullFields is a list of field names (e.g. "AuthInfo") to include in
  1518. // API requests with the JSON null value. By default, fields with empty
  1519. // values are omitted from API requests. However, any field with an
  1520. // empty value appearing in NullFields will be sent to the server as
  1521. // null. It is an error if a field in this list has a non-empty value.
  1522. // This may be used to include null fields in Patch requests.
  1523. NullFields []string `json:"-"`
  1524. }
  1525. func (s *HttpCheck) MarshalJSON() ([]byte, error) {
  1526. type NoMethod HttpCheck
  1527. raw := NoMethod(*s)
  1528. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1529. }
  1530. // InternalChecker: An internal checker allows uptime checks to run on
  1531. // private/internal GCP resources.
  1532. type InternalChecker struct {
  1533. // DisplayName: The checker's human-readable name. The display name
  1534. // should be unique within a Stackdriver Workspace in order to make it
  1535. // easier to identify; however, uniqueness is not enforced.
  1536. DisplayName string `json:"displayName,omitempty"`
  1537. // GcpZone: The GCP zone the uptime check should egress from. Only
  1538. // respected for internal uptime checks, where internal_network is
  1539. // specified.
  1540. GcpZone string `json:"gcpZone,omitempty"`
  1541. // Name: A unique resource name for this InternalChecker. The format
  1542. // is:projects/[PROJECT_ID]/internalCheckers/[INTERNAL_CHECKER_ID].PROJEC
  1543. // T_ID is the stackdriver workspace project for the uptime check config
  1544. // associated with the internal checker.
  1545. Name string `json:"name,omitempty"`
  1546. // Network: The GCP VPC network (https://cloud.google.com/vpc/docs/vpc)
  1547. // where the internal resource lives (ex: "default").
  1548. Network string `json:"network,omitempty"`
  1549. // PeerProjectId: The GCP project_id where the internal checker lives.
  1550. // Not necessary the same as the workspace project.
  1551. PeerProjectId string `json:"peerProjectId,omitempty"`
  1552. // State: The current operational state of the internal checker.
  1553. //
  1554. // Possible values:
  1555. // "UNSPECIFIED" - An internal checker should never be in the
  1556. // unspecified state.
  1557. // "CREATING" - The checker is being created, provisioned, and
  1558. // configured. A checker in this state can be returned by
  1559. // ListInternalCheckers or GetInternalChecker, as well as by examining
  1560. // the longrunning.Operation that created it.
  1561. // "RUNNING" - The checker is running and available for use. A checker
  1562. // in this state can be returned by ListInternalCheckers or
  1563. // GetInternalChecker as well as by examining the longrunning.Operation
  1564. // that created it. If a checker is being torn down, it is neither
  1565. // visible nor usable, so there is no "deleting" or "down" state.
  1566. State string `json:"state,omitempty"`
  1567. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1568. // unconditionally include in API requests. By default, fields with
  1569. // empty values are omitted from API requests. However, any non-pointer,
  1570. // non-interface field appearing in ForceSendFields will be sent to the
  1571. // server regardless of whether the field is empty or not. This may be
  1572. // used to include empty fields in Patch requests.
  1573. ForceSendFields []string `json:"-"`
  1574. // NullFields is a list of field names (e.g. "DisplayName") to include
  1575. // in API requests with the JSON null value. By default, fields with
  1576. // empty values are omitted from API requests. However, any field with
  1577. // an empty value appearing in NullFields will be sent to the server as
  1578. // null. It is an error if a field in this list has a non-empty value.
  1579. // This may be used to include null fields in Patch requests.
  1580. NullFields []string `json:"-"`
  1581. }
  1582. func (s *InternalChecker) MarshalJSON() ([]byte, error) {
  1583. type NoMethod InternalChecker
  1584. raw := NoMethod(*s)
  1585. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1586. }
  1587. // LabelDescriptor: A description of a label.
  1588. type LabelDescriptor struct {
  1589. // Description: A human-readable description for the label.
  1590. Description string `json:"description,omitempty"`
  1591. // Key: The label key.
  1592. Key string `json:"key,omitempty"`
  1593. // ValueType: The type of data that can be assigned to the label.
  1594. //
  1595. // Possible values:
  1596. // "STRING" - A variable-length string. This is the default.
  1597. // "BOOL" - Boolean; true or false.
  1598. // "INT64" - A 64-bit signed integer.
  1599. ValueType string `json:"valueType,omitempty"`
  1600. // ForceSendFields is a list of field names (e.g. "Description") to
  1601. // unconditionally include in API requests. By default, fields with
  1602. // empty values are omitted from API requests. However, any non-pointer,
  1603. // non-interface field appearing in ForceSendFields will be sent to the
  1604. // server regardless of whether the field is empty or not. This may be
  1605. // used to include empty fields in Patch requests.
  1606. ForceSendFields []string `json:"-"`
  1607. // NullFields is a list of field names (e.g. "Description") to include
  1608. // in API requests with the JSON null value. By default, fields with
  1609. // empty values are omitted from API requests. However, any field with
  1610. // an empty value appearing in NullFields will be sent to the server as
  1611. // null. It is an error if a field in this list has a non-empty value.
  1612. // This may be used to include null fields in Patch requests.
  1613. NullFields []string `json:"-"`
  1614. }
  1615. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  1616. type NoMethod LabelDescriptor
  1617. raw := NoMethod(*s)
  1618. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1619. }
  1620. // Linear: Specifies a linear sequence of buckets that all have the same
  1621. // width (except overflow and underflow). Each bucket represents a
  1622. // constant absolute uncertainty on the specific value in the
  1623. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  1624. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  1625. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  1626. type Linear struct {
  1627. // NumFiniteBuckets: Must be greater than 0.
  1628. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  1629. // Offset: Lower bound of the first bucket.
  1630. Offset float64 `json:"offset,omitempty"`
  1631. // Width: Must be greater than 0.
  1632. Width float64 `json:"width,omitempty"`
  1633. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  1634. // unconditionally include in API requests. By default, fields with
  1635. // empty values are omitted from API requests. However, any non-pointer,
  1636. // non-interface field appearing in ForceSendFields will be sent to the
  1637. // server regardless of whether the field is empty or not. This may be
  1638. // used to include empty fields in Patch requests.
  1639. ForceSendFields []string `json:"-"`
  1640. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  1641. // include in API requests with the JSON null value. By default, fields
  1642. // with empty values are omitted from API requests. However, any field
  1643. // with an empty value appearing in NullFields will be sent to the
  1644. // server as null. It is an error if a field in this list has a
  1645. // non-empty value. This may be used to include null fields in Patch
  1646. // requests.
  1647. NullFields []string `json:"-"`
  1648. }
  1649. func (s *Linear) MarshalJSON() ([]byte, error) {
  1650. type NoMethod Linear
  1651. raw := NoMethod(*s)
  1652. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1653. }
  1654. func (s *Linear) UnmarshalJSON(data []byte) error {
  1655. type NoMethod Linear
  1656. var s1 struct {
  1657. Offset gensupport.JSONFloat64 `json:"offset"`
  1658. Width gensupport.JSONFloat64 `json:"width"`
  1659. *NoMethod
  1660. }
  1661. s1.NoMethod = (*NoMethod)(s)
  1662. if err := json.Unmarshal(data, &s1); err != nil {
  1663. return err
  1664. }
  1665. s.Offset = float64(s1.Offset)
  1666. s.Width = float64(s1.Width)
  1667. return nil
  1668. }
  1669. // ListAlertPoliciesResponse: The protocol for the ListAlertPolicies
  1670. // response.
  1671. type ListAlertPoliciesResponse struct {
  1672. // AlertPolicies: The returned alert policies.
  1673. AlertPolicies []*AlertPolicy `json:"alertPolicies,omitempty"`
  1674. // NextPageToken: If there might be more results than were returned,
  1675. // then this field is set to a non-empty value. To see the additional
  1676. // results, use that value as pageToken in the next call to this method.
  1677. NextPageToken string `json:"nextPageToken,omitempty"`
  1678. // ServerResponse contains the HTTP response code and headers from the
  1679. // server.
  1680. googleapi.ServerResponse `json:"-"`
  1681. // ForceSendFields is a list of field names (e.g. "AlertPolicies") to
  1682. // unconditionally include in API requests. By default, fields with
  1683. // empty values are omitted from API requests. However, any non-pointer,
  1684. // non-interface field appearing in ForceSendFields will be sent to the
  1685. // server regardless of whether the field is empty or not. This may be
  1686. // used to include empty fields in Patch requests.
  1687. ForceSendFields []string `json:"-"`
  1688. // NullFields is a list of field names (e.g. "AlertPolicies") to include
  1689. // in API requests with the JSON null value. By default, fields with
  1690. // empty values are omitted from API requests. However, any field with
  1691. // an empty value appearing in NullFields will be sent to the server as
  1692. // null. It is an error if a field in this list has a non-empty value.
  1693. // This may be used to include null fields in Patch requests.
  1694. NullFields []string `json:"-"`
  1695. }
  1696. func (s *ListAlertPoliciesResponse) MarshalJSON() ([]byte, error) {
  1697. type NoMethod ListAlertPoliciesResponse
  1698. raw := NoMethod(*s)
  1699. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1700. }
  1701. // ListGroupMembersResponse: The ListGroupMembers response.
  1702. type ListGroupMembersResponse struct {
  1703. // Members: A set of monitored resources in the group.
  1704. Members []*MonitoredResource `json:"members,omitempty"`
  1705. // NextPageToken: If there are more results than have been returned,
  1706. // then this field is set to a non-empty value. To see the additional
  1707. // results, use that value as pageToken in the next call to this method.
  1708. NextPageToken string `json:"nextPageToken,omitempty"`
  1709. // TotalSize: The total number of elements matching this request.
  1710. TotalSize int64 `json:"totalSize,omitempty"`
  1711. // ServerResponse contains the HTTP response code and headers from the
  1712. // server.
  1713. googleapi.ServerResponse `json:"-"`
  1714. // ForceSendFields is a list of field names (e.g. "Members") to
  1715. // unconditionally include in API requests. By default, fields with
  1716. // empty values are omitted from API requests. However, any non-pointer,
  1717. // non-interface field appearing in ForceSendFields will be sent to the
  1718. // server regardless of whether the field is empty or not. This may be
  1719. // used to include empty fields in Patch requests.
  1720. ForceSendFields []string `json:"-"`
  1721. // NullFields is a list of field names (e.g. "Members") to include in
  1722. // API requests with the JSON null value. By default, fields with empty
  1723. // values are omitted from API requests. However, any field with an
  1724. // empty value appearing in NullFields will be sent to the server as
  1725. // null. It is an error if a field in this list has a non-empty value.
  1726. // This may be used to include null fields in Patch requests.
  1727. NullFields []string `json:"-"`
  1728. }
  1729. func (s *ListGroupMembersResponse) MarshalJSON() ([]byte, error) {
  1730. type NoMethod ListGroupMembersResponse
  1731. raw := NoMethod(*s)
  1732. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1733. }
  1734. // ListGroupsResponse: The ListGroups response.
  1735. type ListGroupsResponse struct {
  1736. // Group: The groups that match the specified filters.
  1737. Group []*Group `json:"group,omitempty"`
  1738. // NextPageToken: If there are more results than have been returned,
  1739. // then this field is set to a non-empty value. To see the additional
  1740. // results, use that value as pageToken in the next call to this method.
  1741. NextPageToken string `json:"nextPageToken,omitempty"`
  1742. // ServerResponse contains the HTTP response code and headers from the
  1743. // server.
  1744. googleapi.ServerResponse `json:"-"`
  1745. // ForceSendFields is a list of field names (e.g. "Group") to
  1746. // unconditionally include in API requests. By default, fields with
  1747. // empty values are omitted from API requests. However, any non-pointer,
  1748. // non-interface field appearing in ForceSendFields will be sent to the
  1749. // server regardless of whether the field is empty or not. This may be
  1750. // used to include empty fields in Patch requests.
  1751. ForceSendFields []string `json:"-"`
  1752. // NullFields is a list of field names (e.g. "Group") to include in API
  1753. // requests with the JSON null value. By default, fields with empty
  1754. // values are omitted from API requests. However, any field with an
  1755. // empty value appearing in NullFields will be sent to the server as
  1756. // null. It is an error if a field in this list has a non-empty value.
  1757. // This may be used to include null fields in Patch requests.
  1758. NullFields []string `json:"-"`
  1759. }
  1760. func (s *ListGroupsResponse) MarshalJSON() ([]byte, error) {
  1761. type NoMethod ListGroupsResponse
  1762. raw := NoMethod(*s)
  1763. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1764. }
  1765. // ListMetricDescriptorsResponse: The ListMetricDescriptors response.
  1766. type ListMetricDescriptorsResponse struct {
  1767. // MetricDescriptors: The metric descriptors that are available to the
  1768. // project and that match the value of filter, if present.
  1769. MetricDescriptors []*MetricDescriptor `json:"metricDescriptors,omitempty"`
  1770. // NextPageToken: If there are more results than have been returned,
  1771. // then this field is set to a non-empty value. To see the additional
  1772. // results, use that value as pageToken in the next call to this method.
  1773. NextPageToken string `json:"nextPageToken,omitempty"`
  1774. // ServerResponse contains the HTTP response code and headers from the
  1775. // server.
  1776. googleapi.ServerResponse `json:"-"`
  1777. // ForceSendFields is a list of field names (e.g. "MetricDescriptors")
  1778. // to unconditionally include in API requests. By default, fields with
  1779. // empty values are omitted from API requests. However, any non-pointer,
  1780. // non-interface field appearing in ForceSendFields will be sent to the
  1781. // server regardless of whether the field is empty or not. This may be
  1782. // used to include empty fields in Patch requests.
  1783. ForceSendFields []string `json:"-"`
  1784. // NullFields is a list of field names (e.g. "MetricDescriptors") to
  1785. // include in API requests with the JSON null value. By default, fields
  1786. // with empty values are omitted from API requests. However, any field
  1787. // with an empty value appearing in NullFields will be sent to the
  1788. // server as null. It is an error if a field in this list has a
  1789. // non-empty value. This may be used to include null fields in Patch
  1790. // requests.
  1791. NullFields []string `json:"-"`
  1792. }
  1793. func (s *ListMetricDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1794. type NoMethod ListMetricDescriptorsResponse
  1795. raw := NoMethod(*s)
  1796. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1797. }
  1798. // ListMonitoredResourceDescriptorsResponse: The
  1799. // ListMonitoredResourceDescriptors response.
  1800. type ListMonitoredResourceDescriptorsResponse struct {
  1801. // NextPageToken: If there are more results than have been returned,
  1802. // then this field is set to a non-empty value. To see the additional
  1803. // results, use that value as pageToken in the next call to this method.
  1804. NextPageToken string `json:"nextPageToken,omitempty"`
  1805. // ResourceDescriptors: The monitored resource descriptors that are
  1806. // available to this project and that match filter, if present.
  1807. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  1808. // ServerResponse contains the HTTP response code and headers from the
  1809. // server.
  1810. googleapi.ServerResponse `json:"-"`
  1811. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1812. // unconditionally include in API requests. By default, fields with
  1813. // empty values are omitted from API requests. However, any non-pointer,
  1814. // non-interface field appearing in ForceSendFields will be sent to the
  1815. // server regardless of whether the field is empty or not. This may be
  1816. // used to include empty fields in Patch requests.
  1817. ForceSendFields []string `json:"-"`
  1818. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1819. // in API requests with the JSON null value. By default, fields with
  1820. // empty values are omitted from API requests. However, any field with
  1821. // an empty value appearing in NullFields will be sent to the server as
  1822. // null. It is an error if a field in this list has a non-empty value.
  1823. // This may be used to include null fields in Patch requests.
  1824. NullFields []string `json:"-"`
  1825. }
  1826. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1827. type NoMethod ListMonitoredResourceDescriptorsResponse
  1828. raw := NoMethod(*s)
  1829. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1830. }
  1831. // ListNotificationChannelDescriptorsResponse: The
  1832. // ListNotificationChannelDescriptors response.
  1833. type ListNotificationChannelDescriptorsResponse struct {
  1834. // ChannelDescriptors: The monitored resource descriptors supported for
  1835. // the specified project, optionally filtered.
  1836. ChannelDescriptors []*NotificationChannelDescriptor `json:"channelDescriptors,omitempty"`
  1837. // NextPageToken: If not empty, indicates that there may be more results
  1838. // that match the request. Use the value in the page_token field in a
  1839. // subsequent request to fetch the next set of results. If empty, all
  1840. // results have been returned.
  1841. NextPageToken string `json:"nextPageToken,omitempty"`
  1842. // ServerResponse contains the HTTP response code and headers from the
  1843. // server.
  1844. googleapi.ServerResponse `json:"-"`
  1845. // ForceSendFields is a list of field names (e.g. "ChannelDescriptors")
  1846. // to unconditionally include in API requests. By default, fields with
  1847. // empty values are omitted from API requests. However, any non-pointer,
  1848. // non-interface field appearing in ForceSendFields will be sent to the
  1849. // server regardless of whether the field is empty or not. This may be
  1850. // used to include empty fields in Patch requests.
  1851. ForceSendFields []string `json:"-"`
  1852. // NullFields is a list of field names (e.g. "ChannelDescriptors") to
  1853. // include in API requests with the JSON null value. By default, fields
  1854. // with empty values are omitted from API requests. However, any field
  1855. // with an empty value appearing in NullFields will be sent to the
  1856. // server as null. It is an error if a field in this list has a
  1857. // non-empty value. This may be used to include null fields in Patch
  1858. // requests.
  1859. NullFields []string `json:"-"`
  1860. }
  1861. func (s *ListNotificationChannelDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1862. type NoMethod ListNotificationChannelDescriptorsResponse
  1863. raw := NoMethod(*s)
  1864. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1865. }
  1866. // ListNotificationChannelsResponse: The ListNotificationChannels
  1867. // response.
  1868. type ListNotificationChannelsResponse struct {
  1869. // NextPageToken: If not empty, indicates that there may be more results
  1870. // that match the request. Use the value in the page_token field in a
  1871. // subsequent request to fetch the next set of results. If empty, all
  1872. // results have been returned.
  1873. NextPageToken string `json:"nextPageToken,omitempty"`
  1874. // NotificationChannels: The notification channels defined for the
  1875. // specified project.
  1876. NotificationChannels []*NotificationChannel `json:"notificationChannels,omitempty"`
  1877. // ServerResponse contains the HTTP response code and headers from the
  1878. // server.
  1879. googleapi.ServerResponse `json:"-"`
  1880. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1881. // unconditionally include in API requests. By default, fields with
  1882. // empty values are omitted from API requests. However, any non-pointer,
  1883. // non-interface field appearing in ForceSendFields will be sent to the
  1884. // server regardless of whether the field is empty or not. This may be
  1885. // used to include empty fields in Patch requests.
  1886. ForceSendFields []string `json:"-"`
  1887. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1888. // in API requests with the JSON null value. By default, fields with
  1889. // empty values are omitted from API requests. However, any field with
  1890. // an empty value appearing in NullFields will be sent to the server as
  1891. // null. It is an error if a field in this list has a non-empty value.
  1892. // This may be used to include null fields in Patch requests.
  1893. NullFields []string `json:"-"`
  1894. }
  1895. func (s *ListNotificationChannelsResponse) MarshalJSON() ([]byte, error) {
  1896. type NoMethod ListNotificationChannelsResponse
  1897. raw := NoMethod(*s)
  1898. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1899. }
  1900. // ListTimeSeriesResponse: The ListTimeSeries response.
  1901. type ListTimeSeriesResponse struct {
  1902. // ExecutionErrors: Query execution errors that may have caused the time
  1903. // series data returned to be incomplete.
  1904. ExecutionErrors []*Status `json:"executionErrors,omitempty"`
  1905. // NextPageToken: If there are more results than have been returned,
  1906. // then this field is set to a non-empty value. To see the additional
  1907. // results, use that value as pageToken in the next call to this method.
  1908. NextPageToken string `json:"nextPageToken,omitempty"`
  1909. // TimeSeries: One or more time series that match the filter included in
  1910. // the request.
  1911. TimeSeries []*TimeSeries `json:"timeSeries,omitempty"`
  1912. // ServerResponse contains the HTTP response code and headers from the
  1913. // server.
  1914. googleapi.ServerResponse `json:"-"`
  1915. // ForceSendFields is a list of field names (e.g. "ExecutionErrors") to
  1916. // unconditionally include in API requests. By default, fields with
  1917. // empty values are omitted from API requests. However, any non-pointer,
  1918. // non-interface field appearing in ForceSendFields will be sent to the
  1919. // server regardless of whether the field is empty or not. This may be
  1920. // used to include empty fields in Patch requests.
  1921. ForceSendFields []string `json:"-"`
  1922. // NullFields is a list of field names (e.g. "ExecutionErrors") to
  1923. // include in API requests with the JSON null value. By default, fields
  1924. // with empty values are omitted from API requests. However, any field
  1925. // with an empty value appearing in NullFields will be sent to the
  1926. // server as null. It is an error if a field in this list has a
  1927. // non-empty value. This may be used to include null fields in Patch
  1928. // requests.
  1929. NullFields []string `json:"-"`
  1930. }
  1931. func (s *ListTimeSeriesResponse) MarshalJSON() ([]byte, error) {
  1932. type NoMethod ListTimeSeriesResponse
  1933. raw := NoMethod(*s)
  1934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1935. }
  1936. // ListUptimeCheckConfigsResponse: The protocol for the
  1937. // ListUptimeCheckConfigs response.
  1938. type ListUptimeCheckConfigsResponse struct {
  1939. // NextPageToken: This field represents the pagination token to retrieve
  1940. // the next page of results. If the value is empty, it means no further
  1941. // results for the request. To retrieve the next page of results, the
  1942. // value of the next_page_token is passed to the subsequent List method
  1943. // call (in the request message's page_token field).
  1944. NextPageToken string `json:"nextPageToken,omitempty"`
  1945. // TotalSize: The total number of uptime check configurations for the
  1946. // project, irrespective of any pagination.
  1947. TotalSize int64 `json:"totalSize,omitempty"`
  1948. // UptimeCheckConfigs: The returned uptime check configurations.
  1949. UptimeCheckConfigs []*UptimeCheckConfig `json:"uptimeCheckConfigs,omitempty"`
  1950. // ServerResponse contains the HTTP response code and headers from the
  1951. // server.
  1952. googleapi.ServerResponse `json:"-"`
  1953. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1954. // unconditionally include in API requests. By default, fields with
  1955. // empty values are omitted from API requests. However, any non-pointer,
  1956. // non-interface field appearing in ForceSendFields will be sent to the
  1957. // server regardless of whether the field is empty or not. This may be
  1958. // used to include empty fields in Patch requests.
  1959. ForceSendFields []string `json:"-"`
  1960. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1961. // in API requests with the JSON null value. By default, fields with
  1962. // empty values are omitted from API requests. However, any field with
  1963. // an empty value appearing in NullFields will be sent to the server as
  1964. // null. It is an error if a field in this list has a non-empty value.
  1965. // This may be used to include null fields in Patch requests.
  1966. NullFields []string `json:"-"`
  1967. }
  1968. func (s *ListUptimeCheckConfigsResponse) MarshalJSON() ([]byte, error) {
  1969. type NoMethod ListUptimeCheckConfigsResponse
  1970. raw := NoMethod(*s)
  1971. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1972. }
  1973. // ListUptimeCheckIpsResponse: The protocol for the ListUptimeCheckIps
  1974. // response.
  1975. type ListUptimeCheckIpsResponse struct {
  1976. // NextPageToken: This field represents the pagination token to retrieve
  1977. // the next page of results. If the value is empty, it means no further
  1978. // results for the request. To retrieve the next page of results, the
  1979. // value of the next_page_token is passed to the subsequent List method
  1980. // call (in the request message's page_token field). NOTE: this field is
  1981. // not yet implemented
  1982. NextPageToken string `json:"nextPageToken,omitempty"`
  1983. // UptimeCheckIps: The returned list of IP addresses (including region
  1984. // and location) that the checkers run from.
  1985. UptimeCheckIps []*UptimeCheckIp `json:"uptimeCheckIps,omitempty"`
  1986. // ServerResponse contains the HTTP response code and headers from the
  1987. // server.
  1988. googleapi.ServerResponse `json:"-"`
  1989. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1990. // unconditionally include in API requests. By default, fields with
  1991. // empty values are omitted from API requests. However, any non-pointer,
  1992. // non-interface field appearing in ForceSendFields will be sent to the
  1993. // server regardless of whether the field is empty or not. This may be
  1994. // used to include empty fields in Patch requests.
  1995. ForceSendFields []string `json:"-"`
  1996. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1997. // in API requests with the JSON null value. By default, fields with
  1998. // empty values are omitted from API requests. However, any field with
  1999. // an empty value appearing in NullFields will be sent to the server as
  2000. // null. It is an error if a field in this list has a non-empty value.
  2001. // This may be used to include null fields in Patch requests.
  2002. NullFields []string `json:"-"`
  2003. }
  2004. func (s *ListUptimeCheckIpsResponse) MarshalJSON() ([]byte, error) {
  2005. type NoMethod ListUptimeCheckIpsResponse
  2006. raw := NoMethod(*s)
  2007. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2008. }
  2009. // Metric: A specific metric, identified by specifying values for all of
  2010. // the labels of a MetricDescriptor.
  2011. type Metric struct {
  2012. // Labels: The set of label values that uniquely identify this metric.
  2013. // All labels listed in the MetricDescriptor must be assigned values.
  2014. Labels map[string]string `json:"labels,omitempty"`
  2015. // Type: An existing metric type, see google.api.MetricDescriptor. For
  2016. // example, custom.googleapis.com/invoice/paid/amount.
  2017. Type string `json:"type,omitempty"`
  2018. // ForceSendFields is a list of field names (e.g. "Labels") to
  2019. // unconditionally include in API requests. By default, fields with
  2020. // empty values are omitted from API requests. However, any non-pointer,
  2021. // non-interface field appearing in ForceSendFields will be sent to the
  2022. // server regardless of whether the field is empty or not. This may be
  2023. // used to include empty fields in Patch requests.
  2024. ForceSendFields []string `json:"-"`
  2025. // NullFields is a list of field names (e.g. "Labels") to include in API
  2026. // requests with the JSON null value. By default, fields with empty
  2027. // values are omitted from API requests. However, any field with an
  2028. // empty value appearing in NullFields will be sent to the server as
  2029. // null. It is an error if a field in this list has a non-empty value.
  2030. // This may be used to include null fields in Patch requests.
  2031. NullFields []string `json:"-"`
  2032. }
  2033. func (s *Metric) MarshalJSON() ([]byte, error) {
  2034. type NoMethod Metric
  2035. raw := NoMethod(*s)
  2036. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2037. }
  2038. // MetricAbsence: A condition type that checks that monitored resources
  2039. // are reporting data. The configuration defines a metric and a set of
  2040. // monitored resources. The predicate is considered in violation when a
  2041. // time series for the specified metric of a monitored resource does not
  2042. // include any data in the specified duration.
  2043. type MetricAbsence struct {
  2044. // Aggregations: Specifies the alignment of data points in individual
  2045. // time series as well as how to combine the retrieved time series
  2046. // together (such as when aggregating multiple streams on each resource
  2047. // to a single stream for each resource or when aggregating streams
  2048. // across all members of a group of resrouces). Multiple aggregations
  2049. // are applied in the order specified.This field is similar to the one
  2050. // in the MetricService.ListTimeSeries request. It is advisable to use
  2051. // the ListTimeSeries method when debugging this field.
  2052. Aggregations []*Aggregation `json:"aggregations,omitempty"`
  2053. // Duration: The amount of time that a time series must fail to report
  2054. // new data to be considered failing. Currently, only values that are a
  2055. // multiple of a minute--e.g. 60, 120, or 300 seconds--are supported. If
  2056. // an invalid value is given, an error will be returned. The
  2057. // Duration.nanos field is ignored.
  2058. Duration string `json:"duration,omitempty"`
  2059. // Filter: A filter that identifies which time series should be compared
  2060. // with the threshold.The filter is similar to the one that is specified
  2061. // in the MetricService.ListTimeSeries request (that call is useful to
  2062. // verify the time series that will be retrieved / processed) and must
  2063. // specify the metric type and optionally may contain restrictions on
  2064. // resource type, resource labels, and metric labels. This field may not
  2065. // exceed 2048 Unicode characters in length.
  2066. Filter string `json:"filter,omitempty"`
  2067. // Trigger: The number/percent of time series for which the comparison
  2068. // must hold in order for the condition to trigger. If unspecified, then
  2069. // the condition will trigger if the comparison is true for any of the
  2070. // time series that have been identified by filter and aggregations.
  2071. Trigger *Trigger `json:"trigger,omitempty"`
  2072. // ForceSendFields is a list of field names (e.g. "Aggregations") to
  2073. // unconditionally include in API requests. By default, fields with
  2074. // empty values are omitted from API requests. However, any non-pointer,
  2075. // non-interface field appearing in ForceSendFields will be sent to the
  2076. // server regardless of whether the field is empty or not. This may be
  2077. // used to include empty fields in Patch requests.
  2078. ForceSendFields []string `json:"-"`
  2079. // NullFields is a list of field names (e.g. "Aggregations") to include
  2080. // in API requests with the JSON null value. By default, fields with
  2081. // empty values are omitted from API requests. However, any field with
  2082. // an empty value appearing in NullFields will be sent to the server as
  2083. // null. It is an error if a field in this list has a non-empty value.
  2084. // This may be used to include null fields in Patch requests.
  2085. NullFields []string `json:"-"`
  2086. }
  2087. func (s *MetricAbsence) MarshalJSON() ([]byte, error) {
  2088. type NoMethod MetricAbsence
  2089. raw := NoMethod(*s)
  2090. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2091. }
  2092. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  2093. // descriptor is created, deleting or altering it stops data collection
  2094. // and makes the metric type's existing data unusable.
  2095. type MetricDescriptor struct {
  2096. // Description: A detailed description of the metric, which can be used
  2097. // in documentation.
  2098. Description string `json:"description,omitempty"`
  2099. // DisplayName: A concise name for the metric, which can be displayed in
  2100. // user interfaces. Use sentence case without an ending period, for
  2101. // example "Request count". This field is optional but it is recommended
  2102. // to be set for any metrics associated with user-visible concepts, such
  2103. // as Quota.
  2104. DisplayName string `json:"displayName,omitempty"`
  2105. // Labels: The set of labels that can be used to describe a specific
  2106. // instance of this metric type. For example, the
  2107. // appengine.googleapis.com/http/server/response_latencies metric type
  2108. // has a label for the HTTP response code, response_code, so you can
  2109. // look at latencies for successful responses or just for responses that
  2110. // failed.
  2111. Labels []*LabelDescriptor `json:"labels,omitempty"`
  2112. // Metadata: Optional. Metadata which can be used to guide usage of the
  2113. // metric.
  2114. Metadata *MetricDescriptorMetadata `json:"metadata,omitempty"`
  2115. // MetricKind: Whether the metric records instantaneous values, changes
  2116. // to a value, etc. Some combinations of metric_kind and value_type
  2117. // might not be supported.
  2118. //
  2119. // Possible values:
  2120. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  2121. // "GAUGE" - An instantaneous measurement of a value.
  2122. // "DELTA" - The change in a value during a time interval.
  2123. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  2124. // measurements in a time series should have the same start time and
  2125. // increasing end times, until an event resets the cumulative value to
  2126. // zero and sets a new start time for the following points.
  2127. MetricKind string `json:"metricKind,omitempty"`
  2128. // Name: The resource name of the metric descriptor.
  2129. Name string `json:"name,omitempty"`
  2130. // Type: The metric type, including its DNS name prefix. The type is not
  2131. // URL-encoded. All user-defined metric types have the DNS name
  2132. // custom.googleapis.com or external.googleapis.com. Metric types should
  2133. // use a natural hierarchical grouping. For
  2134. // example:
  2135. // "custom.googleapis.com/invoice/paid/amount"
  2136. // "external.googlea
  2137. // pis.com/prometheus/up"
  2138. // "appengine.googleapis.com/http/server/response_
  2139. // latencies"
  2140. //
  2141. Type string `json:"type,omitempty"`
  2142. // Unit: The unit in which the metric value is reported. It is only
  2143. // applicable if the value_type is INT64, DOUBLE, or DISTRIBUTION. The
  2144. // supported units are a subset of The Unified Code for Units of Measure
  2145. // (http://unitsofmeasure.org/ucum.html) standard:Basic units (UNIT)
  2146. // bit bit
  2147. // By byte
  2148. // s second
  2149. // min minute
  2150. // h hour
  2151. // d dayPrefixes (PREFIX)
  2152. // k kilo (10**3)
  2153. // M mega (10**6)
  2154. // G giga (10**9)
  2155. // T tera (10**12)
  2156. // P peta (10**15)
  2157. // E exa (10**18)
  2158. // Z zetta (10**21)
  2159. // Y yotta (10**24)
  2160. // m milli (10**-3)
  2161. // u micro (10**-6)
  2162. // n nano (10**-9)
  2163. // p pico (10**-12)
  2164. // f femto (10**-15)
  2165. // a atto (10**-18)
  2166. // z zepto (10**-21)
  2167. // y yocto (10**-24)
  2168. // Ki kibi (2**10)
  2169. // Mi mebi (2**20)
  2170. // Gi gibi (2**30)
  2171. // Ti tebi (2**40)GrammarThe grammar also includes these connectors:
  2172. // / division (as an infix operator, e.g. 1/s).
  2173. // . multiplication (as an infix operator, e.g. GBy.d)The grammar for a
  2174. // unit is as follows:
  2175. // Expression = Component { "." Component } { "/" Component }
  2176. // ;
  2177. //
  2178. // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ]
  2179. // | Annotation
  2180. // | "1"
  2181. // ;
  2182. //
  2183. // Annotation = "{" NAME "}" ;
  2184. // Notes:
  2185. // Annotation is just a comment if it follows a UNIT and is equivalent
  2186. // to 1 if it is used alone. For examples, {requests}/s == 1/s,
  2187. // By{transmitted}/s == By/s.
  2188. // NAME is a sequence of non-blank printable ASCII characters not
  2189. // containing '{' or '}'.
  2190. // 1 represents dimensionless value 1, such as in 1/s.
  2191. // % represents dimensionless value 1/100, and annotates values giving
  2192. // a percentage.
  2193. Unit string `json:"unit,omitempty"`
  2194. // ValueType: Whether the measurement is an integer, a floating-point
  2195. // number, etc. Some combinations of metric_kind and value_type might
  2196. // not be supported.
  2197. //
  2198. // Possible values:
  2199. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  2200. // "BOOL" - The value is a boolean. This value type can be used only
  2201. // if the metric kind is GAUGE.
  2202. // "INT64" - The value is a signed 64-bit integer.
  2203. // "DOUBLE" - The value is a double precision floating point number.
  2204. // "STRING" - The value is a text string. This value type can be used
  2205. // only if the metric kind is GAUGE.
  2206. // "DISTRIBUTION" - The value is a Distribution.
  2207. // "MONEY" - The value is money.
  2208. ValueType string `json:"valueType,omitempty"`
  2209. // ServerResponse contains the HTTP response code and headers from the
  2210. // server.
  2211. googleapi.ServerResponse `json:"-"`
  2212. // ForceSendFields is a list of field names (e.g. "Description") to
  2213. // unconditionally include in API requests. By default, fields with
  2214. // empty values are omitted from API requests. However, any non-pointer,
  2215. // non-interface field appearing in ForceSendFields will be sent to the
  2216. // server regardless of whether the field is empty or not. This may be
  2217. // used to include empty fields in Patch requests.
  2218. ForceSendFields []string `json:"-"`
  2219. // NullFields is a list of field names (e.g. "Description") to include
  2220. // in API requests with the JSON null value. By default, fields with
  2221. // empty values are omitted from API requests. However, any field with
  2222. // an empty value appearing in NullFields will be sent to the server as
  2223. // null. It is an error if a field in this list has a non-empty value.
  2224. // This may be used to include null fields in Patch requests.
  2225. NullFields []string `json:"-"`
  2226. }
  2227. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  2228. type NoMethod MetricDescriptor
  2229. raw := NoMethod(*s)
  2230. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2231. }
  2232. // MetricDescriptorMetadata: Additional annotations that can be used to
  2233. // guide the usage of a metric.
  2234. type MetricDescriptorMetadata struct {
  2235. // IngestDelay: The delay of data points caused by ingestion. Data
  2236. // points older than this age are guaranteed to be ingested and
  2237. // available to be read, excluding data loss due to errors.
  2238. IngestDelay string `json:"ingestDelay,omitempty"`
  2239. // LaunchStage: The launch stage of the metric definition.
  2240. //
  2241. // Possible values:
  2242. // "LAUNCH_STAGE_UNSPECIFIED" - Do not use this default value.
  2243. // "EARLY_ACCESS" - Early Access features are limited to a closed
  2244. // group of testers. To use these features, you must sign up in advance
  2245. // and sign a Trusted Tester agreement (which includes confidentiality
  2246. // provisions). These features may be unstable, changed in
  2247. // backward-incompatible ways, and are not guaranteed to be released.
  2248. // "ALPHA" - Alpha is a limited availability test for releases before
  2249. // they are cleared for widespread use. By Alpha, all significant design
  2250. // issues are resolved and we are in the process of verifying
  2251. // functionality. Alpha customers need to apply for access, agree to
  2252. // applicable terms, and have their projects whitelisted. Alpha releases
  2253. // don’t have to be feature complete, no SLAs are provided, and there
  2254. // are no technical support obligations, but they will be far enough
  2255. // along that customers can actually use them in test environments or
  2256. // for limited-use tests -- just like they would in normal production
  2257. // cases.
  2258. // "BETA" - Beta is the point at which we are ready to open a release
  2259. // for any customer to use. There are no SLA or technical support
  2260. // obligations in a Beta release. Products will be complete from a
  2261. // feature perspective, but may have some open outstanding issues. Beta
  2262. // releases are suitable for limited production use cases.
  2263. // "GA" - GA features are open to all developers and are considered
  2264. // stable and fully qualified for production use.
  2265. // "DEPRECATED" - Deprecated features are scheduled to be shut down
  2266. // and removed. For more information, see the “Deprecation Policy”
  2267. // section of our Terms of Service (https://cloud.google.com/terms/) and
  2268. // the Google Cloud Platform Subject to the Deprecation Policy
  2269. // (https://cloud.google.com/terms/deprecation) documentation.
  2270. LaunchStage string `json:"launchStage,omitempty"`
  2271. // SamplePeriod: The sampling period of metric data points. For metrics
  2272. // which are written periodically, consecutive data points are stored at
  2273. // this time interval, excluding data loss due to errors. Metrics with a
  2274. // higher granularity have a smaller sampling period.
  2275. SamplePeriod string `json:"samplePeriod,omitempty"`
  2276. // ForceSendFields is a list of field names (e.g. "IngestDelay") to
  2277. // unconditionally include in API requests. By default, fields with
  2278. // empty values are omitted from API requests. However, any non-pointer,
  2279. // non-interface field appearing in ForceSendFields will be sent to the
  2280. // server regardless of whether the field is empty or not. This may be
  2281. // used to include empty fields in Patch requests.
  2282. ForceSendFields []string `json:"-"`
  2283. // NullFields is a list of field names (e.g. "IngestDelay") to include
  2284. // in API requests with the JSON null value. By default, fields with
  2285. // empty values are omitted from API requests. However, any field with
  2286. // an empty value appearing in NullFields will be sent to the server as
  2287. // null. It is an error if a field in this list has a non-empty value.
  2288. // This may be used to include null fields in Patch requests.
  2289. NullFields []string `json:"-"`
  2290. }
  2291. func (s *MetricDescriptorMetadata) MarshalJSON() ([]byte, error) {
  2292. type NoMethod MetricDescriptorMetadata
  2293. raw := NoMethod(*s)
  2294. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2295. }
  2296. // MetricThreshold: A condition type that compares a collection of time
  2297. // series against a threshold.
  2298. type MetricThreshold struct {
  2299. // Aggregations: Specifies the alignment of data points in individual
  2300. // time series as well as how to combine the retrieved time series
  2301. // together (such as when aggregating multiple streams on each resource
  2302. // to a single stream for each resource or when aggregating streams
  2303. // across all members of a group of resrouces). Multiple aggregations
  2304. // are applied in the order specified.This field is similar to the one
  2305. // in the MetricService.ListTimeSeries request. It is advisable to use
  2306. // the ListTimeSeries method when debugging this field.
  2307. Aggregations []*Aggregation `json:"aggregations,omitempty"`
  2308. // Comparison: The comparison to apply between the time series
  2309. // (indicated by filter and aggregation) and the threshold (indicated by
  2310. // threshold_value). The comparison is applied on each time series, with
  2311. // the time series on the left-hand side and the threshold on the
  2312. // right-hand side.Only COMPARISON_LT and COMPARISON_GT are supported
  2313. // currently.
  2314. //
  2315. // Possible values:
  2316. // "COMPARISON_UNSPECIFIED" - No ordering relationship is specified.
  2317. // "COMPARISON_GT" - The left argument is greater than the right
  2318. // argument.
  2319. // "COMPARISON_GE" - The left argument is greater than or equal to the
  2320. // right argument.
  2321. // "COMPARISON_LT" - The left argument is less than the right
  2322. // argument.
  2323. // "COMPARISON_LE" - The left argument is less than or equal to the
  2324. // right argument.
  2325. // "COMPARISON_EQ" - The left argument is equal to the right argument.
  2326. // "COMPARISON_NE" - The left argument is not equal to the right
  2327. // argument.
  2328. Comparison string `json:"comparison,omitempty"`
  2329. // DenominatorAggregations: Specifies the alignment of data points in
  2330. // individual time series selected by denominatorFilter as well as how
  2331. // to combine the retrieved time series together (such as when
  2332. // aggregating multiple streams on each resource to a single stream for
  2333. // each resource or when aggregating streams across all members of a
  2334. // group of resources).When computing ratios, the aggregations and
  2335. // denominator_aggregations fields must use the same alignment period
  2336. // and produce time series that have the same periodicity and
  2337. // labels.This field is similar to the one in the
  2338. // MetricService.ListTimeSeries request. It is advisable to use the
  2339. // ListTimeSeries method when debugging this field.
  2340. DenominatorAggregations []*Aggregation `json:"denominatorAggregations,omitempty"`
  2341. // DenominatorFilter: A filter that identifies a time series that should
  2342. // be used as the denominator of a ratio that will be compared with the
  2343. // threshold. If a denominator_filter is specified, the time series
  2344. // specified by the filter field will be used as the numerator.The
  2345. // filter is similar to the one that is specified in the
  2346. // MetricService.ListTimeSeries request (that call is useful to verify
  2347. // the time series that will be retrieved / processed) and must specify
  2348. // the metric type and optionally may contain restrictions on resource
  2349. // type, resource labels, and metric labels. This field may not exceed
  2350. // 2048 Unicode characters in length.
  2351. DenominatorFilter string `json:"denominatorFilter,omitempty"`
  2352. // Duration: The amount of time that a time series must violate the
  2353. // threshold to be considered failing. Currently, only values that are a
  2354. // multiple of a minute--e.g., 0, 60, 120, or 300 seconds--are
  2355. // supported. If an invalid value is given, an error will be returned.
  2356. // When choosing a duration, it is useful to keep in mind the frequency
  2357. // of the underlying time series data (which may also be affected by any
  2358. // alignments specified in the aggregations field); a good duration is
  2359. // long enough so that a single outlier does not generate spurious
  2360. // alerts, but short enough that unhealthy states are detected and
  2361. // alerted on quickly.
  2362. Duration string `json:"duration,omitempty"`
  2363. // Filter: A filter that identifies which time series should be compared
  2364. // with the threshold.The filter is similar to the one that is specified
  2365. // in the MetricService.ListTimeSeries request (that call is useful to
  2366. // verify the time series that will be retrieved / processed) and must
  2367. // specify the metric type and optionally may contain restrictions on
  2368. // resource type, resource labels, and metric labels. This field may not
  2369. // exceed 2048 Unicode characters in length.
  2370. Filter string `json:"filter,omitempty"`
  2371. // ThresholdValue: A value against which to compare the time series.
  2372. ThresholdValue float64 `json:"thresholdValue,omitempty"`
  2373. // Trigger: The number/percent of time series for which the comparison
  2374. // must hold in order for the condition to trigger. If unspecified, then
  2375. // the condition will trigger if the comparison is true for any of the
  2376. // time series that have been identified by filter and aggregations, or
  2377. // by the ratio, if denominator_filter and denominator_aggregations are
  2378. // specified.
  2379. Trigger *Trigger `json:"trigger,omitempty"`
  2380. // ForceSendFields is a list of field names (e.g. "Aggregations") to
  2381. // unconditionally include in API requests. By default, fields with
  2382. // empty values are omitted from API requests. However, any non-pointer,
  2383. // non-interface field appearing in ForceSendFields will be sent to the
  2384. // server regardless of whether the field is empty or not. This may be
  2385. // used to include empty fields in Patch requests.
  2386. ForceSendFields []string `json:"-"`
  2387. // NullFields is a list of field names (e.g. "Aggregations") to include
  2388. // in API requests with the JSON null value. By default, fields with
  2389. // empty values are omitted from API requests. However, any field with
  2390. // an empty value appearing in NullFields will be sent to the server as
  2391. // null. It is an error if a field in this list has a non-empty value.
  2392. // This may be used to include null fields in Patch requests.
  2393. NullFields []string `json:"-"`
  2394. }
  2395. func (s *MetricThreshold) MarshalJSON() ([]byte, error) {
  2396. type NoMethod MetricThreshold
  2397. raw := NoMethod(*s)
  2398. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2399. }
  2400. func (s *MetricThreshold) UnmarshalJSON(data []byte) error {
  2401. type NoMethod MetricThreshold
  2402. var s1 struct {
  2403. ThresholdValue gensupport.JSONFloat64 `json:"thresholdValue"`
  2404. *NoMethod
  2405. }
  2406. s1.NoMethod = (*NoMethod)(s)
  2407. if err := json.Unmarshal(data, &s1); err != nil {
  2408. return err
  2409. }
  2410. s.ThresholdValue = float64(s1.ThresholdValue)
  2411. return nil
  2412. }
  2413. // MonitoredResource: An object representing a resource that can be used
  2414. // for monitoring, logging, billing, or other purposes. Examples include
  2415. // virtual machine instances, databases, and storage devices such as
  2416. // disks. The type field identifies a MonitoredResourceDescriptor object
  2417. // that describes the resource's schema. Information in the labels field
  2418. // identifies the actual resource and its attributes according to the
  2419. // schema. For example, a particular Compute Engine VM instance could be
  2420. // represented by the following object, because the
  2421. // MonitoredResourceDescriptor for "gce_instance" has labels
  2422. // "instance_id" and "zone":
  2423. // { "type": "gce_instance",
  2424. // "labels": { "instance_id": "12345678901234",
  2425. // "zone": "us-central1-a" }}
  2426. //
  2427. type MonitoredResource struct {
  2428. // Labels: Required. Values for all of the labels listed in the
  2429. // associated monitored resource descriptor. For example, Compute Engine
  2430. // VM instances use the labels "project_id", "instance_id", and "zone".
  2431. Labels map[string]string `json:"labels,omitempty"`
  2432. // Type: Required. The monitored resource type. This field must match
  2433. // the type field of a MonitoredResourceDescriptor object. For example,
  2434. // the type of a Compute Engine VM instance is gce_instance. For a list
  2435. // of types, see Monitoring resource types and Logging resource types.
  2436. Type string `json:"type,omitempty"`
  2437. // ForceSendFields is a list of field names (e.g. "Labels") to
  2438. // unconditionally include in API requests. By default, fields with
  2439. // empty values are omitted from API requests. However, any non-pointer,
  2440. // non-interface field appearing in ForceSendFields will be sent to the
  2441. // server regardless of whether the field is empty or not. This may be
  2442. // used to include empty fields in Patch requests.
  2443. ForceSendFields []string `json:"-"`
  2444. // NullFields is a list of field names (e.g. "Labels") to include in API
  2445. // requests with the JSON null value. By default, fields with empty
  2446. // values are omitted from API requests. However, any field with an
  2447. // empty value appearing in NullFields will be sent to the server as
  2448. // null. It is an error if a field in this list has a non-empty value.
  2449. // This may be used to include null fields in Patch requests.
  2450. NullFields []string `json:"-"`
  2451. }
  2452. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  2453. type NoMethod MonitoredResource
  2454. raw := NoMethod(*s)
  2455. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2456. }
  2457. // MonitoredResourceDescriptor: An object that describes the schema of a
  2458. // MonitoredResource object using a type name and a set of labels. For
  2459. // example, the monitored resource descriptor for Google Compute Engine
  2460. // VM instances has a type of "gce_instance" and specifies the use of
  2461. // the labels "instance_id" and "zone" to identify particular VM
  2462. // instances.Different APIs can support different monitored resource
  2463. // types. APIs generally provide a list method that returns the
  2464. // monitored resource descriptors used by the API.
  2465. type MonitoredResourceDescriptor struct {
  2466. // Description: Optional. A detailed description of the monitored
  2467. // resource type that might be used in documentation.
  2468. Description string `json:"description,omitempty"`
  2469. // DisplayName: Optional. A concise name for the monitored resource type
  2470. // that might be displayed in user interfaces. It should be a Title
  2471. // Cased Noun Phrase, without any article or other determiners. For
  2472. // example, "Google Cloud SQL Database".
  2473. DisplayName string `json:"displayName,omitempty"`
  2474. // Labels: Required. A set of labels used to describe instances of this
  2475. // monitored resource type. For example, an individual Google Cloud SQL
  2476. // database is identified by values for the labels "database_id" and
  2477. // "zone".
  2478. Labels []*LabelDescriptor `json:"labels,omitempty"`
  2479. // Name: Optional. The resource name of the monitored resource
  2480. // descriptor:
  2481. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  2482. // {type} is the value of the type field in this object and {project_id}
  2483. // is a project ID that provides API-specific context for accessing the
  2484. // type. APIs that do not use project information can use the resource
  2485. // name format "monitoredResourceDescriptors/{type}".
  2486. Name string `json:"name,omitempty"`
  2487. // Type: Required. The monitored resource type. For example, the type
  2488. // "cloudsql_database" represents databases in Google Cloud SQL. The
  2489. // maximum length of this value is 256 characters.
  2490. Type string `json:"type,omitempty"`
  2491. // ServerResponse contains the HTTP response code and headers from the
  2492. // server.
  2493. googleapi.ServerResponse `json:"-"`
  2494. // ForceSendFields is a list of field names (e.g. "Description") to
  2495. // unconditionally include in API requests. By default, fields with
  2496. // empty values are omitted from API requests. However, any non-pointer,
  2497. // non-interface field appearing in ForceSendFields will be sent to the
  2498. // server regardless of whether the field is empty or not. This may be
  2499. // used to include empty fields in Patch requests.
  2500. ForceSendFields []string `json:"-"`
  2501. // NullFields is a list of field names (e.g. "Description") to include
  2502. // in API requests with the JSON null value. By default, fields with
  2503. // empty values are omitted from API requests. However, any field with
  2504. // an empty value appearing in NullFields will be sent to the server as
  2505. // null. It is an error if a field in this list has a non-empty value.
  2506. // This may be used to include null fields in Patch requests.
  2507. NullFields []string `json:"-"`
  2508. }
  2509. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  2510. type NoMethod MonitoredResourceDescriptor
  2511. raw := NoMethod(*s)
  2512. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2513. }
  2514. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  2515. // object. MonitoredResource objects contain the minimum set of
  2516. // information to uniquely identify a monitored resource instance. There
  2517. // is some other useful auxiliary metadata. Monitoring and Logging use
  2518. // an ingestion pipeline to extract metadata for cloud resources of all
  2519. // types, and store the metadata in this message.
  2520. type MonitoredResourceMetadata struct {
  2521. // SystemLabels: Output only. Values for predefined system metadata
  2522. // labels. System labels are a kind of metadata extracted by Google,
  2523. // including "machine_image", "vpc", "subnet_id", "security_group",
  2524. // "name", etc. System label values can be only strings, Boolean values,
  2525. // or a list of strings. For example:
  2526. // { "name": "my-test-instance",
  2527. // "security_group": ["a", "b", "c"],
  2528. // "spot_instance": false }
  2529. //
  2530. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  2531. // UserLabels: Output only. A map of user-defined metadata labels.
  2532. UserLabels map[string]string `json:"userLabels,omitempty"`
  2533. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  2534. // unconditionally include in API requests. By default, fields with
  2535. // empty values are omitted from API requests. However, any non-pointer,
  2536. // non-interface field appearing in ForceSendFields will be sent to the
  2537. // server regardless of whether the field is empty or not. This may be
  2538. // used to include empty fields in Patch requests.
  2539. ForceSendFields []string `json:"-"`
  2540. // NullFields is a list of field names (e.g. "SystemLabels") to include
  2541. // in API requests with the JSON null value. By default, fields with
  2542. // empty values are omitted from API requests. However, any field with
  2543. // an empty value appearing in NullFields will be sent to the server as
  2544. // null. It is an error if a field in this list has a non-empty value.
  2545. // This may be used to include null fields in Patch requests.
  2546. NullFields []string `json:"-"`
  2547. }
  2548. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  2549. type NoMethod MonitoredResourceMetadata
  2550. raw := NoMethod(*s)
  2551. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2552. }
  2553. // MutationRecord: Describes a change made to a configuration.
  2554. type MutationRecord struct {
  2555. // MutateTime: When the change occurred.
  2556. MutateTime string `json:"mutateTime,omitempty"`
  2557. // MutatedBy: The email address of the user making the change.
  2558. MutatedBy string `json:"mutatedBy,omitempty"`
  2559. // ForceSendFields is a list of field names (e.g. "MutateTime") to
  2560. // unconditionally include in API requests. By default, fields with
  2561. // empty values are omitted from API requests. However, any non-pointer,
  2562. // non-interface field appearing in ForceSendFields will be sent to the
  2563. // server regardless of whether the field is empty or not. This may be
  2564. // used to include empty fields in Patch requests.
  2565. ForceSendFields []string `json:"-"`
  2566. // NullFields is a list of field names (e.g. "MutateTime") to include in
  2567. // API requests with the JSON null value. By default, fields with empty
  2568. // values are omitted from API requests. However, any field with an
  2569. // empty value appearing in NullFields will be sent to the server as
  2570. // null. It is an error if a field in this list has a non-empty value.
  2571. // This may be used to include null fields in Patch requests.
  2572. NullFields []string `json:"-"`
  2573. }
  2574. func (s *MutationRecord) MarshalJSON() ([]byte, error) {
  2575. type NoMethod MutationRecord
  2576. raw := NoMethod(*s)
  2577. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2578. }
  2579. // NotificationChannel: A NotificationChannel is a medium through which
  2580. // an alert is delivered when a policy violation is detected. Examples
  2581. // of channels include email, SMS, and third-party messaging
  2582. // applications. Fields containing sensitive information like
  2583. // authentication tokens or contact info are only partially populated on
  2584. // retrieval.
  2585. type NotificationChannel struct {
  2586. // Description: An optional human-readable description of this
  2587. // notification channel. This description may provide additional
  2588. // details, beyond the display name, for the channel. This may not
  2589. // exceeed 1024 Unicode characters.
  2590. Description string `json:"description,omitempty"`
  2591. // DisplayName: An optional human-readable name for this notification
  2592. // channel. It is recommended that you specify a non-empty and unique
  2593. // name in order to make it easier to identify the channels in your
  2594. // project, though this is not enforced. The display name is limited to
  2595. // 512 Unicode characters.
  2596. DisplayName string `json:"displayName,omitempty"`
  2597. // Enabled: Whether notifications are forwarded to the described
  2598. // channel. This makes it possible to disable delivery of notifications
  2599. // to a particular channel without removing the channel from all
  2600. // alerting policies that reference the channel. This is a more
  2601. // convenient approach when the change is temporary and you want to
  2602. // receive notifications from the same set of alerting policies on the
  2603. // channel at some point in the future.
  2604. Enabled bool `json:"enabled,omitempty"`
  2605. // Labels: Configuration fields that define the channel and its
  2606. // behavior. The permissible and required labels are specified in the
  2607. // NotificationChannelDescriptor.labels of the
  2608. // NotificationChannelDescriptor corresponding to the type field.
  2609. Labels map[string]string `json:"labels,omitempty"`
  2610. // Name: The full REST resource name for this channel. The syntax
  2611. // is:
  2612. // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
  2613. // The [CHANNEL_ID] is automatically assigned by the server on creation.
  2614. Name string `json:"name,omitempty"`
  2615. // Type: The type of the notification channel. This field matches the
  2616. // value of the NotificationChannelDescriptor.type field.
  2617. Type string `json:"type,omitempty"`
  2618. // UserLabels: User-supplied key/value data that does not need to
  2619. // conform to the corresponding NotificationChannelDescriptor's schema,
  2620. // unlike the labels field. This field is intended to be used for
  2621. // organizing and identifying the NotificationChannel objects.The field
  2622. // can contain up to 64 entries. Each key and value is limited to 63
  2623. // Unicode characters or 128 bytes, whichever is smaller. Labels and
  2624. // values can contain only lowercase letters, numerals, underscores, and
  2625. // dashes. Keys must begin with a letter.
  2626. UserLabels map[string]string `json:"userLabels,omitempty"`
  2627. // VerificationStatus: Indicates whether this channel has been verified
  2628. // or not. On a ListNotificationChannels or GetNotificationChannel
  2629. // operation, this field is expected to be populated.If the value is
  2630. // UNVERIFIED, then it indicates that the channel is non-functioning (it
  2631. // both requires verification and lacks verification); otherwise, it is
  2632. // assumed that the channel works.If the channel is neither VERIFIED nor
  2633. // UNVERIFIED, it implies that the channel is of a type that does not
  2634. // require verification or that this specific channel has been exempted
  2635. // from verification because it was created prior to verification being
  2636. // required for channels of this type.This field cannot be modified
  2637. // using a standard UpdateNotificationChannel operation. To change the
  2638. // value of this field, you must call VerifyNotificationChannel.
  2639. //
  2640. // Possible values:
  2641. // "VERIFICATION_STATUS_UNSPECIFIED" - Sentinel value used to indicate
  2642. // that the state is unknown, omitted, or is not applicable (as in the
  2643. // case of channels that neither support nor require verification in
  2644. // order to function).
  2645. // "UNVERIFIED" - The channel has yet to be verified and requires
  2646. // verification to function. Note that this state also applies to the
  2647. // case where the verification process has been initiated by sending a
  2648. // verification code but where the verification code has not been
  2649. // submitted to complete the process.
  2650. // "VERIFIED" - It has been proven that notifications can be received
  2651. // on this notification channel and that someone on the project has
  2652. // access to messages that are delivered to that channel.
  2653. VerificationStatus string `json:"verificationStatus,omitempty"`
  2654. // ServerResponse contains the HTTP response code and headers from the
  2655. // server.
  2656. googleapi.ServerResponse `json:"-"`
  2657. // ForceSendFields is a list of field names (e.g. "Description") to
  2658. // unconditionally include in API requests. By default, fields with
  2659. // empty values are omitted from API requests. However, any non-pointer,
  2660. // non-interface field appearing in ForceSendFields will be sent to the
  2661. // server regardless of whether the field is empty or not. This may be
  2662. // used to include empty fields in Patch requests.
  2663. ForceSendFields []string `json:"-"`
  2664. // NullFields is a list of field names (e.g. "Description") to include
  2665. // in API requests with the JSON null value. By default, fields with
  2666. // empty values are omitted from API requests. However, any field with
  2667. // an empty value appearing in NullFields will be sent to the server as
  2668. // null. It is an error if a field in this list has a non-empty value.
  2669. // This may be used to include null fields in Patch requests.
  2670. NullFields []string `json:"-"`
  2671. }
  2672. func (s *NotificationChannel) MarshalJSON() ([]byte, error) {
  2673. type NoMethod NotificationChannel
  2674. raw := NoMethod(*s)
  2675. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2676. }
  2677. // NotificationChannelDescriptor: A description of a notification
  2678. // channel. The descriptor includes the properties of the channel and
  2679. // the set of labels or fields that must be specified to configure
  2680. // channels of a given type.
  2681. type NotificationChannelDescriptor struct {
  2682. // Description: A human-readable description of the notification channel
  2683. // type. The description may include a description of the properties of
  2684. // the channel and pointers to external documentation.
  2685. Description string `json:"description,omitempty"`
  2686. // DisplayName: A human-readable name for the notification channel type.
  2687. // This form of the name is suitable for a user interface.
  2688. DisplayName string `json:"displayName,omitempty"`
  2689. // Labels: The set of labels that must be defined to identify a
  2690. // particular channel of the corresponding type. Each label includes a
  2691. // description for how that field should be populated.
  2692. Labels []*LabelDescriptor `json:"labels,omitempty"`
  2693. // Name: The full REST resource name for this descriptor. The syntax
  2694. // is:
  2695. // projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE]
  2696. // In the above, [TYPE] is the value of the type field.
  2697. Name string `json:"name,omitempty"`
  2698. // SupportedTiers: The tiers that support this notification channel; the
  2699. // project service tier must be one of the supported_tiers.
  2700. //
  2701. // Possible values:
  2702. // "SERVICE_TIER_UNSPECIFIED" - An invalid sentinel value, used to
  2703. // indicate that a tier has not been provided explicitly.
  2704. // "SERVICE_TIER_BASIC" - The Stackdriver Basic tier, a free tier of
  2705. // service that provides basic features, a moderate allotment of logs,
  2706. // and access to built-in metrics. A number of features are not
  2707. // available in this tier. For more details, see the service tiers
  2708. // documentation (https://cloud.google.com/monitoring/workspaces/tiers).
  2709. // "SERVICE_TIER_PREMIUM" - The Stackdriver Premium tier, a higher,
  2710. // more expensive tier of service that provides access to all
  2711. // Stackdriver features, lets you use Stackdriver with AWS accounts, and
  2712. // has a larger allotments for logs and metrics. For more details, see
  2713. // the service tiers documentation
  2714. // (https://cloud.google.com/monitoring/workspaces/tiers).
  2715. SupportedTiers []string `json:"supportedTiers,omitempty"`
  2716. // Type: The type of notification channel, such as "email", "sms", etc.
  2717. // Notification channel types are globally unique.
  2718. Type string `json:"type,omitempty"`
  2719. // ServerResponse contains the HTTP response code and headers from the
  2720. // server.
  2721. googleapi.ServerResponse `json:"-"`
  2722. // ForceSendFields is a list of field names (e.g. "Description") to
  2723. // unconditionally include in API requests. By default, fields with
  2724. // empty values are omitted from API requests. However, any non-pointer,
  2725. // non-interface field appearing in ForceSendFields will be sent to the
  2726. // server regardless of whether the field is empty or not. This may be
  2727. // used to include empty fields in Patch requests.
  2728. ForceSendFields []string `json:"-"`
  2729. // NullFields is a list of field names (e.g. "Description") to include
  2730. // in API requests with the JSON null value. By default, fields with
  2731. // empty values are omitted from API requests. However, any field with
  2732. // an empty value appearing in NullFields will be sent to the server as
  2733. // null. It is an error if a field in this list has a non-empty value.
  2734. // This may be used to include null fields in Patch requests.
  2735. NullFields []string `json:"-"`
  2736. }
  2737. func (s *NotificationChannelDescriptor) MarshalJSON() ([]byte, error) {
  2738. type NoMethod NotificationChannelDescriptor
  2739. raw := NoMethod(*s)
  2740. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2741. }
  2742. // Option: A protocol buffer option, which can be attached to a message,
  2743. // field, enumeration, etc.
  2744. type Option struct {
  2745. // Name: The option's name. For protobuf built-in options (options
  2746. // defined in descriptor.proto), this is the short name. For example,
  2747. // "map_entry". For custom options, it should be the fully-qualified
  2748. // name. For example, "google.api.http".
  2749. Name string `json:"name,omitempty"`
  2750. // Value: The option's value packed in an Any message. If the value is a
  2751. // primitive, the corresponding wrapper type defined in
  2752. // google/protobuf/wrappers.proto should be used. If the value is an
  2753. // enum, it should be stored as an int32 value using the
  2754. // google.protobuf.Int32Value type.
  2755. Value googleapi.RawMessage `json:"value,omitempty"`
  2756. // ForceSendFields is a list of field names (e.g. "Name") to
  2757. // unconditionally include in API requests. By default, fields with
  2758. // empty values are omitted from API requests. However, any non-pointer,
  2759. // non-interface field appearing in ForceSendFields will be sent to the
  2760. // server regardless of whether the field is empty or not. This may be
  2761. // used to include empty fields in Patch requests.
  2762. ForceSendFields []string `json:"-"`
  2763. // NullFields is a list of field names (e.g. "Name") to include in API
  2764. // requests with the JSON null value. By default, fields with empty
  2765. // values are omitted from API requests. However, any field with an
  2766. // empty value appearing in NullFields will be sent to the server as
  2767. // null. It is an error if a field in this list has a non-empty value.
  2768. // This may be used to include null fields in Patch requests.
  2769. NullFields []string `json:"-"`
  2770. }
  2771. func (s *Option) MarshalJSON() ([]byte, error) {
  2772. type NoMethod Option
  2773. raw := NoMethod(*s)
  2774. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2775. }
  2776. // Point: A single data point in a time series.
  2777. type Point struct {
  2778. // Interval: The time interval to which the data point applies. For
  2779. // GAUGE metrics, only the end time of the interval is used. For DELTA
  2780. // metrics, the start and end time should specify a non-zero interval,
  2781. // with subsequent points specifying contiguous and non-overlapping
  2782. // intervals. For CUMULATIVE metrics, the start and end time should
  2783. // specify a non-zero interval, with subsequent points specifying the
  2784. // same start time and increasing end times, until an event resets the
  2785. // cumulative value to zero and sets a new start time for the following
  2786. // points.
  2787. Interval *TimeInterval `json:"interval,omitempty"`
  2788. // Value: The value of the data point.
  2789. Value *TypedValue `json:"value,omitempty"`
  2790. // ForceSendFields is a list of field names (e.g. "Interval") to
  2791. // unconditionally include in API requests. By default, fields with
  2792. // empty values are omitted from API requests. However, any non-pointer,
  2793. // non-interface field appearing in ForceSendFields will be sent to the
  2794. // server regardless of whether the field is empty or not. This may be
  2795. // used to include empty fields in Patch requests.
  2796. ForceSendFields []string `json:"-"`
  2797. // NullFields is a list of field names (e.g. "Interval") to include in
  2798. // API requests with the JSON null value. By default, fields with empty
  2799. // values are omitted from API requests. However, any field with an
  2800. // empty value appearing in NullFields will be sent to the server as
  2801. // null. It is an error if a field in this list has a non-empty value.
  2802. // This may be used to include null fields in Patch requests.
  2803. NullFields []string `json:"-"`
  2804. }
  2805. func (s *Point) MarshalJSON() ([]byte, error) {
  2806. type NoMethod Point
  2807. raw := NoMethod(*s)
  2808. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2809. }
  2810. // Range: The range of the population values.
  2811. type Range struct {
  2812. // Max: The maximum of the population values.
  2813. Max float64 `json:"max,omitempty"`
  2814. // Min: The minimum of the population values.
  2815. Min float64 `json:"min,omitempty"`
  2816. // ForceSendFields is a list of field names (e.g. "Max") to
  2817. // unconditionally include in API requests. By default, fields with
  2818. // empty values are omitted from API requests. However, any non-pointer,
  2819. // non-interface field appearing in ForceSendFields will be sent to the
  2820. // server regardless of whether the field is empty or not. This may be
  2821. // used to include empty fields in Patch requests.
  2822. ForceSendFields []string `json:"-"`
  2823. // NullFields is a list of field names (e.g. "Max") to include in API
  2824. // requests with the JSON null value. By default, fields with empty
  2825. // values are omitted from API requests. However, any field with an
  2826. // empty value appearing in NullFields will be sent to the server as
  2827. // null. It is an error if a field in this list has a non-empty value.
  2828. // This may be used to include null fields in Patch requests.
  2829. NullFields []string `json:"-"`
  2830. }
  2831. func (s *Range) MarshalJSON() ([]byte, error) {
  2832. type NoMethod Range
  2833. raw := NoMethod(*s)
  2834. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2835. }
  2836. func (s *Range) UnmarshalJSON(data []byte) error {
  2837. type NoMethod Range
  2838. var s1 struct {
  2839. Max gensupport.JSONFloat64 `json:"max"`
  2840. Min gensupport.JSONFloat64 `json:"min"`
  2841. *NoMethod
  2842. }
  2843. s1.NoMethod = (*NoMethod)(s)
  2844. if err := json.Unmarshal(data, &s1); err != nil {
  2845. return err
  2846. }
  2847. s.Max = float64(s1.Max)
  2848. s.Min = float64(s1.Min)
  2849. return nil
  2850. }
  2851. // ResourceGroup: The resource submessage for group checks. It can be
  2852. // used instead of a monitored resource, when multiple resources are
  2853. // being monitored.
  2854. type ResourceGroup struct {
  2855. // GroupId: The group of resources being monitored. Should be only the
  2856. // group_id, not projects/<project_id>/groups/<group_id>.
  2857. GroupId string `json:"groupId,omitempty"`
  2858. // ResourceType: The resource type of the group members.
  2859. //
  2860. // Possible values:
  2861. // "RESOURCE_TYPE_UNSPECIFIED" - Default value (not valid).
  2862. // "INSTANCE" - A group of instances from Google Cloud Platform (GCP)
  2863. // or Amazon Web Services (AWS).
  2864. // "AWS_ELB_LOAD_BALANCER" - A group of Amazon ELB load balancers.
  2865. ResourceType string `json:"resourceType,omitempty"`
  2866. // ForceSendFields is a list of field names (e.g. "GroupId") to
  2867. // unconditionally include in API requests. By default, fields with
  2868. // empty values are omitted from API requests. However, any non-pointer,
  2869. // non-interface field appearing in ForceSendFields will be sent to the
  2870. // server regardless of whether the field is empty or not. This may be
  2871. // used to include empty fields in Patch requests.
  2872. ForceSendFields []string `json:"-"`
  2873. // NullFields is a list of field names (e.g. "GroupId") to include in
  2874. // API requests with the JSON null value. By default, fields with empty
  2875. // values are omitted from API requests. However, any field with an
  2876. // empty value appearing in NullFields will be sent to the server as
  2877. // null. It is an error if a field in this list has a non-empty value.
  2878. // This may be used to include null fields in Patch requests.
  2879. NullFields []string `json:"-"`
  2880. }
  2881. func (s *ResourceGroup) MarshalJSON() ([]byte, error) {
  2882. type NoMethod ResourceGroup
  2883. raw := NoMethod(*s)
  2884. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2885. }
  2886. // SendNotificationChannelVerificationCodeRequest: The
  2887. // SendNotificationChannelVerificationCode request.
  2888. type SendNotificationChannelVerificationCodeRequest struct {
  2889. }
  2890. // SourceContext: SourceContext represents information about the source
  2891. // of a protobuf element, like the file in which it is defined.
  2892. type SourceContext struct {
  2893. // FileName: The path-qualified name of the .proto file that contained
  2894. // the associated protobuf element. For example:
  2895. // "google/protobuf/source_context.proto".
  2896. FileName string `json:"fileName,omitempty"`
  2897. // ForceSendFields is a list of field names (e.g. "FileName") to
  2898. // unconditionally include in API requests. By default, fields with
  2899. // empty values are omitted from API requests. However, any non-pointer,
  2900. // non-interface field appearing in ForceSendFields will be sent to the
  2901. // server regardless of whether the field is empty or not. This may be
  2902. // used to include empty fields in Patch requests.
  2903. ForceSendFields []string `json:"-"`
  2904. // NullFields is a list of field names (e.g. "FileName") to include in
  2905. // API requests with the JSON null value. By default, fields with empty
  2906. // values are omitted from API requests. However, any field with an
  2907. // empty value appearing in NullFields will be sent to the server as
  2908. // null. It is an error if a field in this list has a non-empty value.
  2909. // This may be used to include null fields in Patch requests.
  2910. NullFields []string `json:"-"`
  2911. }
  2912. func (s *SourceContext) MarshalJSON() ([]byte, error) {
  2913. type NoMethod SourceContext
  2914. raw := NoMethod(*s)
  2915. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2916. }
  2917. // SpanContext: The context of a span, attached to
  2918. // google.api.Distribution.Exemplars in google.api.Distribution values
  2919. // during aggregation.It contains the name of a span with format:
  2920. // projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID
  2921. type SpanContext struct {
  2922. // SpanName: The resource name of the span in the following
  2923. // format:
  2924. // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
  2925. // TRACE_
  2926. // ID is a unique identifier for a trace within a project; it is a
  2927. // 32-character hexadecimal encoding of a 16-byte array.SPAN_ID is a
  2928. // unique identifier for a span within a trace; it is a 16-character
  2929. // hexadecimal encoding of an 8-byte array.
  2930. SpanName string `json:"spanName,omitempty"`
  2931. // ForceSendFields is a list of field names (e.g. "SpanName") to
  2932. // unconditionally include in API requests. By default, fields with
  2933. // empty values are omitted from API requests. However, any non-pointer,
  2934. // non-interface field appearing in ForceSendFields will be sent to the
  2935. // server regardless of whether the field is empty or not. This may be
  2936. // used to include empty fields in Patch requests.
  2937. ForceSendFields []string `json:"-"`
  2938. // NullFields is a list of field names (e.g. "SpanName") to include in
  2939. // API requests with the JSON null value. By default, fields with empty
  2940. // values are omitted from API requests. However, any field with an
  2941. // empty value appearing in NullFields will be sent to the server as
  2942. // null. It is an error if a field in this list has a non-empty value.
  2943. // This may be used to include null fields in Patch requests.
  2944. NullFields []string `json:"-"`
  2945. }
  2946. func (s *SpanContext) MarshalJSON() ([]byte, error) {
  2947. type NoMethod SpanContext
  2948. raw := NoMethod(*s)
  2949. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2950. }
  2951. // Status: The Status type defines a logical error model that is
  2952. // suitable for different programming environments, including REST APIs
  2953. // and RPC APIs. It is used by gRPC (https://github.com/grpc). The error
  2954. // model is designed to be:
  2955. // Simple to use and understand for most users
  2956. // Flexible enough to meet unexpected needsOverviewThe Status message
  2957. // contains three pieces of data: error code, error message, and error
  2958. // details. The error code should be an enum value of google.rpc.Code,
  2959. // but it may accept additional error codes if needed. The error message
  2960. // should be a developer-facing English message that helps developers
  2961. // understand and resolve the error. If a localized user-facing error
  2962. // message is needed, put the localized message in the error details or
  2963. // localize it in the client. The optional error details may contain
  2964. // arbitrary information about the error. There is a predefined set of
  2965. // error detail types in the package google.rpc that can be used for
  2966. // common error conditions.Language mappingThe Status message is the
  2967. // logical representation of the error model, but it is not necessarily
  2968. // the actual wire format. When the Status message is exposed in
  2969. // different client libraries and different wire protocols, it can be
  2970. // mapped differently. For example, it will likely be mapped to some
  2971. // exceptions in Java, but more likely mapped to some error codes in
  2972. // C.Other usesThe error model and the Status message can be used in a
  2973. // variety of environments, either with or without APIs, to provide a
  2974. // consistent developer experience across different environments.Example
  2975. // uses of this error model include:
  2976. // Partial errors. If a service needs to return partial errors to the
  2977. // client, it may embed the Status in the normal response to indicate
  2978. // the partial errors.
  2979. // Workflow errors. A typical workflow has multiple steps. Each step may
  2980. // have a Status message for error reporting.
  2981. // Batch operations. If a client uses batch request and batch response,
  2982. // the Status message should be used directly inside batch response, one
  2983. // for each error sub-response.
  2984. // Asynchronous operations. If an API call embeds asynchronous operation
  2985. // results in its response, the status of those operations should be
  2986. // represented directly using the Status message.
  2987. // Logging. If some API errors are stored in logs, the message Status
  2988. // could be used directly after any stripping needed for
  2989. // security/privacy reasons.
  2990. type Status struct {
  2991. // Code: The status code, which should be an enum value of
  2992. // google.rpc.Code.
  2993. Code int64 `json:"code,omitempty"`
  2994. // Details: A list of messages that carry the error details. There is a
  2995. // common set of message types for APIs to use.
  2996. Details []googleapi.RawMessage `json:"details,omitempty"`
  2997. // Message: A developer-facing error message, which should be in
  2998. // English. Any user-facing error message should be localized and sent
  2999. // in the google.rpc.Status.details field, or localized by the client.
  3000. Message string `json:"message,omitempty"`
  3001. // ForceSendFields is a list of field names (e.g. "Code") to
  3002. // unconditionally include in API requests. By default, fields with
  3003. // empty values are omitted from API requests. However, any non-pointer,
  3004. // non-interface field appearing in ForceSendFields will be sent to the
  3005. // server regardless of whether the field is empty or not. This may be
  3006. // used to include empty fields in Patch requests.
  3007. ForceSendFields []string `json:"-"`
  3008. // NullFields is a list of field names (e.g. "Code") to include in API
  3009. // requests with the JSON null value. By default, fields with empty
  3010. // values are omitted from API requests. However, any field with an
  3011. // empty value appearing in NullFields will be sent to the server as
  3012. // null. It is an error if a field in this list has a non-empty value.
  3013. // This may be used to include null fields in Patch requests.
  3014. NullFields []string `json:"-"`
  3015. }
  3016. func (s *Status) MarshalJSON() ([]byte, error) {
  3017. type NoMethod Status
  3018. raw := NoMethod(*s)
  3019. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3020. }
  3021. // TcpCheck: Information required for a TCP uptime check request.
  3022. type TcpCheck struct {
  3023. // Port: The port to the page to run the check against. Will be combined
  3024. // with host (specified within the MonitoredResource) to construct the
  3025. // full URL. Required.
  3026. Port int64 `json:"port,omitempty"`
  3027. // ForceSendFields is a list of field names (e.g. "Port") to
  3028. // unconditionally include in API requests. By default, fields with
  3029. // empty values are omitted from API requests. However, any non-pointer,
  3030. // non-interface field appearing in ForceSendFields will be sent to the
  3031. // server regardless of whether the field is empty or not. This may be
  3032. // used to include empty fields in Patch requests.
  3033. ForceSendFields []string `json:"-"`
  3034. // NullFields is a list of field names (e.g. "Port") to include in API
  3035. // requests with the JSON null value. By default, fields with empty
  3036. // values are omitted from API requests. However, any field with an
  3037. // empty value appearing in NullFields will be sent to the server as
  3038. // null. It is an error if a field in this list has a non-empty value.
  3039. // This may be used to include null fields in Patch requests.
  3040. NullFields []string `json:"-"`
  3041. }
  3042. func (s *TcpCheck) MarshalJSON() ([]byte, error) {
  3043. type NoMethod TcpCheck
  3044. raw := NoMethod(*s)
  3045. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3046. }
  3047. // TimeInterval: A time interval extending just after a start time
  3048. // through an end time. The start time must not be later than the end
  3049. // time. The default start time is the end time, making the startTime
  3050. // value technically optional. Whether this is useful depends on the
  3051. // MetricKind. If the start and end times are the same, the interval
  3052. // represents a point in time. This is appropriate for GAUGE metrics,
  3053. // but not for DELTA and CUMULATIVE metrics, which cover a span of time.
  3054. type TimeInterval struct {
  3055. // EndTime: Required. The end of the time interval.
  3056. EndTime string `json:"endTime,omitempty"`
  3057. // StartTime: Optional. The beginning of the time interval. The default
  3058. // value for the start time is the end time. The start time must not be
  3059. // later than the end time.
  3060. StartTime string `json:"startTime,omitempty"`
  3061. // ForceSendFields is a list of field names (e.g. "EndTime") to
  3062. // unconditionally include in API requests. By default, fields with
  3063. // empty values are omitted from API requests. However, any non-pointer,
  3064. // non-interface field appearing in ForceSendFields will be sent to the
  3065. // server regardless of whether the field is empty or not. This may be
  3066. // used to include empty fields in Patch requests.
  3067. ForceSendFields []string `json:"-"`
  3068. // NullFields is a list of field names (e.g. "EndTime") to include in
  3069. // API requests with the JSON null value. By default, fields with empty
  3070. // values are omitted from API requests. However, any field with an
  3071. // empty value appearing in NullFields will be sent to the server as
  3072. // null. It is an error if a field in this list has a non-empty value.
  3073. // This may be used to include null fields in Patch requests.
  3074. NullFields []string `json:"-"`
  3075. }
  3076. func (s *TimeInterval) MarshalJSON() ([]byte, error) {
  3077. type NoMethod TimeInterval
  3078. raw := NoMethod(*s)
  3079. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3080. }
  3081. // TimeSeries: A collection of data points that describes the
  3082. // time-varying values of a metric. A time series is identified by a
  3083. // combination of a fully-specified monitored resource and a
  3084. // fully-specified metric. This type is used for both listing and
  3085. // creating time series.
  3086. type TimeSeries struct {
  3087. // Metadata: Output only. The associated monitored resource metadata.
  3088. // When reading a a timeseries, this field will include metadata labels
  3089. // that are explicitly named in the reduction. When creating a
  3090. // timeseries, this field is ignored.
  3091. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  3092. // Metric: The associated metric. A fully-specified metric used to
  3093. // identify the time series.
  3094. Metric *Metric `json:"metric,omitempty"`
  3095. // MetricKind: The metric kind of the time series. When listing time
  3096. // series, this metric kind might be different from the metric kind of
  3097. // the associated metric if this time series is an alignment or
  3098. // reduction of other time series.When creating a time series, this
  3099. // field is optional. If present, it must be the same as the metric kind
  3100. // of the associated metric. If the associated metric's descriptor must
  3101. // be auto-created, then this field specifies the metric kind of the new
  3102. // descriptor and must be either GAUGE (the default) or CUMULATIVE.
  3103. //
  3104. // Possible values:
  3105. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  3106. // "GAUGE" - An instantaneous measurement of a value.
  3107. // "DELTA" - The change in a value during a time interval.
  3108. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  3109. // measurements in a time series should have the same start time and
  3110. // increasing end times, until an event resets the cumulative value to
  3111. // zero and sets a new start time for the following points.
  3112. MetricKind string `json:"metricKind,omitempty"`
  3113. // Points: The data points of this time series. When listing time
  3114. // series, points are returned in reverse time order.When creating a
  3115. // time series, this field must contain exactly one point and the
  3116. // point's type must be the same as the value type of the associated
  3117. // metric. If the associated metric's descriptor must be auto-created,
  3118. // then the value type of the descriptor is determined by the point's
  3119. // type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.
  3120. Points []*Point `json:"points,omitempty"`
  3121. // Resource: The associated monitored resource. Custom metrics can use
  3122. // only certain monitored resource types in their time series data.
  3123. Resource *MonitoredResource `json:"resource,omitempty"`
  3124. // ValueType: The value type of the time series. When listing time
  3125. // series, this value type might be different from the value type of the
  3126. // associated metric if this time series is an alignment or reduction of
  3127. // other time series.When creating a time series, this field is
  3128. // optional. If present, it must be the same as the type of the data in
  3129. // the points field.
  3130. //
  3131. // Possible values:
  3132. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  3133. // "BOOL" - The value is a boolean. This value type can be used only
  3134. // if the metric kind is GAUGE.
  3135. // "INT64" - The value is a signed 64-bit integer.
  3136. // "DOUBLE" - The value is a double precision floating point number.
  3137. // "STRING" - The value is a text string. This value type can be used
  3138. // only if the metric kind is GAUGE.
  3139. // "DISTRIBUTION" - The value is a Distribution.
  3140. // "MONEY" - The value is money.
  3141. ValueType string `json:"valueType,omitempty"`
  3142. // ForceSendFields is a list of field names (e.g. "Metadata") to
  3143. // unconditionally include in API requests. By default, fields with
  3144. // empty values are omitted from API requests. However, any non-pointer,
  3145. // non-interface field appearing in ForceSendFields will be sent to the
  3146. // server regardless of whether the field is empty or not. This may be
  3147. // used to include empty fields in Patch requests.
  3148. ForceSendFields []string `json:"-"`
  3149. // NullFields is a list of field names (e.g. "Metadata") to include in
  3150. // API requests with the JSON null value. By default, fields with empty
  3151. // values are omitted from API requests. However, any field with an
  3152. // empty value appearing in NullFields will be sent to the server as
  3153. // null. It is an error if a field in this list has a non-empty value.
  3154. // This may be used to include null fields in Patch requests.
  3155. NullFields []string `json:"-"`
  3156. }
  3157. func (s *TimeSeries) MarshalJSON() ([]byte, error) {
  3158. type NoMethod TimeSeries
  3159. raw := NoMethod(*s)
  3160. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3161. }
  3162. // Trigger: Specifies how many time series must fail a predicate to
  3163. // trigger a condition. If not specified, then a {count: 1} trigger is
  3164. // used.
  3165. type Trigger struct {
  3166. // Count: The absolute number of time series that must fail the
  3167. // predicate for the condition to be triggered.
  3168. Count int64 `json:"count,omitempty"`
  3169. // Percent: The percentage of time series that must fail the predicate
  3170. // for the condition to be triggered.
  3171. Percent float64 `json:"percent,omitempty"`
  3172. // ForceSendFields is a list of field names (e.g. "Count") to
  3173. // unconditionally include in API requests. By default, fields with
  3174. // empty values are omitted from API requests. However, any non-pointer,
  3175. // non-interface field appearing in ForceSendFields will be sent to the
  3176. // server regardless of whether the field is empty or not. This may be
  3177. // used to include empty fields in Patch requests.
  3178. ForceSendFields []string `json:"-"`
  3179. // NullFields is a list of field names (e.g. "Count") to include in API
  3180. // requests with the JSON null value. By default, fields with empty
  3181. // values are omitted from API requests. However, any field with an
  3182. // empty value appearing in NullFields will be sent to the server as
  3183. // null. It is an error if a field in this list has a non-empty value.
  3184. // This may be used to include null fields in Patch requests.
  3185. NullFields []string `json:"-"`
  3186. }
  3187. func (s *Trigger) MarshalJSON() ([]byte, error) {
  3188. type NoMethod Trigger
  3189. raw := NoMethod(*s)
  3190. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3191. }
  3192. func (s *Trigger) UnmarshalJSON(data []byte) error {
  3193. type NoMethod Trigger
  3194. var s1 struct {
  3195. Percent gensupport.JSONFloat64 `json:"percent"`
  3196. *NoMethod
  3197. }
  3198. s1.NoMethod = (*NoMethod)(s)
  3199. if err := json.Unmarshal(data, &s1); err != nil {
  3200. return err
  3201. }
  3202. s.Percent = float64(s1.Percent)
  3203. return nil
  3204. }
  3205. // Type: A protocol buffer message type.
  3206. type Type struct {
  3207. // Fields: The list of fields.
  3208. Fields []*Field `json:"fields,omitempty"`
  3209. // Name: The fully qualified message name.
  3210. Name string `json:"name,omitempty"`
  3211. // Oneofs: The list of types appearing in oneof definitions in this
  3212. // type.
  3213. Oneofs []string `json:"oneofs,omitempty"`
  3214. // Options: The protocol buffer options.
  3215. Options []*Option `json:"options,omitempty"`
  3216. // SourceContext: The source context.
  3217. SourceContext *SourceContext `json:"sourceContext,omitempty"`
  3218. // Syntax: The source syntax.
  3219. //
  3220. // Possible values:
  3221. // "SYNTAX_PROTO2" - Syntax proto2.
  3222. // "SYNTAX_PROTO3" - Syntax proto3.
  3223. Syntax string `json:"syntax,omitempty"`
  3224. // ForceSendFields is a list of field names (e.g. "Fields") to
  3225. // unconditionally include in API requests. By default, fields with
  3226. // empty values are omitted from API requests. However, any non-pointer,
  3227. // non-interface field appearing in ForceSendFields will be sent to the
  3228. // server regardless of whether the field is empty or not. This may be
  3229. // used to include empty fields in Patch requests.
  3230. ForceSendFields []string `json:"-"`
  3231. // NullFields is a list of field names (e.g. "Fields") to include in API
  3232. // requests with the JSON null value. By default, fields with empty
  3233. // values are omitted from API requests. However, any field with an
  3234. // empty value appearing in NullFields will be sent to the server as
  3235. // null. It is an error if a field in this list has a non-empty value.
  3236. // This may be used to include null fields in Patch requests.
  3237. NullFields []string `json:"-"`
  3238. }
  3239. func (s *Type) MarshalJSON() ([]byte, error) {
  3240. type NoMethod Type
  3241. raw := NoMethod(*s)
  3242. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3243. }
  3244. // TypedValue: A single strongly-typed value.
  3245. type TypedValue struct {
  3246. // BoolValue: A Boolean value: true or false.
  3247. BoolValue *bool `json:"boolValue,omitempty"`
  3248. // DistributionValue: A distribution value.
  3249. DistributionValue *Distribution `json:"distributionValue,omitempty"`
  3250. // DoubleValue: A 64-bit double-precision floating-point number. Its
  3251. // magnitude is approximately &plusmn;10<sup>&plusmn;300</sup> and it
  3252. // has 16 significant digits of precision.
  3253. DoubleValue *float64 `json:"doubleValue,omitempty"`
  3254. // Int64Value: A 64-bit integer. Its range is approximately
  3255. // &plusmn;9.2x10<sup>18</sup>.
  3256. Int64Value *int64 `json:"int64Value,omitempty,string"`
  3257. // StringValue: A variable-length string value.
  3258. StringValue *string `json:"stringValue,omitempty"`
  3259. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  3260. // unconditionally include in API requests. By default, fields with
  3261. // empty values are omitted from API requests. However, any non-pointer,
  3262. // non-interface field appearing in ForceSendFields will be sent to the
  3263. // server regardless of whether the field is empty or not. This may be
  3264. // used to include empty fields in Patch requests.
  3265. ForceSendFields []string `json:"-"`
  3266. // NullFields is a list of field names (e.g. "BoolValue") to include in
  3267. // API requests with the JSON null value. By default, fields with empty
  3268. // values are omitted from API requests. However, any field with an
  3269. // empty value appearing in NullFields will be sent to the server as
  3270. // null. It is an error if a field in this list has a non-empty value.
  3271. // This may be used to include null fields in Patch requests.
  3272. NullFields []string `json:"-"`
  3273. }
  3274. func (s *TypedValue) MarshalJSON() ([]byte, error) {
  3275. type NoMethod TypedValue
  3276. raw := NoMethod(*s)
  3277. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3278. }
  3279. func (s *TypedValue) UnmarshalJSON(data []byte) error {
  3280. type NoMethod TypedValue
  3281. var s1 struct {
  3282. DoubleValue *gensupport.JSONFloat64 `json:"doubleValue"`
  3283. *NoMethod
  3284. }
  3285. s1.NoMethod = (*NoMethod)(s)
  3286. if err := json.Unmarshal(data, &s1); err != nil {
  3287. return err
  3288. }
  3289. if s1.DoubleValue != nil {
  3290. s.DoubleValue = (*float64)(s1.DoubleValue)
  3291. }
  3292. return nil
  3293. }
  3294. // UptimeCheckConfig: This message configures which resources and
  3295. // services to monitor for availability.
  3296. type UptimeCheckConfig struct {
  3297. // ContentMatchers: The expected content on the page the check is run
  3298. // against. Currently, only the first entry in the list is supported,
  3299. // and other entries will be ignored. The server will look for an exact
  3300. // match of the string in the page response's content. This field is
  3301. // optional and should only be specified if a content match is required.
  3302. ContentMatchers []*ContentMatcher `json:"contentMatchers,omitempty"`
  3303. // DisplayName: A human-friendly name for the uptime check
  3304. // configuration. The display name should be unique within a Stackdriver
  3305. // Workspace in order to make it easier to identify; however, uniqueness
  3306. // is not enforced. Required.
  3307. DisplayName string `json:"displayName,omitempty"`
  3308. // HttpCheck: Contains information needed to make an HTTP or HTTPS
  3309. // check.
  3310. HttpCheck *HttpCheck `json:"httpCheck,omitempty"`
  3311. // InternalCheckers: The internal checkers that this check will egress
  3312. // from. If is_internal is true and this list is empty, the check will
  3313. // egress from all the InternalCheckers configured for the project that
  3314. // owns this CheckConfig.
  3315. InternalCheckers []*InternalChecker `json:"internalCheckers,omitempty"`
  3316. // IsInternal: If this is true, then checks are made only from the
  3317. // 'internal_checkers'. If it is false, then checks are made only from
  3318. // the 'selected_regions'. It is an error to provide 'selected_regions'
  3319. // when is_internal is true, or to provide 'internal_checkers' when
  3320. // is_internal is false.
  3321. IsInternal bool `json:"isInternal,omitempty"`
  3322. // MonitoredResource: The monitored resource
  3323. // (https://cloud.google.com/monitoring/api/resources) associated with
  3324. // the configuration. The following monitored resource types are
  3325. // supported for uptime checks: uptime_url gce_instance gae_app
  3326. // aws_ec2_instance aws_elb_load_balancer
  3327. MonitoredResource *MonitoredResource `json:"monitoredResource,omitempty"`
  3328. // Name: A unique resource name for this UptimeCheckConfig. The format
  3329. // is:projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].This
  3330. // field should be omitted when creating the uptime check configuration;
  3331. // on create, the resource name is assigned by the server and included
  3332. // in the response.
  3333. Name string `json:"name,omitempty"`
  3334. // Period: How often, in seconds, the uptime check is performed.
  3335. // Currently, the only supported values are 60s (1 minute), 300s (5
  3336. // minutes), 600s (10 minutes), and 900s (15 minutes). Optional,
  3337. // defaults to 60s.
  3338. Period string `json:"period,omitempty"`
  3339. // ResourceGroup: The group resource associated with the configuration.
  3340. ResourceGroup *ResourceGroup `json:"resourceGroup,omitempty"`
  3341. // SelectedRegions: The list of regions from which the check will be
  3342. // run. Some regions contain one location, and others contain more than
  3343. // one. If this field is specified, enough regions to include a minimum
  3344. // of 3 locations must be provided, or an error message is returned. Not
  3345. // specifying this field will result in uptime checks running from all
  3346. // regions.
  3347. //
  3348. // Possible values:
  3349. // "REGION_UNSPECIFIED" - Default value if no region is specified.
  3350. // Will result in uptime checks running from all regions.
  3351. // "USA" - Allows checks to run from locations within the United
  3352. // States of America.
  3353. // "EUROPE" - Allows checks to run from locations within the continent
  3354. // of Europe.
  3355. // "SOUTH_AMERICA" - Allows checks to run from locations within the
  3356. // continent of South America.
  3357. // "ASIA_PACIFIC" - Allows checks to run from locations within the
  3358. // Asia Pacific area (ex: Singapore).
  3359. SelectedRegions []string `json:"selectedRegions,omitempty"`
  3360. // TcpCheck: Contains information needed to make a TCP check.
  3361. TcpCheck *TcpCheck `json:"tcpCheck,omitempty"`
  3362. // Timeout: The maximum amount of time to wait for the request to
  3363. // complete (must be between 1 and 60 seconds). Required.
  3364. Timeout string `json:"timeout,omitempty"`
  3365. // ServerResponse contains the HTTP response code and headers from the
  3366. // server.
  3367. googleapi.ServerResponse `json:"-"`
  3368. // ForceSendFields is a list of field names (e.g. "ContentMatchers") to
  3369. // unconditionally include in API requests. By default, fields with
  3370. // empty values are omitted from API requests. However, any non-pointer,
  3371. // non-interface field appearing in ForceSendFields will be sent to the
  3372. // server regardless of whether the field is empty or not. This may be
  3373. // used to include empty fields in Patch requests.
  3374. ForceSendFields []string `json:"-"`
  3375. // NullFields is a list of field names (e.g. "ContentMatchers") to
  3376. // include in API requests with the JSON null value. By default, fields
  3377. // with empty values are omitted from API requests. However, any field
  3378. // with an empty value appearing in NullFields will be sent to the
  3379. // server as null. It is an error if a field in this list has a
  3380. // non-empty value. This may be used to include null fields in Patch
  3381. // requests.
  3382. NullFields []string `json:"-"`
  3383. }
  3384. func (s *UptimeCheckConfig) MarshalJSON() ([]byte, error) {
  3385. type NoMethod UptimeCheckConfig
  3386. raw := NoMethod(*s)
  3387. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3388. }
  3389. // UptimeCheckIp: Contains the region, location, and list of IP
  3390. // addresses where checkers in the location run from.
  3391. type UptimeCheckIp struct {
  3392. // IpAddress: The IP address from which the uptime check originates.
  3393. // This is a full IP address (not an IP address range). Most IP
  3394. // addresses, as of this publication, are in IPv4 format; however, one
  3395. // should not rely on the IP addresses being in IPv4 format indefinitely
  3396. // and should support interpreting this field in either IPv4 or IPv6
  3397. // format.
  3398. IpAddress string `json:"ipAddress,omitempty"`
  3399. // Location: A more specific location within the region that typically
  3400. // encodes a particular city/town/metro (and its containing
  3401. // state/province or country) within the broader umbrella region
  3402. // category.
  3403. Location string `json:"location,omitempty"`
  3404. // Region: A broad region category in which the IP address is located.
  3405. //
  3406. // Possible values:
  3407. // "REGION_UNSPECIFIED" - Default value if no region is specified.
  3408. // Will result in uptime checks running from all regions.
  3409. // "USA" - Allows checks to run from locations within the United
  3410. // States of America.
  3411. // "EUROPE" - Allows checks to run from locations within the continent
  3412. // of Europe.
  3413. // "SOUTH_AMERICA" - Allows checks to run from locations within the
  3414. // continent of South America.
  3415. // "ASIA_PACIFIC" - Allows checks to run from locations within the
  3416. // Asia Pacific area (ex: Singapore).
  3417. Region string `json:"region,omitempty"`
  3418. // ForceSendFields is a list of field names (e.g. "IpAddress") to
  3419. // unconditionally include in API requests. By default, fields with
  3420. // empty values are omitted from API requests. However, any non-pointer,
  3421. // non-interface field appearing in ForceSendFields will be sent to the
  3422. // server regardless of whether the field is empty or not. This may be
  3423. // used to include empty fields in Patch requests.
  3424. ForceSendFields []string `json:"-"`
  3425. // NullFields is a list of field names (e.g. "IpAddress") to include in
  3426. // API requests with the JSON null value. By default, fields with empty
  3427. // values are omitted from API requests. However, any field with an
  3428. // empty value appearing in NullFields will be sent to the server as
  3429. // null. It is an error if a field in this list has a non-empty value.
  3430. // This may be used to include null fields in Patch requests.
  3431. NullFields []string `json:"-"`
  3432. }
  3433. func (s *UptimeCheckIp) MarshalJSON() ([]byte, error) {
  3434. type NoMethod UptimeCheckIp
  3435. raw := NoMethod(*s)
  3436. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3437. }
  3438. // VerifyNotificationChannelRequest: The VerifyNotificationChannel
  3439. // request.
  3440. type VerifyNotificationChannelRequest struct {
  3441. // Code: The verification code that was delivered to the channel as a
  3442. // result of invoking the SendNotificationChannelVerificationCode API
  3443. // method or that was retrieved from a verified channel via
  3444. // GetNotificationChannelVerificationCode. For example, one might have
  3445. // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
  3446. // guaranteed that the code is valid UTF-8; one should not make any
  3447. // assumptions regarding the structure or format of the code).
  3448. Code string `json:"code,omitempty"`
  3449. // ForceSendFields is a list of field names (e.g. "Code") to
  3450. // unconditionally include in API requests. By default, fields with
  3451. // empty values are omitted from API requests. However, any non-pointer,
  3452. // non-interface field appearing in ForceSendFields will be sent to the
  3453. // server regardless of whether the field is empty or not. This may be
  3454. // used to include empty fields in Patch requests.
  3455. ForceSendFields []string `json:"-"`
  3456. // NullFields is a list of field names (e.g. "Code") to include in API
  3457. // requests with the JSON null value. By default, fields with empty
  3458. // values are omitted from API requests. However, any field with an
  3459. // empty value appearing in NullFields will be sent to the server as
  3460. // null. It is an error if a field in this list has a non-empty value.
  3461. // This may be used to include null fields in Patch requests.
  3462. NullFields []string `json:"-"`
  3463. }
  3464. func (s *VerifyNotificationChannelRequest) MarshalJSON() ([]byte, error) {
  3465. type NoMethod VerifyNotificationChannelRequest
  3466. raw := NoMethod(*s)
  3467. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3468. }
  3469. // method id "monitoring.projects.alertPolicies.create":
  3470. type ProjectsAlertPoliciesCreateCall struct {
  3471. s *Service
  3472. name string
  3473. alertpolicy *AlertPolicy
  3474. urlParams_ gensupport.URLParams
  3475. ctx_ context.Context
  3476. header_ http.Header
  3477. }
  3478. // Create: Creates a new alerting policy.
  3479. func (r *ProjectsAlertPoliciesService) Create(name string, alertpolicy *AlertPolicy) *ProjectsAlertPoliciesCreateCall {
  3480. c := &ProjectsAlertPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3481. c.name = name
  3482. c.alertpolicy = alertpolicy
  3483. return c
  3484. }
  3485. // Fields allows partial responses to be retrieved. See
  3486. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3487. // for more information.
  3488. func (c *ProjectsAlertPoliciesCreateCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesCreateCall {
  3489. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3490. return c
  3491. }
  3492. // Context sets the context to be used in this call's Do method. Any
  3493. // pending HTTP request will be aborted if the provided context is
  3494. // canceled.
  3495. func (c *ProjectsAlertPoliciesCreateCall) Context(ctx context.Context) *ProjectsAlertPoliciesCreateCall {
  3496. c.ctx_ = ctx
  3497. return c
  3498. }
  3499. // Header returns an http.Header that can be modified by the caller to
  3500. // add HTTP headers to the request.
  3501. func (c *ProjectsAlertPoliciesCreateCall) Header() http.Header {
  3502. if c.header_ == nil {
  3503. c.header_ = make(http.Header)
  3504. }
  3505. return c.header_
  3506. }
  3507. func (c *ProjectsAlertPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
  3508. reqHeaders := make(http.Header)
  3509. for k, v := range c.header_ {
  3510. reqHeaders[k] = v
  3511. }
  3512. reqHeaders.Set("User-Agent", c.s.userAgent())
  3513. var body io.Reader = nil
  3514. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alertpolicy)
  3515. if err != nil {
  3516. return nil, err
  3517. }
  3518. reqHeaders.Set("Content-Type", "application/json")
  3519. c.urlParams_.Set("alt", alt)
  3520. c.urlParams_.Set("prettyPrint", "false")
  3521. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/alertPolicies")
  3522. urls += "?" + c.urlParams_.Encode()
  3523. req, err := http.NewRequest("POST", urls, body)
  3524. if err != nil {
  3525. return nil, err
  3526. }
  3527. req.Header = reqHeaders
  3528. googleapi.Expand(req.URL, map[string]string{
  3529. "name": c.name,
  3530. })
  3531. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3532. }
  3533. // Do executes the "monitoring.projects.alertPolicies.create" call.
  3534. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  3535. // status code is an error. Response headers are in either
  3536. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  3537. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3538. // to check whether the returned error was because
  3539. // http.StatusNotModified was returned.
  3540. func (c *ProjectsAlertPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  3541. gensupport.SetOptions(c.urlParams_, opts...)
  3542. res, err := c.doRequest("json")
  3543. if res != nil && res.StatusCode == http.StatusNotModified {
  3544. if res.Body != nil {
  3545. res.Body.Close()
  3546. }
  3547. return nil, &googleapi.Error{
  3548. Code: res.StatusCode,
  3549. Header: res.Header,
  3550. }
  3551. }
  3552. if err != nil {
  3553. return nil, err
  3554. }
  3555. defer googleapi.CloseBody(res)
  3556. if err := googleapi.CheckResponse(res); err != nil {
  3557. return nil, err
  3558. }
  3559. ret := &AlertPolicy{
  3560. ServerResponse: googleapi.ServerResponse{
  3561. Header: res.Header,
  3562. HTTPStatusCode: res.StatusCode,
  3563. },
  3564. }
  3565. target := &ret
  3566. if err := gensupport.DecodeResponse(target, res); err != nil {
  3567. return nil, err
  3568. }
  3569. return ret, nil
  3570. // {
  3571. // "description": "Creates a new alerting policy.",
  3572. // "flatPath": "v3/projects/{projectsId}/alertPolicies",
  3573. // "httpMethod": "POST",
  3574. // "id": "monitoring.projects.alertPolicies.create",
  3575. // "parameterOrder": [
  3576. // "name"
  3577. // ],
  3578. // "parameters": {
  3579. // "name": {
  3580. // "description": "The project in which to create the alerting policy. The format is projects/[PROJECT_ID].Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[POLICY_ID], identifying the policy in the container.",
  3581. // "location": "path",
  3582. // "pattern": "^projects/[^/]+$",
  3583. // "required": true,
  3584. // "type": "string"
  3585. // }
  3586. // },
  3587. // "path": "v3/{+name}/alertPolicies",
  3588. // "request": {
  3589. // "$ref": "AlertPolicy"
  3590. // },
  3591. // "response": {
  3592. // "$ref": "AlertPolicy"
  3593. // },
  3594. // "scopes": [
  3595. // "https://www.googleapis.com/auth/cloud-platform",
  3596. // "https://www.googleapis.com/auth/monitoring"
  3597. // ]
  3598. // }
  3599. }
  3600. // method id "monitoring.projects.alertPolicies.delete":
  3601. type ProjectsAlertPoliciesDeleteCall struct {
  3602. s *Service
  3603. name string
  3604. urlParams_ gensupport.URLParams
  3605. ctx_ context.Context
  3606. header_ http.Header
  3607. }
  3608. // Delete: Deletes an alerting policy.
  3609. func (r *ProjectsAlertPoliciesService) Delete(name string) *ProjectsAlertPoliciesDeleteCall {
  3610. c := &ProjectsAlertPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3611. c.name = name
  3612. return c
  3613. }
  3614. // Fields allows partial responses to be retrieved. See
  3615. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3616. // for more information.
  3617. func (c *ProjectsAlertPoliciesDeleteCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesDeleteCall {
  3618. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3619. return c
  3620. }
  3621. // Context sets the context to be used in this call's Do method. Any
  3622. // pending HTTP request will be aborted if the provided context is
  3623. // canceled.
  3624. func (c *ProjectsAlertPoliciesDeleteCall) Context(ctx context.Context) *ProjectsAlertPoliciesDeleteCall {
  3625. c.ctx_ = ctx
  3626. return c
  3627. }
  3628. // Header returns an http.Header that can be modified by the caller to
  3629. // add HTTP headers to the request.
  3630. func (c *ProjectsAlertPoliciesDeleteCall) Header() http.Header {
  3631. if c.header_ == nil {
  3632. c.header_ = make(http.Header)
  3633. }
  3634. return c.header_
  3635. }
  3636. func (c *ProjectsAlertPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3637. reqHeaders := make(http.Header)
  3638. for k, v := range c.header_ {
  3639. reqHeaders[k] = v
  3640. }
  3641. reqHeaders.Set("User-Agent", c.s.userAgent())
  3642. var body io.Reader = nil
  3643. c.urlParams_.Set("alt", alt)
  3644. c.urlParams_.Set("prettyPrint", "false")
  3645. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  3646. urls += "?" + c.urlParams_.Encode()
  3647. req, err := http.NewRequest("DELETE", urls, body)
  3648. if err != nil {
  3649. return nil, err
  3650. }
  3651. req.Header = reqHeaders
  3652. googleapi.Expand(req.URL, map[string]string{
  3653. "name": c.name,
  3654. })
  3655. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3656. }
  3657. // Do executes the "monitoring.projects.alertPolicies.delete" call.
  3658. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3659. // code is an error. Response headers are in either
  3660. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3661. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3662. // check whether the returned error was because http.StatusNotModified
  3663. // was returned.
  3664. func (c *ProjectsAlertPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3665. gensupport.SetOptions(c.urlParams_, opts...)
  3666. res, err := c.doRequest("json")
  3667. if res != nil && res.StatusCode == http.StatusNotModified {
  3668. if res.Body != nil {
  3669. res.Body.Close()
  3670. }
  3671. return nil, &googleapi.Error{
  3672. Code: res.StatusCode,
  3673. Header: res.Header,
  3674. }
  3675. }
  3676. if err != nil {
  3677. return nil, err
  3678. }
  3679. defer googleapi.CloseBody(res)
  3680. if err := googleapi.CheckResponse(res); err != nil {
  3681. return nil, err
  3682. }
  3683. ret := &Empty{
  3684. ServerResponse: googleapi.ServerResponse{
  3685. Header: res.Header,
  3686. HTTPStatusCode: res.StatusCode,
  3687. },
  3688. }
  3689. target := &ret
  3690. if err := gensupport.DecodeResponse(target, res); err != nil {
  3691. return nil, err
  3692. }
  3693. return ret, nil
  3694. // {
  3695. // "description": "Deletes an alerting policy.",
  3696. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  3697. // "httpMethod": "DELETE",
  3698. // "id": "monitoring.projects.alertPolicies.delete",
  3699. // "parameterOrder": [
  3700. // "name"
  3701. // ],
  3702. // "parameters": {
  3703. // "name": {
  3704. // "description": "The alerting policy to delete. The format is:\nprojects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]\nFor more information, see AlertPolicy.",
  3705. // "location": "path",
  3706. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  3707. // "required": true,
  3708. // "type": "string"
  3709. // }
  3710. // },
  3711. // "path": "v3/{+name}",
  3712. // "response": {
  3713. // "$ref": "Empty"
  3714. // },
  3715. // "scopes": [
  3716. // "https://www.googleapis.com/auth/cloud-platform",
  3717. // "https://www.googleapis.com/auth/monitoring"
  3718. // ]
  3719. // }
  3720. }
  3721. // method id "monitoring.projects.alertPolicies.get":
  3722. type ProjectsAlertPoliciesGetCall struct {
  3723. s *Service
  3724. name string
  3725. urlParams_ gensupport.URLParams
  3726. ifNoneMatch_ string
  3727. ctx_ context.Context
  3728. header_ http.Header
  3729. }
  3730. // Get: Gets a single alerting policy.
  3731. func (r *ProjectsAlertPoliciesService) Get(name string) *ProjectsAlertPoliciesGetCall {
  3732. c := &ProjectsAlertPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3733. c.name = name
  3734. return c
  3735. }
  3736. // Fields allows partial responses to be retrieved. See
  3737. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3738. // for more information.
  3739. func (c *ProjectsAlertPoliciesGetCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesGetCall {
  3740. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3741. return c
  3742. }
  3743. // IfNoneMatch sets the optional parameter which makes the operation
  3744. // fail if the object's ETag matches the given value. This is useful for
  3745. // getting updates only after the object has changed since the last
  3746. // request. Use googleapi.IsNotModified to check whether the response
  3747. // error from Do is the result of In-None-Match.
  3748. func (c *ProjectsAlertPoliciesGetCall) IfNoneMatch(entityTag string) *ProjectsAlertPoliciesGetCall {
  3749. c.ifNoneMatch_ = entityTag
  3750. return c
  3751. }
  3752. // Context sets the context to be used in this call's Do method. Any
  3753. // pending HTTP request will be aborted if the provided context is
  3754. // canceled.
  3755. func (c *ProjectsAlertPoliciesGetCall) Context(ctx context.Context) *ProjectsAlertPoliciesGetCall {
  3756. c.ctx_ = ctx
  3757. return c
  3758. }
  3759. // Header returns an http.Header that can be modified by the caller to
  3760. // add HTTP headers to the request.
  3761. func (c *ProjectsAlertPoliciesGetCall) Header() http.Header {
  3762. if c.header_ == nil {
  3763. c.header_ = make(http.Header)
  3764. }
  3765. return c.header_
  3766. }
  3767. func (c *ProjectsAlertPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
  3768. reqHeaders := make(http.Header)
  3769. for k, v := range c.header_ {
  3770. reqHeaders[k] = v
  3771. }
  3772. reqHeaders.Set("User-Agent", c.s.userAgent())
  3773. if c.ifNoneMatch_ != "" {
  3774. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3775. }
  3776. var body io.Reader = nil
  3777. c.urlParams_.Set("alt", alt)
  3778. c.urlParams_.Set("prettyPrint", "false")
  3779. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  3780. urls += "?" + c.urlParams_.Encode()
  3781. req, err := http.NewRequest("GET", urls, body)
  3782. if err != nil {
  3783. return nil, err
  3784. }
  3785. req.Header = reqHeaders
  3786. googleapi.Expand(req.URL, map[string]string{
  3787. "name": c.name,
  3788. })
  3789. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3790. }
  3791. // Do executes the "monitoring.projects.alertPolicies.get" call.
  3792. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  3793. // status code is an error. Response headers are in either
  3794. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  3795. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3796. // to check whether the returned error was because
  3797. // http.StatusNotModified was returned.
  3798. func (c *ProjectsAlertPoliciesGetCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  3799. gensupport.SetOptions(c.urlParams_, opts...)
  3800. res, err := c.doRequest("json")
  3801. if res != nil && res.StatusCode == http.StatusNotModified {
  3802. if res.Body != nil {
  3803. res.Body.Close()
  3804. }
  3805. return nil, &googleapi.Error{
  3806. Code: res.StatusCode,
  3807. Header: res.Header,
  3808. }
  3809. }
  3810. if err != nil {
  3811. return nil, err
  3812. }
  3813. defer googleapi.CloseBody(res)
  3814. if err := googleapi.CheckResponse(res); err != nil {
  3815. return nil, err
  3816. }
  3817. ret := &AlertPolicy{
  3818. ServerResponse: googleapi.ServerResponse{
  3819. Header: res.Header,
  3820. HTTPStatusCode: res.StatusCode,
  3821. },
  3822. }
  3823. target := &ret
  3824. if err := gensupport.DecodeResponse(target, res); err != nil {
  3825. return nil, err
  3826. }
  3827. return ret, nil
  3828. // {
  3829. // "description": "Gets a single alerting policy.",
  3830. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  3831. // "httpMethod": "GET",
  3832. // "id": "monitoring.projects.alertPolicies.get",
  3833. // "parameterOrder": [
  3834. // "name"
  3835. // ],
  3836. // "parameters": {
  3837. // "name": {
  3838. // "description": "The alerting policy to retrieve. The format is\nprojects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]\n",
  3839. // "location": "path",
  3840. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  3841. // "required": true,
  3842. // "type": "string"
  3843. // }
  3844. // },
  3845. // "path": "v3/{+name}",
  3846. // "response": {
  3847. // "$ref": "AlertPolicy"
  3848. // },
  3849. // "scopes": [
  3850. // "https://www.googleapis.com/auth/cloud-platform",
  3851. // "https://www.googleapis.com/auth/monitoring",
  3852. // "https://www.googleapis.com/auth/monitoring.read"
  3853. // ]
  3854. // }
  3855. }
  3856. // method id "monitoring.projects.alertPolicies.list":
  3857. type ProjectsAlertPoliciesListCall struct {
  3858. s *Service
  3859. name string
  3860. urlParams_ gensupport.URLParams
  3861. ifNoneMatch_ string
  3862. ctx_ context.Context
  3863. header_ http.Header
  3864. }
  3865. // List: Lists the existing alerting policies for the project.
  3866. func (r *ProjectsAlertPoliciesService) List(name string) *ProjectsAlertPoliciesListCall {
  3867. c := &ProjectsAlertPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3868. c.name = name
  3869. return c
  3870. }
  3871. // Filter sets the optional parameter "filter": If provided, this field
  3872. // specifies the criteria that must be met by alert policies to be
  3873. // included in the response.For more details, see sorting and filtering.
  3874. func (c *ProjectsAlertPoliciesListCall) Filter(filter string) *ProjectsAlertPoliciesListCall {
  3875. c.urlParams_.Set("filter", filter)
  3876. return c
  3877. }
  3878. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  3879. // of fields by which to sort the result. Supports the same set of field
  3880. // references as the filter field. Entries can be prefixed with a minus
  3881. // sign to sort by the field in descending order.For more details, see
  3882. // sorting and filtering.
  3883. func (c *ProjectsAlertPoliciesListCall) OrderBy(orderBy string) *ProjectsAlertPoliciesListCall {
  3884. c.urlParams_.Set("orderBy", orderBy)
  3885. return c
  3886. }
  3887. // PageSize sets the optional parameter "pageSize": The maximum number
  3888. // of results to return in a single response.
  3889. func (c *ProjectsAlertPoliciesListCall) PageSize(pageSize int64) *ProjectsAlertPoliciesListCall {
  3890. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3891. return c
  3892. }
  3893. // PageToken sets the optional parameter "pageToken": If this field is
  3894. // not empty then it must contain the nextPageToken value returned by a
  3895. // previous call to this method. Using this field causes the method to
  3896. // return more results from the previous method call.
  3897. func (c *ProjectsAlertPoliciesListCall) PageToken(pageToken string) *ProjectsAlertPoliciesListCall {
  3898. c.urlParams_.Set("pageToken", pageToken)
  3899. return c
  3900. }
  3901. // Fields allows partial responses to be retrieved. See
  3902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3903. // for more information.
  3904. func (c *ProjectsAlertPoliciesListCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesListCall {
  3905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3906. return c
  3907. }
  3908. // IfNoneMatch sets the optional parameter which makes the operation
  3909. // fail if the object's ETag matches the given value. This is useful for
  3910. // getting updates only after the object has changed since the last
  3911. // request. Use googleapi.IsNotModified to check whether the response
  3912. // error from Do is the result of In-None-Match.
  3913. func (c *ProjectsAlertPoliciesListCall) IfNoneMatch(entityTag string) *ProjectsAlertPoliciesListCall {
  3914. c.ifNoneMatch_ = entityTag
  3915. return c
  3916. }
  3917. // Context sets the context to be used in this call's Do method. Any
  3918. // pending HTTP request will be aborted if the provided context is
  3919. // canceled.
  3920. func (c *ProjectsAlertPoliciesListCall) Context(ctx context.Context) *ProjectsAlertPoliciesListCall {
  3921. c.ctx_ = ctx
  3922. return c
  3923. }
  3924. // Header returns an http.Header that can be modified by the caller to
  3925. // add HTTP headers to the request.
  3926. func (c *ProjectsAlertPoliciesListCall) Header() http.Header {
  3927. if c.header_ == nil {
  3928. c.header_ = make(http.Header)
  3929. }
  3930. return c.header_
  3931. }
  3932. func (c *ProjectsAlertPoliciesListCall) doRequest(alt string) (*http.Response, error) {
  3933. reqHeaders := make(http.Header)
  3934. for k, v := range c.header_ {
  3935. reqHeaders[k] = v
  3936. }
  3937. reqHeaders.Set("User-Agent", c.s.userAgent())
  3938. if c.ifNoneMatch_ != "" {
  3939. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3940. }
  3941. var body io.Reader = nil
  3942. c.urlParams_.Set("alt", alt)
  3943. c.urlParams_.Set("prettyPrint", "false")
  3944. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/alertPolicies")
  3945. urls += "?" + c.urlParams_.Encode()
  3946. req, err := http.NewRequest("GET", urls, body)
  3947. if err != nil {
  3948. return nil, err
  3949. }
  3950. req.Header = reqHeaders
  3951. googleapi.Expand(req.URL, map[string]string{
  3952. "name": c.name,
  3953. })
  3954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3955. }
  3956. // Do executes the "monitoring.projects.alertPolicies.list" call.
  3957. // Exactly one of *ListAlertPoliciesResponse or error will be non-nil.
  3958. // Any non-2xx status code is an error. Response headers are in either
  3959. // *ListAlertPoliciesResponse.ServerResponse.Header or (if a response
  3960. // was returned at all) in error.(*googleapi.Error).Header. Use
  3961. // googleapi.IsNotModified to check whether the returned error was
  3962. // because http.StatusNotModified was returned.
  3963. func (c *ProjectsAlertPoliciesListCall) Do(opts ...googleapi.CallOption) (*ListAlertPoliciesResponse, error) {
  3964. gensupport.SetOptions(c.urlParams_, opts...)
  3965. res, err := c.doRequest("json")
  3966. if res != nil && res.StatusCode == http.StatusNotModified {
  3967. if res.Body != nil {
  3968. res.Body.Close()
  3969. }
  3970. return nil, &googleapi.Error{
  3971. Code: res.StatusCode,
  3972. Header: res.Header,
  3973. }
  3974. }
  3975. if err != nil {
  3976. return nil, err
  3977. }
  3978. defer googleapi.CloseBody(res)
  3979. if err := googleapi.CheckResponse(res); err != nil {
  3980. return nil, err
  3981. }
  3982. ret := &ListAlertPoliciesResponse{
  3983. ServerResponse: googleapi.ServerResponse{
  3984. Header: res.Header,
  3985. HTTPStatusCode: res.StatusCode,
  3986. },
  3987. }
  3988. target := &ret
  3989. if err := gensupport.DecodeResponse(target, res); err != nil {
  3990. return nil, err
  3991. }
  3992. return ret, nil
  3993. // {
  3994. // "description": "Lists the existing alerting policies for the project.",
  3995. // "flatPath": "v3/projects/{projectsId}/alertPolicies",
  3996. // "httpMethod": "GET",
  3997. // "id": "monitoring.projects.alertPolicies.list",
  3998. // "parameterOrder": [
  3999. // "name"
  4000. // ],
  4001. // "parameters": {
  4002. // "filter": {
  4003. // "description": "If provided, this field specifies the criteria that must be met by alert policies to be included in the response.For more details, see sorting and filtering.",
  4004. // "location": "query",
  4005. // "type": "string"
  4006. // },
  4007. // "name": {
  4008. // "description": "The project whose alert policies are to be listed. The format is\nprojects/[PROJECT_ID]\nNote that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the GetAlertPolicy operation, instead.",
  4009. // "location": "path",
  4010. // "pattern": "^projects/[^/]+$",
  4011. // "required": true,
  4012. // "type": "string"
  4013. // },
  4014. // "orderBy": {
  4015. // "description": "A comma-separated list of fields by which to sort the result. Supports the same set of field references as the filter field. Entries can be prefixed with a minus sign to sort by the field in descending order.For more details, see sorting and filtering.",
  4016. // "location": "query",
  4017. // "type": "string"
  4018. // },
  4019. // "pageSize": {
  4020. // "description": "The maximum number of results to return in a single response.",
  4021. // "format": "int32",
  4022. // "location": "query",
  4023. // "type": "integer"
  4024. // },
  4025. // "pageToken": {
  4026. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return more results from the previous method call.",
  4027. // "location": "query",
  4028. // "type": "string"
  4029. // }
  4030. // },
  4031. // "path": "v3/{+name}/alertPolicies",
  4032. // "response": {
  4033. // "$ref": "ListAlertPoliciesResponse"
  4034. // },
  4035. // "scopes": [
  4036. // "https://www.googleapis.com/auth/cloud-platform",
  4037. // "https://www.googleapis.com/auth/monitoring",
  4038. // "https://www.googleapis.com/auth/monitoring.read"
  4039. // ]
  4040. // }
  4041. }
  4042. // Pages invokes f for each page of results.
  4043. // A non-nil error returned from f will halt the iteration.
  4044. // The provided context supersedes any context provided to the Context method.
  4045. func (c *ProjectsAlertPoliciesListCall) Pages(ctx context.Context, f func(*ListAlertPoliciesResponse) error) error {
  4046. c.ctx_ = ctx
  4047. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4048. for {
  4049. x, err := c.Do()
  4050. if err != nil {
  4051. return err
  4052. }
  4053. if err := f(x); err != nil {
  4054. return err
  4055. }
  4056. if x.NextPageToken == "" {
  4057. return nil
  4058. }
  4059. c.PageToken(x.NextPageToken)
  4060. }
  4061. }
  4062. // method id "monitoring.projects.alertPolicies.patch":
  4063. type ProjectsAlertPoliciesPatchCall struct {
  4064. s *Service
  4065. name string
  4066. alertpolicy *AlertPolicy
  4067. urlParams_ gensupport.URLParams
  4068. ctx_ context.Context
  4069. header_ http.Header
  4070. }
  4071. // Patch: Updates an alerting policy. You can either replace the entire
  4072. // policy with a new one or replace only certain fields in the current
  4073. // alerting policy by specifying the fields to be updated via
  4074. // updateMask. Returns the updated alerting policy.
  4075. func (r *ProjectsAlertPoliciesService) Patch(name string, alertpolicy *AlertPolicy) *ProjectsAlertPoliciesPatchCall {
  4076. c := &ProjectsAlertPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4077. c.name = name
  4078. c.alertpolicy = alertpolicy
  4079. return c
  4080. }
  4081. // UpdateMask sets the optional parameter "updateMask": A list of
  4082. // alerting policy field names. If this field is not empty, each listed
  4083. // field in the existing alerting policy is set to the value of the
  4084. // corresponding field in the supplied policy (alert_policy), or to the
  4085. // field's default value if the field is not in the supplied alerting
  4086. // policy. Fields not listed retain their previous value.Examples of
  4087. // valid field masks include display_name, documentation,
  4088. // documentation.content, documentation.mime_type, user_labels,
  4089. // user_label.nameofkey, enabled, conditions, combiner, etc.If this
  4090. // field is empty, then the supplied alerting policy replaces the
  4091. // existing policy. It is the same as deleting the existing policy and
  4092. // adding the supplied policy, except for the following:
  4093. // The new policy will have the same [ALERT_POLICY_ID] as the former
  4094. // policy. This gives you continuity with the former policy in your
  4095. // notifications and incidents.
  4096. // Conditions in the new policy will keep their former [CONDITION_ID] if
  4097. // the supplied condition includes the name field with that
  4098. // [CONDITION_ID]. If the supplied condition omits the name field, then
  4099. // a new [CONDITION_ID] is created.
  4100. func (c *ProjectsAlertPoliciesPatchCall) UpdateMask(updateMask string) *ProjectsAlertPoliciesPatchCall {
  4101. c.urlParams_.Set("updateMask", updateMask)
  4102. return c
  4103. }
  4104. // Fields allows partial responses to be retrieved. See
  4105. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4106. // for more information.
  4107. func (c *ProjectsAlertPoliciesPatchCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesPatchCall {
  4108. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4109. return c
  4110. }
  4111. // Context sets the context to be used in this call's Do method. Any
  4112. // pending HTTP request will be aborted if the provided context is
  4113. // canceled.
  4114. func (c *ProjectsAlertPoliciesPatchCall) Context(ctx context.Context) *ProjectsAlertPoliciesPatchCall {
  4115. c.ctx_ = ctx
  4116. return c
  4117. }
  4118. // Header returns an http.Header that can be modified by the caller to
  4119. // add HTTP headers to the request.
  4120. func (c *ProjectsAlertPoliciesPatchCall) Header() http.Header {
  4121. if c.header_ == nil {
  4122. c.header_ = make(http.Header)
  4123. }
  4124. return c.header_
  4125. }
  4126. func (c *ProjectsAlertPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
  4127. reqHeaders := make(http.Header)
  4128. for k, v := range c.header_ {
  4129. reqHeaders[k] = v
  4130. }
  4131. reqHeaders.Set("User-Agent", c.s.userAgent())
  4132. var body io.Reader = nil
  4133. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alertpolicy)
  4134. if err != nil {
  4135. return nil, err
  4136. }
  4137. reqHeaders.Set("Content-Type", "application/json")
  4138. c.urlParams_.Set("alt", alt)
  4139. c.urlParams_.Set("prettyPrint", "false")
  4140. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4141. urls += "?" + c.urlParams_.Encode()
  4142. req, err := http.NewRequest("PATCH", urls, body)
  4143. if err != nil {
  4144. return nil, err
  4145. }
  4146. req.Header = reqHeaders
  4147. googleapi.Expand(req.URL, map[string]string{
  4148. "name": c.name,
  4149. })
  4150. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4151. }
  4152. // Do executes the "monitoring.projects.alertPolicies.patch" call.
  4153. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  4154. // status code is an error. Response headers are in either
  4155. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  4156. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4157. // to check whether the returned error was because
  4158. // http.StatusNotModified was returned.
  4159. func (c *ProjectsAlertPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  4160. gensupport.SetOptions(c.urlParams_, opts...)
  4161. res, err := c.doRequest("json")
  4162. if res != nil && res.StatusCode == http.StatusNotModified {
  4163. if res.Body != nil {
  4164. res.Body.Close()
  4165. }
  4166. return nil, &googleapi.Error{
  4167. Code: res.StatusCode,
  4168. Header: res.Header,
  4169. }
  4170. }
  4171. if err != nil {
  4172. return nil, err
  4173. }
  4174. defer googleapi.CloseBody(res)
  4175. if err := googleapi.CheckResponse(res); err != nil {
  4176. return nil, err
  4177. }
  4178. ret := &AlertPolicy{
  4179. ServerResponse: googleapi.ServerResponse{
  4180. Header: res.Header,
  4181. HTTPStatusCode: res.StatusCode,
  4182. },
  4183. }
  4184. target := &ret
  4185. if err := gensupport.DecodeResponse(target, res); err != nil {
  4186. return nil, err
  4187. }
  4188. return ret, nil
  4189. // {
  4190. // "description": "Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.",
  4191. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  4192. // "httpMethod": "PATCH",
  4193. // "id": "monitoring.projects.alertPolicies.patch",
  4194. // "parameterOrder": [
  4195. // "name"
  4196. // ],
  4197. // "parameters": {
  4198. // "name": {
  4199. // "description": "Required if the policy exists. The resource name for this policy. The syntax is:\nprojects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]\n[ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request.",
  4200. // "location": "path",
  4201. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  4202. // "required": true,
  4203. // "type": "string"
  4204. // },
  4205. // "updateMask": {
  4206. // "description": "Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following:\nThe new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents.\nConditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created.",
  4207. // "format": "google-fieldmask",
  4208. // "location": "query",
  4209. // "type": "string"
  4210. // }
  4211. // },
  4212. // "path": "v3/{+name}",
  4213. // "request": {
  4214. // "$ref": "AlertPolicy"
  4215. // },
  4216. // "response": {
  4217. // "$ref": "AlertPolicy"
  4218. // },
  4219. // "scopes": [
  4220. // "https://www.googleapis.com/auth/cloud-platform",
  4221. // "https://www.googleapis.com/auth/monitoring"
  4222. // ]
  4223. // }
  4224. }
  4225. // method id "monitoring.projects.collectdTimeSeries.create":
  4226. type ProjectsCollectdTimeSeriesCreateCall struct {
  4227. s *Service
  4228. name string
  4229. createcollectdtimeseriesrequest *CreateCollectdTimeSeriesRequest
  4230. urlParams_ gensupport.URLParams
  4231. ctx_ context.Context
  4232. header_ http.Header
  4233. }
  4234. // Create: Stackdriver Monitoring Agent only: Creates a new time
  4235. // series.<aside class="caution">This method is only for use by the
  4236. // Stackdriver Monitoring Agent. Use projects.timeSeries.create
  4237. // instead.</aside>
  4238. func (r *ProjectsCollectdTimeSeriesService) Create(name string, createcollectdtimeseriesrequest *CreateCollectdTimeSeriesRequest) *ProjectsCollectdTimeSeriesCreateCall {
  4239. c := &ProjectsCollectdTimeSeriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4240. c.name = name
  4241. c.createcollectdtimeseriesrequest = createcollectdtimeseriesrequest
  4242. return c
  4243. }
  4244. // Fields allows partial responses to be retrieved. See
  4245. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4246. // for more information.
  4247. func (c *ProjectsCollectdTimeSeriesCreateCall) Fields(s ...googleapi.Field) *ProjectsCollectdTimeSeriesCreateCall {
  4248. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4249. return c
  4250. }
  4251. // Context sets the context to be used in this call's Do method. Any
  4252. // pending HTTP request will be aborted if the provided context is
  4253. // canceled.
  4254. func (c *ProjectsCollectdTimeSeriesCreateCall) Context(ctx context.Context) *ProjectsCollectdTimeSeriesCreateCall {
  4255. c.ctx_ = ctx
  4256. return c
  4257. }
  4258. // Header returns an http.Header that can be modified by the caller to
  4259. // add HTTP headers to the request.
  4260. func (c *ProjectsCollectdTimeSeriesCreateCall) Header() http.Header {
  4261. if c.header_ == nil {
  4262. c.header_ = make(http.Header)
  4263. }
  4264. return c.header_
  4265. }
  4266. func (c *ProjectsCollectdTimeSeriesCreateCall) doRequest(alt string) (*http.Response, error) {
  4267. reqHeaders := make(http.Header)
  4268. for k, v := range c.header_ {
  4269. reqHeaders[k] = v
  4270. }
  4271. reqHeaders.Set("User-Agent", c.s.userAgent())
  4272. var body io.Reader = nil
  4273. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createcollectdtimeseriesrequest)
  4274. if err != nil {
  4275. return nil, err
  4276. }
  4277. reqHeaders.Set("Content-Type", "application/json")
  4278. c.urlParams_.Set("alt", alt)
  4279. c.urlParams_.Set("prettyPrint", "false")
  4280. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/collectdTimeSeries")
  4281. urls += "?" + c.urlParams_.Encode()
  4282. req, err := http.NewRequest("POST", urls, body)
  4283. if err != nil {
  4284. return nil, err
  4285. }
  4286. req.Header = reqHeaders
  4287. googleapi.Expand(req.URL, map[string]string{
  4288. "name": c.name,
  4289. })
  4290. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4291. }
  4292. // Do executes the "monitoring.projects.collectdTimeSeries.create" call.
  4293. // Exactly one of *CreateCollectdTimeSeriesResponse or error will be
  4294. // non-nil. Any non-2xx status code is an error. Response headers are in
  4295. // either *CreateCollectdTimeSeriesResponse.ServerResponse.Header or (if
  4296. // a response was returned at all) in error.(*googleapi.Error).Header.
  4297. // Use googleapi.IsNotModified to check whether the returned error was
  4298. // because http.StatusNotModified was returned.
  4299. func (c *ProjectsCollectdTimeSeriesCreateCall) Do(opts ...googleapi.CallOption) (*CreateCollectdTimeSeriesResponse, error) {
  4300. gensupport.SetOptions(c.urlParams_, opts...)
  4301. res, err := c.doRequest("json")
  4302. if res != nil && res.StatusCode == http.StatusNotModified {
  4303. if res.Body != nil {
  4304. res.Body.Close()
  4305. }
  4306. return nil, &googleapi.Error{
  4307. Code: res.StatusCode,
  4308. Header: res.Header,
  4309. }
  4310. }
  4311. if err != nil {
  4312. return nil, err
  4313. }
  4314. defer googleapi.CloseBody(res)
  4315. if err := googleapi.CheckResponse(res); err != nil {
  4316. return nil, err
  4317. }
  4318. ret := &CreateCollectdTimeSeriesResponse{
  4319. ServerResponse: googleapi.ServerResponse{
  4320. Header: res.Header,
  4321. HTTPStatusCode: res.StatusCode,
  4322. },
  4323. }
  4324. target := &ret
  4325. if err := gensupport.DecodeResponse(target, res); err != nil {
  4326. return nil, err
  4327. }
  4328. return ret, nil
  4329. // {
  4330. // "description": "Stackdriver Monitoring Agent only: Creates a new time series.\u003caside class=\"caution\"\u003eThis method is only for use by the Stackdriver Monitoring Agent. Use projects.timeSeries.create instead.\u003c/aside\u003e",
  4331. // "flatPath": "v3/projects/{projectsId}/collectdTimeSeries",
  4332. // "httpMethod": "POST",
  4333. // "id": "monitoring.projects.collectdTimeSeries.create",
  4334. // "parameterOrder": [
  4335. // "name"
  4336. // ],
  4337. // "parameters": {
  4338. // "name": {
  4339. // "description": "The project in which to create the time series. The format is \"projects/PROJECT_ID_OR_NUMBER\".",
  4340. // "location": "path",
  4341. // "pattern": "^projects/[^/]+$",
  4342. // "required": true,
  4343. // "type": "string"
  4344. // }
  4345. // },
  4346. // "path": "v3/{+name}/collectdTimeSeries",
  4347. // "request": {
  4348. // "$ref": "CreateCollectdTimeSeriesRequest"
  4349. // },
  4350. // "response": {
  4351. // "$ref": "CreateCollectdTimeSeriesResponse"
  4352. // },
  4353. // "scopes": [
  4354. // "https://www.googleapis.com/auth/cloud-platform",
  4355. // "https://www.googleapis.com/auth/monitoring",
  4356. // "https://www.googleapis.com/auth/monitoring.write"
  4357. // ]
  4358. // }
  4359. }
  4360. // method id "monitoring.projects.groups.create":
  4361. type ProjectsGroupsCreateCall struct {
  4362. s *Service
  4363. name string
  4364. group *Group
  4365. urlParams_ gensupport.URLParams
  4366. ctx_ context.Context
  4367. header_ http.Header
  4368. }
  4369. // Create: Creates a new group.
  4370. func (r *ProjectsGroupsService) Create(name string, group *Group) *ProjectsGroupsCreateCall {
  4371. c := &ProjectsGroupsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4372. c.name = name
  4373. c.group = group
  4374. return c
  4375. }
  4376. // ValidateOnly sets the optional parameter "validateOnly": If true,
  4377. // validate this request but do not create the group.
  4378. func (c *ProjectsGroupsCreateCall) ValidateOnly(validateOnly bool) *ProjectsGroupsCreateCall {
  4379. c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
  4380. return c
  4381. }
  4382. // Fields allows partial responses to be retrieved. See
  4383. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4384. // for more information.
  4385. func (c *ProjectsGroupsCreateCall) Fields(s ...googleapi.Field) *ProjectsGroupsCreateCall {
  4386. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4387. return c
  4388. }
  4389. // Context sets the context to be used in this call's Do method. Any
  4390. // pending HTTP request will be aborted if the provided context is
  4391. // canceled.
  4392. func (c *ProjectsGroupsCreateCall) Context(ctx context.Context) *ProjectsGroupsCreateCall {
  4393. c.ctx_ = ctx
  4394. return c
  4395. }
  4396. // Header returns an http.Header that can be modified by the caller to
  4397. // add HTTP headers to the request.
  4398. func (c *ProjectsGroupsCreateCall) Header() http.Header {
  4399. if c.header_ == nil {
  4400. c.header_ = make(http.Header)
  4401. }
  4402. return c.header_
  4403. }
  4404. func (c *ProjectsGroupsCreateCall) doRequest(alt string) (*http.Response, error) {
  4405. reqHeaders := make(http.Header)
  4406. for k, v := range c.header_ {
  4407. reqHeaders[k] = v
  4408. }
  4409. reqHeaders.Set("User-Agent", c.s.userAgent())
  4410. var body io.Reader = nil
  4411. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  4412. if err != nil {
  4413. return nil, err
  4414. }
  4415. reqHeaders.Set("Content-Type", "application/json")
  4416. c.urlParams_.Set("alt", alt)
  4417. c.urlParams_.Set("prettyPrint", "false")
  4418. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/groups")
  4419. urls += "?" + c.urlParams_.Encode()
  4420. req, err := http.NewRequest("POST", urls, body)
  4421. if err != nil {
  4422. return nil, err
  4423. }
  4424. req.Header = reqHeaders
  4425. googleapi.Expand(req.URL, map[string]string{
  4426. "name": c.name,
  4427. })
  4428. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4429. }
  4430. // Do executes the "monitoring.projects.groups.create" call.
  4431. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4432. // code is an error. Response headers are in either
  4433. // *Group.ServerResponse.Header or (if a response was returned at all)
  4434. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4435. // check whether the returned error was because http.StatusNotModified
  4436. // was returned.
  4437. func (c *ProjectsGroupsCreateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4438. gensupport.SetOptions(c.urlParams_, opts...)
  4439. res, err := c.doRequest("json")
  4440. if res != nil && res.StatusCode == http.StatusNotModified {
  4441. if res.Body != nil {
  4442. res.Body.Close()
  4443. }
  4444. return nil, &googleapi.Error{
  4445. Code: res.StatusCode,
  4446. Header: res.Header,
  4447. }
  4448. }
  4449. if err != nil {
  4450. return nil, err
  4451. }
  4452. defer googleapi.CloseBody(res)
  4453. if err := googleapi.CheckResponse(res); err != nil {
  4454. return nil, err
  4455. }
  4456. ret := &Group{
  4457. ServerResponse: googleapi.ServerResponse{
  4458. Header: res.Header,
  4459. HTTPStatusCode: res.StatusCode,
  4460. },
  4461. }
  4462. target := &ret
  4463. if err := gensupport.DecodeResponse(target, res); err != nil {
  4464. return nil, err
  4465. }
  4466. return ret, nil
  4467. // {
  4468. // "description": "Creates a new group.",
  4469. // "flatPath": "v3/projects/{projectsId}/groups",
  4470. // "httpMethod": "POST",
  4471. // "id": "monitoring.projects.groups.create",
  4472. // "parameterOrder": [
  4473. // "name"
  4474. // ],
  4475. // "parameters": {
  4476. // "name": {
  4477. // "description": "The project in which to create the group. The format is \"projects/{project_id_or_number}\".",
  4478. // "location": "path",
  4479. // "pattern": "^projects/[^/]+$",
  4480. // "required": true,
  4481. // "type": "string"
  4482. // },
  4483. // "validateOnly": {
  4484. // "description": "If true, validate this request but do not create the group.",
  4485. // "location": "query",
  4486. // "type": "boolean"
  4487. // }
  4488. // },
  4489. // "path": "v3/{+name}/groups",
  4490. // "request": {
  4491. // "$ref": "Group"
  4492. // },
  4493. // "response": {
  4494. // "$ref": "Group"
  4495. // },
  4496. // "scopes": [
  4497. // "https://www.googleapis.com/auth/cloud-platform",
  4498. // "https://www.googleapis.com/auth/monitoring"
  4499. // ]
  4500. // }
  4501. }
  4502. // method id "monitoring.projects.groups.delete":
  4503. type ProjectsGroupsDeleteCall struct {
  4504. s *Service
  4505. name string
  4506. urlParams_ gensupport.URLParams
  4507. ctx_ context.Context
  4508. header_ http.Header
  4509. }
  4510. // Delete: Deletes an existing group.
  4511. func (r *ProjectsGroupsService) Delete(name string) *ProjectsGroupsDeleteCall {
  4512. c := &ProjectsGroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4513. c.name = name
  4514. return c
  4515. }
  4516. // Recursive sets the optional parameter "recursive": If this field is
  4517. // true, then the request means to delete a group with all its
  4518. // descendants. Otherwise, the request means to delete a group only when
  4519. // it has no descendants. The default value is false.
  4520. func (c *ProjectsGroupsDeleteCall) Recursive(recursive bool) *ProjectsGroupsDeleteCall {
  4521. c.urlParams_.Set("recursive", fmt.Sprint(recursive))
  4522. return c
  4523. }
  4524. // Fields allows partial responses to be retrieved. See
  4525. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4526. // for more information.
  4527. func (c *ProjectsGroupsDeleteCall) Fields(s ...googleapi.Field) *ProjectsGroupsDeleteCall {
  4528. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4529. return c
  4530. }
  4531. // Context sets the context to be used in this call's Do method. Any
  4532. // pending HTTP request will be aborted if the provided context is
  4533. // canceled.
  4534. func (c *ProjectsGroupsDeleteCall) Context(ctx context.Context) *ProjectsGroupsDeleteCall {
  4535. c.ctx_ = ctx
  4536. return c
  4537. }
  4538. // Header returns an http.Header that can be modified by the caller to
  4539. // add HTTP headers to the request.
  4540. func (c *ProjectsGroupsDeleteCall) Header() http.Header {
  4541. if c.header_ == nil {
  4542. c.header_ = make(http.Header)
  4543. }
  4544. return c.header_
  4545. }
  4546. func (c *ProjectsGroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4547. reqHeaders := make(http.Header)
  4548. for k, v := range c.header_ {
  4549. reqHeaders[k] = v
  4550. }
  4551. reqHeaders.Set("User-Agent", c.s.userAgent())
  4552. var body io.Reader = nil
  4553. c.urlParams_.Set("alt", alt)
  4554. c.urlParams_.Set("prettyPrint", "false")
  4555. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4556. urls += "?" + c.urlParams_.Encode()
  4557. req, err := http.NewRequest("DELETE", urls, body)
  4558. if err != nil {
  4559. return nil, err
  4560. }
  4561. req.Header = reqHeaders
  4562. googleapi.Expand(req.URL, map[string]string{
  4563. "name": c.name,
  4564. })
  4565. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4566. }
  4567. // Do executes the "monitoring.projects.groups.delete" call.
  4568. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4569. // code is an error. Response headers are in either
  4570. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4571. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4572. // check whether the returned error was because http.StatusNotModified
  4573. // was returned.
  4574. func (c *ProjectsGroupsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4575. gensupport.SetOptions(c.urlParams_, opts...)
  4576. res, err := c.doRequest("json")
  4577. if res != nil && res.StatusCode == http.StatusNotModified {
  4578. if res.Body != nil {
  4579. res.Body.Close()
  4580. }
  4581. return nil, &googleapi.Error{
  4582. Code: res.StatusCode,
  4583. Header: res.Header,
  4584. }
  4585. }
  4586. if err != nil {
  4587. return nil, err
  4588. }
  4589. defer googleapi.CloseBody(res)
  4590. if err := googleapi.CheckResponse(res); err != nil {
  4591. return nil, err
  4592. }
  4593. ret := &Empty{
  4594. ServerResponse: googleapi.ServerResponse{
  4595. Header: res.Header,
  4596. HTTPStatusCode: res.StatusCode,
  4597. },
  4598. }
  4599. target := &ret
  4600. if err := gensupport.DecodeResponse(target, res); err != nil {
  4601. return nil, err
  4602. }
  4603. return ret, nil
  4604. // {
  4605. // "description": "Deletes an existing group.",
  4606. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  4607. // "httpMethod": "DELETE",
  4608. // "id": "monitoring.projects.groups.delete",
  4609. // "parameterOrder": [
  4610. // "name"
  4611. // ],
  4612. // "parameters": {
  4613. // "name": {
  4614. // "description": "The group to delete. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  4615. // "location": "path",
  4616. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4617. // "required": true,
  4618. // "type": "string"
  4619. // },
  4620. // "recursive": {
  4621. // "description": "If this field is true, then the request means to delete a group with all its descendants. Otherwise, the request means to delete a group only when it has no descendants. The default value is false.",
  4622. // "location": "query",
  4623. // "type": "boolean"
  4624. // }
  4625. // },
  4626. // "path": "v3/{+name}",
  4627. // "response": {
  4628. // "$ref": "Empty"
  4629. // },
  4630. // "scopes": [
  4631. // "https://www.googleapis.com/auth/cloud-platform",
  4632. // "https://www.googleapis.com/auth/monitoring"
  4633. // ]
  4634. // }
  4635. }
  4636. // method id "monitoring.projects.groups.get":
  4637. type ProjectsGroupsGetCall struct {
  4638. s *Service
  4639. name string
  4640. urlParams_ gensupport.URLParams
  4641. ifNoneMatch_ string
  4642. ctx_ context.Context
  4643. header_ http.Header
  4644. }
  4645. // Get: Gets a single group.
  4646. func (r *ProjectsGroupsService) Get(name string) *ProjectsGroupsGetCall {
  4647. c := &ProjectsGroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4648. c.name = name
  4649. return c
  4650. }
  4651. // Fields allows partial responses to be retrieved. See
  4652. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4653. // for more information.
  4654. func (c *ProjectsGroupsGetCall) Fields(s ...googleapi.Field) *ProjectsGroupsGetCall {
  4655. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4656. return c
  4657. }
  4658. // IfNoneMatch sets the optional parameter which makes the operation
  4659. // fail if the object's ETag matches the given value. This is useful for
  4660. // getting updates only after the object has changed since the last
  4661. // request. Use googleapi.IsNotModified to check whether the response
  4662. // error from Do is the result of In-None-Match.
  4663. func (c *ProjectsGroupsGetCall) IfNoneMatch(entityTag string) *ProjectsGroupsGetCall {
  4664. c.ifNoneMatch_ = entityTag
  4665. return c
  4666. }
  4667. // Context sets the context to be used in this call's Do method. Any
  4668. // pending HTTP request will be aborted if the provided context is
  4669. // canceled.
  4670. func (c *ProjectsGroupsGetCall) Context(ctx context.Context) *ProjectsGroupsGetCall {
  4671. c.ctx_ = ctx
  4672. return c
  4673. }
  4674. // Header returns an http.Header that can be modified by the caller to
  4675. // add HTTP headers to the request.
  4676. func (c *ProjectsGroupsGetCall) Header() http.Header {
  4677. if c.header_ == nil {
  4678. c.header_ = make(http.Header)
  4679. }
  4680. return c.header_
  4681. }
  4682. func (c *ProjectsGroupsGetCall) doRequest(alt string) (*http.Response, error) {
  4683. reqHeaders := make(http.Header)
  4684. for k, v := range c.header_ {
  4685. reqHeaders[k] = v
  4686. }
  4687. reqHeaders.Set("User-Agent", c.s.userAgent())
  4688. if c.ifNoneMatch_ != "" {
  4689. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4690. }
  4691. var body io.Reader = nil
  4692. c.urlParams_.Set("alt", alt)
  4693. c.urlParams_.Set("prettyPrint", "false")
  4694. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4695. urls += "?" + c.urlParams_.Encode()
  4696. req, err := http.NewRequest("GET", urls, body)
  4697. if err != nil {
  4698. return nil, err
  4699. }
  4700. req.Header = reqHeaders
  4701. googleapi.Expand(req.URL, map[string]string{
  4702. "name": c.name,
  4703. })
  4704. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4705. }
  4706. // Do executes the "monitoring.projects.groups.get" call.
  4707. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4708. // code is an error. Response headers are in either
  4709. // *Group.ServerResponse.Header or (if a response was returned at all)
  4710. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4711. // check whether the returned error was because http.StatusNotModified
  4712. // was returned.
  4713. func (c *ProjectsGroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4714. gensupport.SetOptions(c.urlParams_, opts...)
  4715. res, err := c.doRequest("json")
  4716. if res != nil && res.StatusCode == http.StatusNotModified {
  4717. if res.Body != nil {
  4718. res.Body.Close()
  4719. }
  4720. return nil, &googleapi.Error{
  4721. Code: res.StatusCode,
  4722. Header: res.Header,
  4723. }
  4724. }
  4725. if err != nil {
  4726. return nil, err
  4727. }
  4728. defer googleapi.CloseBody(res)
  4729. if err := googleapi.CheckResponse(res); err != nil {
  4730. return nil, err
  4731. }
  4732. ret := &Group{
  4733. ServerResponse: googleapi.ServerResponse{
  4734. Header: res.Header,
  4735. HTTPStatusCode: res.StatusCode,
  4736. },
  4737. }
  4738. target := &ret
  4739. if err := gensupport.DecodeResponse(target, res); err != nil {
  4740. return nil, err
  4741. }
  4742. return ret, nil
  4743. // {
  4744. // "description": "Gets a single group.",
  4745. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  4746. // "httpMethod": "GET",
  4747. // "id": "monitoring.projects.groups.get",
  4748. // "parameterOrder": [
  4749. // "name"
  4750. // ],
  4751. // "parameters": {
  4752. // "name": {
  4753. // "description": "The group to retrieve. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  4754. // "location": "path",
  4755. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4756. // "required": true,
  4757. // "type": "string"
  4758. // }
  4759. // },
  4760. // "path": "v3/{+name}",
  4761. // "response": {
  4762. // "$ref": "Group"
  4763. // },
  4764. // "scopes": [
  4765. // "https://www.googleapis.com/auth/cloud-platform",
  4766. // "https://www.googleapis.com/auth/monitoring",
  4767. // "https://www.googleapis.com/auth/monitoring.read"
  4768. // ]
  4769. // }
  4770. }
  4771. // method id "monitoring.projects.groups.list":
  4772. type ProjectsGroupsListCall struct {
  4773. s *Service
  4774. name string
  4775. urlParams_ gensupport.URLParams
  4776. ifNoneMatch_ string
  4777. ctx_ context.Context
  4778. header_ http.Header
  4779. }
  4780. // List: Lists the existing groups.
  4781. func (r *ProjectsGroupsService) List(name string) *ProjectsGroupsListCall {
  4782. c := &ProjectsGroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4783. c.name = name
  4784. return c
  4785. }
  4786. // AncestorsOfGroup sets the optional parameter "ancestorsOfGroup": A
  4787. // group name: "projects/{project_id_or_number}/groups/{group_id}".
  4788. // Returns groups that are ancestors of the specified group. The groups
  4789. // are returned in order, starting with the immediate parent and ending
  4790. // with the most distant ancestor. If the specified group has no
  4791. // immediate parent, the results are empty.
  4792. func (c *ProjectsGroupsListCall) AncestorsOfGroup(ancestorsOfGroup string) *ProjectsGroupsListCall {
  4793. c.urlParams_.Set("ancestorsOfGroup", ancestorsOfGroup)
  4794. return c
  4795. }
  4796. // ChildrenOfGroup sets the optional parameter "childrenOfGroup": A
  4797. // group name: "projects/{project_id_or_number}/groups/{group_id}".
  4798. // Returns groups whose parentName field contains the group name. If no
  4799. // groups have this parent, the results are empty.
  4800. func (c *ProjectsGroupsListCall) ChildrenOfGroup(childrenOfGroup string) *ProjectsGroupsListCall {
  4801. c.urlParams_.Set("childrenOfGroup", childrenOfGroup)
  4802. return c
  4803. }
  4804. // DescendantsOfGroup sets the optional parameter "descendantsOfGroup":
  4805. // A group name: "projects/{project_id_or_number}/groups/{group_id}".
  4806. // Returns the descendants of the specified group. This is a superset of
  4807. // the results returned by the childrenOfGroup filter, and includes
  4808. // children-of-children, and so forth.
  4809. func (c *ProjectsGroupsListCall) DescendantsOfGroup(descendantsOfGroup string) *ProjectsGroupsListCall {
  4810. c.urlParams_.Set("descendantsOfGroup", descendantsOfGroup)
  4811. return c
  4812. }
  4813. // PageSize sets the optional parameter "pageSize": A positive number
  4814. // that is the maximum number of results to return.
  4815. func (c *ProjectsGroupsListCall) PageSize(pageSize int64) *ProjectsGroupsListCall {
  4816. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4817. return c
  4818. }
  4819. // PageToken sets the optional parameter "pageToken": If this field is
  4820. // not empty then it must contain the nextPageToken value returned by a
  4821. // previous call to this method. Using this field causes the method to
  4822. // return additional results from the previous method call.
  4823. func (c *ProjectsGroupsListCall) PageToken(pageToken string) *ProjectsGroupsListCall {
  4824. c.urlParams_.Set("pageToken", pageToken)
  4825. return c
  4826. }
  4827. // Fields allows partial responses to be retrieved. See
  4828. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4829. // for more information.
  4830. func (c *ProjectsGroupsListCall) Fields(s ...googleapi.Field) *ProjectsGroupsListCall {
  4831. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4832. return c
  4833. }
  4834. // IfNoneMatch sets the optional parameter which makes the operation
  4835. // fail if the object's ETag matches the given value. This is useful for
  4836. // getting updates only after the object has changed since the last
  4837. // request. Use googleapi.IsNotModified to check whether the response
  4838. // error from Do is the result of In-None-Match.
  4839. func (c *ProjectsGroupsListCall) IfNoneMatch(entityTag string) *ProjectsGroupsListCall {
  4840. c.ifNoneMatch_ = entityTag
  4841. return c
  4842. }
  4843. // Context sets the context to be used in this call's Do method. Any
  4844. // pending HTTP request will be aborted if the provided context is
  4845. // canceled.
  4846. func (c *ProjectsGroupsListCall) Context(ctx context.Context) *ProjectsGroupsListCall {
  4847. c.ctx_ = ctx
  4848. return c
  4849. }
  4850. // Header returns an http.Header that can be modified by the caller to
  4851. // add HTTP headers to the request.
  4852. func (c *ProjectsGroupsListCall) Header() http.Header {
  4853. if c.header_ == nil {
  4854. c.header_ = make(http.Header)
  4855. }
  4856. return c.header_
  4857. }
  4858. func (c *ProjectsGroupsListCall) doRequest(alt string) (*http.Response, error) {
  4859. reqHeaders := make(http.Header)
  4860. for k, v := range c.header_ {
  4861. reqHeaders[k] = v
  4862. }
  4863. reqHeaders.Set("User-Agent", c.s.userAgent())
  4864. if c.ifNoneMatch_ != "" {
  4865. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4866. }
  4867. var body io.Reader = nil
  4868. c.urlParams_.Set("alt", alt)
  4869. c.urlParams_.Set("prettyPrint", "false")
  4870. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/groups")
  4871. urls += "?" + c.urlParams_.Encode()
  4872. req, err := http.NewRequest("GET", urls, body)
  4873. if err != nil {
  4874. return nil, err
  4875. }
  4876. req.Header = reqHeaders
  4877. googleapi.Expand(req.URL, map[string]string{
  4878. "name": c.name,
  4879. })
  4880. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4881. }
  4882. // Do executes the "monitoring.projects.groups.list" call.
  4883. // Exactly one of *ListGroupsResponse or error will be non-nil. Any
  4884. // non-2xx status code is an error. Response headers are in either
  4885. // *ListGroupsResponse.ServerResponse.Header or (if a response was
  4886. // returned at all) in error.(*googleapi.Error).Header. Use
  4887. // googleapi.IsNotModified to check whether the returned error was
  4888. // because http.StatusNotModified was returned.
  4889. func (c *ProjectsGroupsListCall) Do(opts ...googleapi.CallOption) (*ListGroupsResponse, error) {
  4890. gensupport.SetOptions(c.urlParams_, opts...)
  4891. res, err := c.doRequest("json")
  4892. if res != nil && res.StatusCode == http.StatusNotModified {
  4893. if res.Body != nil {
  4894. res.Body.Close()
  4895. }
  4896. return nil, &googleapi.Error{
  4897. Code: res.StatusCode,
  4898. Header: res.Header,
  4899. }
  4900. }
  4901. if err != nil {
  4902. return nil, err
  4903. }
  4904. defer googleapi.CloseBody(res)
  4905. if err := googleapi.CheckResponse(res); err != nil {
  4906. return nil, err
  4907. }
  4908. ret := &ListGroupsResponse{
  4909. ServerResponse: googleapi.ServerResponse{
  4910. Header: res.Header,
  4911. HTTPStatusCode: res.StatusCode,
  4912. },
  4913. }
  4914. target := &ret
  4915. if err := gensupport.DecodeResponse(target, res); err != nil {
  4916. return nil, err
  4917. }
  4918. return ret, nil
  4919. // {
  4920. // "description": "Lists the existing groups.",
  4921. // "flatPath": "v3/projects/{projectsId}/groups",
  4922. // "httpMethod": "GET",
  4923. // "id": "monitoring.projects.groups.list",
  4924. // "parameterOrder": [
  4925. // "name"
  4926. // ],
  4927. // "parameters": {
  4928. // "ancestorsOfGroup": {
  4929. // "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns groups that are ancestors of the specified group. The groups are returned in order, starting with the immediate parent and ending with the most distant ancestor. If the specified group has no immediate parent, the results are empty.",
  4930. // "location": "query",
  4931. // "type": "string"
  4932. // },
  4933. // "childrenOfGroup": {
  4934. // "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns groups whose parentName field contains the group name. If no groups have this parent, the results are empty.",
  4935. // "location": "query",
  4936. // "type": "string"
  4937. // },
  4938. // "descendantsOfGroup": {
  4939. // "description": "A group name: \"projects/{project_id_or_number}/groups/{group_id}\". Returns the descendants of the specified group. This is a superset of the results returned by the childrenOfGroup filter, and includes children-of-children, and so forth.",
  4940. // "location": "query",
  4941. // "type": "string"
  4942. // },
  4943. // "name": {
  4944. // "description": "The project whose groups are to be listed. The format is \"projects/{project_id_or_number}\".",
  4945. // "location": "path",
  4946. // "pattern": "^projects/[^/]+$",
  4947. // "required": true,
  4948. // "type": "string"
  4949. // },
  4950. // "pageSize": {
  4951. // "description": "A positive number that is the maximum number of results to return.",
  4952. // "format": "int32",
  4953. // "location": "query",
  4954. // "type": "integer"
  4955. // },
  4956. // "pageToken": {
  4957. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.",
  4958. // "location": "query",
  4959. // "type": "string"
  4960. // }
  4961. // },
  4962. // "path": "v3/{+name}/groups",
  4963. // "response": {
  4964. // "$ref": "ListGroupsResponse"
  4965. // },
  4966. // "scopes": [
  4967. // "https://www.googleapis.com/auth/cloud-platform",
  4968. // "https://www.googleapis.com/auth/monitoring",
  4969. // "https://www.googleapis.com/auth/monitoring.read"
  4970. // ]
  4971. // }
  4972. }
  4973. // Pages invokes f for each page of results.
  4974. // A non-nil error returned from f will halt the iteration.
  4975. // The provided context supersedes any context provided to the Context method.
  4976. func (c *ProjectsGroupsListCall) Pages(ctx context.Context, f func(*ListGroupsResponse) error) error {
  4977. c.ctx_ = ctx
  4978. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4979. for {
  4980. x, err := c.Do()
  4981. if err != nil {
  4982. return err
  4983. }
  4984. if err := f(x); err != nil {
  4985. return err
  4986. }
  4987. if x.NextPageToken == "" {
  4988. return nil
  4989. }
  4990. c.PageToken(x.NextPageToken)
  4991. }
  4992. }
  4993. // method id "monitoring.projects.groups.update":
  4994. type ProjectsGroupsUpdateCall struct {
  4995. s *Service
  4996. name string
  4997. group *Group
  4998. urlParams_ gensupport.URLParams
  4999. ctx_ context.Context
  5000. header_ http.Header
  5001. }
  5002. // Update: Updates an existing group. You can change any group
  5003. // attributes except name.
  5004. func (r *ProjectsGroupsService) Update(name string, group *Group) *ProjectsGroupsUpdateCall {
  5005. c := &ProjectsGroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5006. c.name = name
  5007. c.group = group
  5008. return c
  5009. }
  5010. // ValidateOnly sets the optional parameter "validateOnly": If true,
  5011. // validate this request but do not update the existing group.
  5012. func (c *ProjectsGroupsUpdateCall) ValidateOnly(validateOnly bool) *ProjectsGroupsUpdateCall {
  5013. c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
  5014. return c
  5015. }
  5016. // Fields allows partial responses to be retrieved. See
  5017. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5018. // for more information.
  5019. func (c *ProjectsGroupsUpdateCall) Fields(s ...googleapi.Field) *ProjectsGroupsUpdateCall {
  5020. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5021. return c
  5022. }
  5023. // Context sets the context to be used in this call's Do method. Any
  5024. // pending HTTP request will be aborted if the provided context is
  5025. // canceled.
  5026. func (c *ProjectsGroupsUpdateCall) Context(ctx context.Context) *ProjectsGroupsUpdateCall {
  5027. c.ctx_ = ctx
  5028. return c
  5029. }
  5030. // Header returns an http.Header that can be modified by the caller to
  5031. // add HTTP headers to the request.
  5032. func (c *ProjectsGroupsUpdateCall) Header() http.Header {
  5033. if c.header_ == nil {
  5034. c.header_ = make(http.Header)
  5035. }
  5036. return c.header_
  5037. }
  5038. func (c *ProjectsGroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5039. reqHeaders := make(http.Header)
  5040. for k, v := range c.header_ {
  5041. reqHeaders[k] = v
  5042. }
  5043. reqHeaders.Set("User-Agent", c.s.userAgent())
  5044. var body io.Reader = nil
  5045. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  5046. if err != nil {
  5047. return nil, err
  5048. }
  5049. reqHeaders.Set("Content-Type", "application/json")
  5050. c.urlParams_.Set("alt", alt)
  5051. c.urlParams_.Set("prettyPrint", "false")
  5052. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5053. urls += "?" + c.urlParams_.Encode()
  5054. req, err := http.NewRequest("PUT", urls, body)
  5055. if err != nil {
  5056. return nil, err
  5057. }
  5058. req.Header = reqHeaders
  5059. googleapi.Expand(req.URL, map[string]string{
  5060. "name": c.name,
  5061. })
  5062. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5063. }
  5064. // Do executes the "monitoring.projects.groups.update" call.
  5065. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  5066. // code is an error. Response headers are in either
  5067. // *Group.ServerResponse.Header or (if a response was returned at all)
  5068. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5069. // check whether the returned error was because http.StatusNotModified
  5070. // was returned.
  5071. func (c *ProjectsGroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  5072. gensupport.SetOptions(c.urlParams_, opts...)
  5073. res, err := c.doRequest("json")
  5074. if res != nil && res.StatusCode == http.StatusNotModified {
  5075. if res.Body != nil {
  5076. res.Body.Close()
  5077. }
  5078. return nil, &googleapi.Error{
  5079. Code: res.StatusCode,
  5080. Header: res.Header,
  5081. }
  5082. }
  5083. if err != nil {
  5084. return nil, err
  5085. }
  5086. defer googleapi.CloseBody(res)
  5087. if err := googleapi.CheckResponse(res); err != nil {
  5088. return nil, err
  5089. }
  5090. ret := &Group{
  5091. ServerResponse: googleapi.ServerResponse{
  5092. Header: res.Header,
  5093. HTTPStatusCode: res.StatusCode,
  5094. },
  5095. }
  5096. target := &ret
  5097. if err := gensupport.DecodeResponse(target, res); err != nil {
  5098. return nil, err
  5099. }
  5100. return ret, nil
  5101. // {
  5102. // "description": "Updates an existing group. You can change any group attributes except name.",
  5103. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  5104. // "httpMethod": "PUT",
  5105. // "id": "monitoring.projects.groups.update",
  5106. // "parameterOrder": [
  5107. // "name"
  5108. // ],
  5109. // "parameters": {
  5110. // "name": {
  5111. // "description": "Output only. The name of this group. The format is \"projects/{project_id_or_number}/groups/{group_id}\". When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique {group_id} that is generated automatically.",
  5112. // "location": "path",
  5113. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  5114. // "required": true,
  5115. // "type": "string"
  5116. // },
  5117. // "validateOnly": {
  5118. // "description": "If true, validate this request but do not update the existing group.",
  5119. // "location": "query",
  5120. // "type": "boolean"
  5121. // }
  5122. // },
  5123. // "path": "v3/{+name}",
  5124. // "request": {
  5125. // "$ref": "Group"
  5126. // },
  5127. // "response": {
  5128. // "$ref": "Group"
  5129. // },
  5130. // "scopes": [
  5131. // "https://www.googleapis.com/auth/cloud-platform",
  5132. // "https://www.googleapis.com/auth/monitoring"
  5133. // ]
  5134. // }
  5135. }
  5136. // method id "monitoring.projects.groups.members.list":
  5137. type ProjectsGroupsMembersListCall struct {
  5138. s *Service
  5139. name string
  5140. urlParams_ gensupport.URLParams
  5141. ifNoneMatch_ string
  5142. ctx_ context.Context
  5143. header_ http.Header
  5144. }
  5145. // List: Lists the monitored resources that are members of a group.
  5146. func (r *ProjectsGroupsMembersService) List(name string) *ProjectsGroupsMembersListCall {
  5147. c := &ProjectsGroupsMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5148. c.name = name
  5149. return c
  5150. }
  5151. // Filter sets the optional parameter "filter": An optional list filter
  5152. // describing the members to be returned. The filter may reference the
  5153. // type, labels, and metadata of monitored resources that comprise the
  5154. // group. For example, to return only resources representing Compute
  5155. // Engine VM instances, use this filter:
  5156. // resource.type = "gce_instance"
  5157. func (c *ProjectsGroupsMembersListCall) Filter(filter string) *ProjectsGroupsMembersListCall {
  5158. c.urlParams_.Set("filter", filter)
  5159. return c
  5160. }
  5161. // IntervalEndTime sets the optional parameter "interval.endTime":
  5162. // Required. The end of the time interval.
  5163. func (c *ProjectsGroupsMembersListCall) IntervalEndTime(intervalEndTime string) *ProjectsGroupsMembersListCall {
  5164. c.urlParams_.Set("interval.endTime", intervalEndTime)
  5165. return c
  5166. }
  5167. // IntervalStartTime sets the optional parameter "interval.startTime":
  5168. // The beginning of the time interval. The default value for the start
  5169. // time is the end time. The start time must not be later than the end
  5170. // time.
  5171. func (c *ProjectsGroupsMembersListCall) IntervalStartTime(intervalStartTime string) *ProjectsGroupsMembersListCall {
  5172. c.urlParams_.Set("interval.startTime", intervalStartTime)
  5173. return c
  5174. }
  5175. // PageSize sets the optional parameter "pageSize": A positive number
  5176. // that is the maximum number of results to return.
  5177. func (c *ProjectsGroupsMembersListCall) PageSize(pageSize int64) *ProjectsGroupsMembersListCall {
  5178. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5179. return c
  5180. }
  5181. // PageToken sets the optional parameter "pageToken": If this field is
  5182. // not empty then it must contain the nextPageToken value returned by a
  5183. // previous call to this method. Using this field causes the method to
  5184. // return additional results from the previous method call.
  5185. func (c *ProjectsGroupsMembersListCall) PageToken(pageToken string) *ProjectsGroupsMembersListCall {
  5186. c.urlParams_.Set("pageToken", pageToken)
  5187. return c
  5188. }
  5189. // Fields allows partial responses to be retrieved. See
  5190. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5191. // for more information.
  5192. func (c *ProjectsGroupsMembersListCall) Fields(s ...googleapi.Field) *ProjectsGroupsMembersListCall {
  5193. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5194. return c
  5195. }
  5196. // IfNoneMatch sets the optional parameter which makes the operation
  5197. // fail if the object's ETag matches the given value. This is useful for
  5198. // getting updates only after the object has changed since the last
  5199. // request. Use googleapi.IsNotModified to check whether the response
  5200. // error from Do is the result of In-None-Match.
  5201. func (c *ProjectsGroupsMembersListCall) IfNoneMatch(entityTag string) *ProjectsGroupsMembersListCall {
  5202. c.ifNoneMatch_ = entityTag
  5203. return c
  5204. }
  5205. // Context sets the context to be used in this call's Do method. Any
  5206. // pending HTTP request will be aborted if the provided context is
  5207. // canceled.
  5208. func (c *ProjectsGroupsMembersListCall) Context(ctx context.Context) *ProjectsGroupsMembersListCall {
  5209. c.ctx_ = ctx
  5210. return c
  5211. }
  5212. // Header returns an http.Header that can be modified by the caller to
  5213. // add HTTP headers to the request.
  5214. func (c *ProjectsGroupsMembersListCall) Header() http.Header {
  5215. if c.header_ == nil {
  5216. c.header_ = make(http.Header)
  5217. }
  5218. return c.header_
  5219. }
  5220. func (c *ProjectsGroupsMembersListCall) doRequest(alt string) (*http.Response, error) {
  5221. reqHeaders := make(http.Header)
  5222. for k, v := range c.header_ {
  5223. reqHeaders[k] = v
  5224. }
  5225. reqHeaders.Set("User-Agent", c.s.userAgent())
  5226. if c.ifNoneMatch_ != "" {
  5227. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5228. }
  5229. var body io.Reader = nil
  5230. c.urlParams_.Set("alt", alt)
  5231. c.urlParams_.Set("prettyPrint", "false")
  5232. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/members")
  5233. urls += "?" + c.urlParams_.Encode()
  5234. req, err := http.NewRequest("GET", urls, body)
  5235. if err != nil {
  5236. return nil, err
  5237. }
  5238. req.Header = reqHeaders
  5239. googleapi.Expand(req.URL, map[string]string{
  5240. "name": c.name,
  5241. })
  5242. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5243. }
  5244. // Do executes the "monitoring.projects.groups.members.list" call.
  5245. // Exactly one of *ListGroupMembersResponse or error will be non-nil.
  5246. // Any non-2xx status code is an error. Response headers are in either
  5247. // *ListGroupMembersResponse.ServerResponse.Header or (if a response was
  5248. // returned at all) in error.(*googleapi.Error).Header. Use
  5249. // googleapi.IsNotModified to check whether the returned error was
  5250. // because http.StatusNotModified was returned.
  5251. func (c *ProjectsGroupsMembersListCall) Do(opts ...googleapi.CallOption) (*ListGroupMembersResponse, error) {
  5252. gensupport.SetOptions(c.urlParams_, opts...)
  5253. res, err := c.doRequest("json")
  5254. if res != nil && res.StatusCode == http.StatusNotModified {
  5255. if res.Body != nil {
  5256. res.Body.Close()
  5257. }
  5258. return nil, &googleapi.Error{
  5259. Code: res.StatusCode,
  5260. Header: res.Header,
  5261. }
  5262. }
  5263. if err != nil {
  5264. return nil, err
  5265. }
  5266. defer googleapi.CloseBody(res)
  5267. if err := googleapi.CheckResponse(res); err != nil {
  5268. return nil, err
  5269. }
  5270. ret := &ListGroupMembersResponse{
  5271. ServerResponse: googleapi.ServerResponse{
  5272. Header: res.Header,
  5273. HTTPStatusCode: res.StatusCode,
  5274. },
  5275. }
  5276. target := &ret
  5277. if err := gensupport.DecodeResponse(target, res); err != nil {
  5278. return nil, err
  5279. }
  5280. return ret, nil
  5281. // {
  5282. // "description": "Lists the monitored resources that are members of a group.",
  5283. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}/members",
  5284. // "httpMethod": "GET",
  5285. // "id": "monitoring.projects.groups.members.list",
  5286. // "parameterOrder": [
  5287. // "name"
  5288. // ],
  5289. // "parameters": {
  5290. // "filter": {
  5291. // "description": "An optional list filter describing the members to be returned. The filter may reference the type, labels, and metadata of monitored resources that comprise the group. For example, to return only resources representing Compute Engine VM instances, use this filter:\nresource.type = \"gce_instance\"\n",
  5292. // "location": "query",
  5293. // "type": "string"
  5294. // },
  5295. // "interval.endTime": {
  5296. // "description": "Required. The end of the time interval.",
  5297. // "format": "google-datetime",
  5298. // "location": "query",
  5299. // "type": "string"
  5300. // },
  5301. // "interval.startTime": {
  5302. // "description": "Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.",
  5303. // "format": "google-datetime",
  5304. // "location": "query",
  5305. // "type": "string"
  5306. // },
  5307. // "name": {
  5308. // "description": "The group whose members are listed. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  5309. // "location": "path",
  5310. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  5311. // "required": true,
  5312. // "type": "string"
  5313. // },
  5314. // "pageSize": {
  5315. // "description": "A positive number that is the maximum number of results to return.",
  5316. // "format": "int32",
  5317. // "location": "query",
  5318. // "type": "integer"
  5319. // },
  5320. // "pageToken": {
  5321. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.",
  5322. // "location": "query",
  5323. // "type": "string"
  5324. // }
  5325. // },
  5326. // "path": "v3/{+name}/members",
  5327. // "response": {
  5328. // "$ref": "ListGroupMembersResponse"
  5329. // },
  5330. // "scopes": [
  5331. // "https://www.googleapis.com/auth/cloud-platform",
  5332. // "https://www.googleapis.com/auth/monitoring",
  5333. // "https://www.googleapis.com/auth/monitoring.read"
  5334. // ]
  5335. // }
  5336. }
  5337. // Pages invokes f for each page of results.
  5338. // A non-nil error returned from f will halt the iteration.
  5339. // The provided context supersedes any context provided to the Context method.
  5340. func (c *ProjectsGroupsMembersListCall) Pages(ctx context.Context, f func(*ListGroupMembersResponse) error) error {
  5341. c.ctx_ = ctx
  5342. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5343. for {
  5344. x, err := c.Do()
  5345. if err != nil {
  5346. return err
  5347. }
  5348. if err := f(x); err != nil {
  5349. return err
  5350. }
  5351. if x.NextPageToken == "" {
  5352. return nil
  5353. }
  5354. c.PageToken(x.NextPageToken)
  5355. }
  5356. }
  5357. // method id "monitoring.projects.metricDescriptors.create":
  5358. type ProjectsMetricDescriptorsCreateCall struct {
  5359. s *Service
  5360. name string
  5361. metricdescriptor *MetricDescriptor
  5362. urlParams_ gensupport.URLParams
  5363. ctx_ context.Context
  5364. header_ http.Header
  5365. }
  5366. // Create: Creates a new metric descriptor. User-created metric
  5367. // descriptors define custom metrics.
  5368. func (r *ProjectsMetricDescriptorsService) Create(name string, metricdescriptor *MetricDescriptor) *ProjectsMetricDescriptorsCreateCall {
  5369. c := &ProjectsMetricDescriptorsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5370. c.name = name
  5371. c.metricdescriptor = metricdescriptor
  5372. return c
  5373. }
  5374. // Fields allows partial responses to be retrieved. See
  5375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5376. // for more information.
  5377. func (c *ProjectsMetricDescriptorsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsCreateCall {
  5378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5379. return c
  5380. }
  5381. // Context sets the context to be used in this call's Do method. Any
  5382. // pending HTTP request will be aborted if the provided context is
  5383. // canceled.
  5384. func (c *ProjectsMetricDescriptorsCreateCall) Context(ctx context.Context) *ProjectsMetricDescriptorsCreateCall {
  5385. c.ctx_ = ctx
  5386. return c
  5387. }
  5388. // Header returns an http.Header that can be modified by the caller to
  5389. // add HTTP headers to the request.
  5390. func (c *ProjectsMetricDescriptorsCreateCall) Header() http.Header {
  5391. if c.header_ == nil {
  5392. c.header_ = make(http.Header)
  5393. }
  5394. return c.header_
  5395. }
  5396. func (c *ProjectsMetricDescriptorsCreateCall) doRequest(alt string) (*http.Response, error) {
  5397. reqHeaders := make(http.Header)
  5398. for k, v := range c.header_ {
  5399. reqHeaders[k] = v
  5400. }
  5401. reqHeaders.Set("User-Agent", c.s.userAgent())
  5402. var body io.Reader = nil
  5403. body, err := googleapi.WithoutDataWrapper.JSONReader(c.metricdescriptor)
  5404. if err != nil {
  5405. return nil, err
  5406. }
  5407. reqHeaders.Set("Content-Type", "application/json")
  5408. c.urlParams_.Set("alt", alt)
  5409. c.urlParams_.Set("prettyPrint", "false")
  5410. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/metricDescriptors")
  5411. urls += "?" + c.urlParams_.Encode()
  5412. req, err := http.NewRequest("POST", urls, body)
  5413. if err != nil {
  5414. return nil, err
  5415. }
  5416. req.Header = reqHeaders
  5417. googleapi.Expand(req.URL, map[string]string{
  5418. "name": c.name,
  5419. })
  5420. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5421. }
  5422. // Do executes the "monitoring.projects.metricDescriptors.create" call.
  5423. // Exactly one of *MetricDescriptor or error will be non-nil. Any
  5424. // non-2xx status code is an error. Response headers are in either
  5425. // *MetricDescriptor.ServerResponse.Header or (if a response was
  5426. // returned at all) in error.(*googleapi.Error).Header. Use
  5427. // googleapi.IsNotModified to check whether the returned error was
  5428. // because http.StatusNotModified was returned.
  5429. func (c *ProjectsMetricDescriptorsCreateCall) Do(opts ...googleapi.CallOption) (*MetricDescriptor, error) {
  5430. gensupport.SetOptions(c.urlParams_, opts...)
  5431. res, err := c.doRequest("json")
  5432. if res != nil && res.StatusCode == http.StatusNotModified {
  5433. if res.Body != nil {
  5434. res.Body.Close()
  5435. }
  5436. return nil, &googleapi.Error{
  5437. Code: res.StatusCode,
  5438. Header: res.Header,
  5439. }
  5440. }
  5441. if err != nil {
  5442. return nil, err
  5443. }
  5444. defer googleapi.CloseBody(res)
  5445. if err := googleapi.CheckResponse(res); err != nil {
  5446. return nil, err
  5447. }
  5448. ret := &MetricDescriptor{
  5449. ServerResponse: googleapi.ServerResponse{
  5450. Header: res.Header,
  5451. HTTPStatusCode: res.StatusCode,
  5452. },
  5453. }
  5454. target := &ret
  5455. if err := gensupport.DecodeResponse(target, res); err != nil {
  5456. return nil, err
  5457. }
  5458. return ret, nil
  5459. // {
  5460. // "description": "Creates a new metric descriptor. User-created metric descriptors define custom metrics.",
  5461. // "flatPath": "v3/projects/{projectsId}/metricDescriptors",
  5462. // "httpMethod": "POST",
  5463. // "id": "monitoring.projects.metricDescriptors.create",
  5464. // "parameterOrder": [
  5465. // "name"
  5466. // ],
  5467. // "parameters": {
  5468. // "name": {
  5469. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  5470. // "location": "path",
  5471. // "pattern": "^projects/[^/]+$",
  5472. // "required": true,
  5473. // "type": "string"
  5474. // }
  5475. // },
  5476. // "path": "v3/{+name}/metricDescriptors",
  5477. // "request": {
  5478. // "$ref": "MetricDescriptor"
  5479. // },
  5480. // "response": {
  5481. // "$ref": "MetricDescriptor"
  5482. // },
  5483. // "scopes": [
  5484. // "https://www.googleapis.com/auth/cloud-platform",
  5485. // "https://www.googleapis.com/auth/monitoring",
  5486. // "https://www.googleapis.com/auth/monitoring.write"
  5487. // ]
  5488. // }
  5489. }
  5490. // method id "monitoring.projects.metricDescriptors.delete":
  5491. type ProjectsMetricDescriptorsDeleteCall struct {
  5492. s *Service
  5493. name string
  5494. urlParams_ gensupport.URLParams
  5495. ctx_ context.Context
  5496. header_ http.Header
  5497. }
  5498. // Delete: Deletes a metric descriptor. Only user-created custom metrics
  5499. // can be deleted.
  5500. func (r *ProjectsMetricDescriptorsService) Delete(name string) *ProjectsMetricDescriptorsDeleteCall {
  5501. c := &ProjectsMetricDescriptorsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5502. c.name = name
  5503. return c
  5504. }
  5505. // Fields allows partial responses to be retrieved. See
  5506. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5507. // for more information.
  5508. func (c *ProjectsMetricDescriptorsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsDeleteCall {
  5509. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5510. return c
  5511. }
  5512. // Context sets the context to be used in this call's Do method. Any
  5513. // pending HTTP request will be aborted if the provided context is
  5514. // canceled.
  5515. func (c *ProjectsMetricDescriptorsDeleteCall) Context(ctx context.Context) *ProjectsMetricDescriptorsDeleteCall {
  5516. c.ctx_ = ctx
  5517. return c
  5518. }
  5519. // Header returns an http.Header that can be modified by the caller to
  5520. // add HTTP headers to the request.
  5521. func (c *ProjectsMetricDescriptorsDeleteCall) Header() http.Header {
  5522. if c.header_ == nil {
  5523. c.header_ = make(http.Header)
  5524. }
  5525. return c.header_
  5526. }
  5527. func (c *ProjectsMetricDescriptorsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5528. reqHeaders := make(http.Header)
  5529. for k, v := range c.header_ {
  5530. reqHeaders[k] = v
  5531. }
  5532. reqHeaders.Set("User-Agent", c.s.userAgent())
  5533. var body io.Reader = nil
  5534. c.urlParams_.Set("alt", alt)
  5535. c.urlParams_.Set("prettyPrint", "false")
  5536. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5537. urls += "?" + c.urlParams_.Encode()
  5538. req, err := http.NewRequest("DELETE", urls, body)
  5539. if err != nil {
  5540. return nil, err
  5541. }
  5542. req.Header = reqHeaders
  5543. googleapi.Expand(req.URL, map[string]string{
  5544. "name": c.name,
  5545. })
  5546. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5547. }
  5548. // Do executes the "monitoring.projects.metricDescriptors.delete" call.
  5549. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5550. // code is an error. Response headers are in either
  5551. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5552. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5553. // check whether the returned error was because http.StatusNotModified
  5554. // was returned.
  5555. func (c *ProjectsMetricDescriptorsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5556. gensupport.SetOptions(c.urlParams_, opts...)
  5557. res, err := c.doRequest("json")
  5558. if res != nil && res.StatusCode == http.StatusNotModified {
  5559. if res.Body != nil {
  5560. res.Body.Close()
  5561. }
  5562. return nil, &googleapi.Error{
  5563. Code: res.StatusCode,
  5564. Header: res.Header,
  5565. }
  5566. }
  5567. if err != nil {
  5568. return nil, err
  5569. }
  5570. defer googleapi.CloseBody(res)
  5571. if err := googleapi.CheckResponse(res); err != nil {
  5572. return nil, err
  5573. }
  5574. ret := &Empty{
  5575. ServerResponse: googleapi.ServerResponse{
  5576. Header: res.Header,
  5577. HTTPStatusCode: res.StatusCode,
  5578. },
  5579. }
  5580. target := &ret
  5581. if err := gensupport.DecodeResponse(target, res); err != nil {
  5582. return nil, err
  5583. }
  5584. return ret, nil
  5585. // {
  5586. // "description": "Deletes a metric descriptor. Only user-created custom metrics can be deleted.",
  5587. // "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}",
  5588. // "httpMethod": "DELETE",
  5589. // "id": "monitoring.projects.metricDescriptors.delete",
  5590. // "parameterOrder": [
  5591. // "name"
  5592. // ],
  5593. // "parameters": {
  5594. // "name": {
  5595. // "description": "The metric descriptor on which to execute the request. The format is \"projects/{project_id_or_number}/metricDescriptors/{metric_id}\". An example of {metric_id} is: \"custom.googleapis.com/my_test_metric\".",
  5596. // "location": "path",
  5597. // "pattern": "^projects/[^/]+/metricDescriptors/.+$",
  5598. // "required": true,
  5599. // "type": "string"
  5600. // }
  5601. // },
  5602. // "path": "v3/{+name}",
  5603. // "response": {
  5604. // "$ref": "Empty"
  5605. // },
  5606. // "scopes": [
  5607. // "https://www.googleapis.com/auth/cloud-platform",
  5608. // "https://www.googleapis.com/auth/monitoring"
  5609. // ]
  5610. // }
  5611. }
  5612. // method id "monitoring.projects.metricDescriptors.get":
  5613. type ProjectsMetricDescriptorsGetCall struct {
  5614. s *Service
  5615. name string
  5616. urlParams_ gensupport.URLParams
  5617. ifNoneMatch_ string
  5618. ctx_ context.Context
  5619. header_ http.Header
  5620. }
  5621. // Get: Gets a single metric descriptor. This method does not require a
  5622. // Stackdriver account.
  5623. func (r *ProjectsMetricDescriptorsService) Get(name string) *ProjectsMetricDescriptorsGetCall {
  5624. c := &ProjectsMetricDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5625. c.name = name
  5626. return c
  5627. }
  5628. // Fields allows partial responses to be retrieved. See
  5629. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5630. // for more information.
  5631. func (c *ProjectsMetricDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsGetCall {
  5632. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5633. return c
  5634. }
  5635. // IfNoneMatch sets the optional parameter which makes the operation
  5636. // fail if the object's ETag matches the given value. This is useful for
  5637. // getting updates only after the object has changed since the last
  5638. // request. Use googleapi.IsNotModified to check whether the response
  5639. // error from Do is the result of In-None-Match.
  5640. func (c *ProjectsMetricDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricDescriptorsGetCall {
  5641. c.ifNoneMatch_ = entityTag
  5642. return c
  5643. }
  5644. // Context sets the context to be used in this call's Do method. Any
  5645. // pending HTTP request will be aborted if the provided context is
  5646. // canceled.
  5647. func (c *ProjectsMetricDescriptorsGetCall) Context(ctx context.Context) *ProjectsMetricDescriptorsGetCall {
  5648. c.ctx_ = ctx
  5649. return c
  5650. }
  5651. // Header returns an http.Header that can be modified by the caller to
  5652. // add HTTP headers to the request.
  5653. func (c *ProjectsMetricDescriptorsGetCall) Header() http.Header {
  5654. if c.header_ == nil {
  5655. c.header_ = make(http.Header)
  5656. }
  5657. return c.header_
  5658. }
  5659. func (c *ProjectsMetricDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  5660. reqHeaders := make(http.Header)
  5661. for k, v := range c.header_ {
  5662. reqHeaders[k] = v
  5663. }
  5664. reqHeaders.Set("User-Agent", c.s.userAgent())
  5665. if c.ifNoneMatch_ != "" {
  5666. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5667. }
  5668. var body io.Reader = nil
  5669. c.urlParams_.Set("alt", alt)
  5670. c.urlParams_.Set("prettyPrint", "false")
  5671. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5672. urls += "?" + c.urlParams_.Encode()
  5673. req, err := http.NewRequest("GET", urls, body)
  5674. if err != nil {
  5675. return nil, err
  5676. }
  5677. req.Header = reqHeaders
  5678. googleapi.Expand(req.URL, map[string]string{
  5679. "name": c.name,
  5680. })
  5681. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5682. }
  5683. // Do executes the "monitoring.projects.metricDescriptors.get" call.
  5684. // Exactly one of *MetricDescriptor or error will be non-nil. Any
  5685. // non-2xx status code is an error. Response headers are in either
  5686. // *MetricDescriptor.ServerResponse.Header or (if a response was
  5687. // returned at all) in error.(*googleapi.Error).Header. Use
  5688. // googleapi.IsNotModified to check whether the returned error was
  5689. // because http.StatusNotModified was returned.
  5690. func (c *ProjectsMetricDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*MetricDescriptor, error) {
  5691. gensupport.SetOptions(c.urlParams_, opts...)
  5692. res, err := c.doRequest("json")
  5693. if res != nil && res.StatusCode == http.StatusNotModified {
  5694. if res.Body != nil {
  5695. res.Body.Close()
  5696. }
  5697. return nil, &googleapi.Error{
  5698. Code: res.StatusCode,
  5699. Header: res.Header,
  5700. }
  5701. }
  5702. if err != nil {
  5703. return nil, err
  5704. }
  5705. defer googleapi.CloseBody(res)
  5706. if err := googleapi.CheckResponse(res); err != nil {
  5707. return nil, err
  5708. }
  5709. ret := &MetricDescriptor{
  5710. ServerResponse: googleapi.ServerResponse{
  5711. Header: res.Header,
  5712. HTTPStatusCode: res.StatusCode,
  5713. },
  5714. }
  5715. target := &ret
  5716. if err := gensupport.DecodeResponse(target, res); err != nil {
  5717. return nil, err
  5718. }
  5719. return ret, nil
  5720. // {
  5721. // "description": "Gets a single metric descriptor. This method does not require a Stackdriver account.",
  5722. // "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}",
  5723. // "httpMethod": "GET",
  5724. // "id": "monitoring.projects.metricDescriptors.get",
  5725. // "parameterOrder": [
  5726. // "name"
  5727. // ],
  5728. // "parameters": {
  5729. // "name": {
  5730. // "description": "The metric descriptor on which to execute the request. The format is \"projects/{project_id_or_number}/metricDescriptors/{metric_id}\". An example value of {metric_id} is \"compute.googleapis.com/instance/disk/read_bytes_count\".",
  5731. // "location": "path",
  5732. // "pattern": "^projects/[^/]+/metricDescriptors/.+$",
  5733. // "required": true,
  5734. // "type": "string"
  5735. // }
  5736. // },
  5737. // "path": "v3/{+name}",
  5738. // "response": {
  5739. // "$ref": "MetricDescriptor"
  5740. // },
  5741. // "scopes": [
  5742. // "https://www.googleapis.com/auth/cloud-platform",
  5743. // "https://www.googleapis.com/auth/monitoring",
  5744. // "https://www.googleapis.com/auth/monitoring.read",
  5745. // "https://www.googleapis.com/auth/monitoring.write"
  5746. // ]
  5747. // }
  5748. }
  5749. // method id "monitoring.projects.metricDescriptors.list":
  5750. type ProjectsMetricDescriptorsListCall struct {
  5751. s *Service
  5752. name string
  5753. urlParams_ gensupport.URLParams
  5754. ifNoneMatch_ string
  5755. ctx_ context.Context
  5756. header_ http.Header
  5757. }
  5758. // List: Lists metric descriptors that match a filter. This method does
  5759. // not require a Stackdriver account.
  5760. func (r *ProjectsMetricDescriptorsService) List(name string) *ProjectsMetricDescriptorsListCall {
  5761. c := &ProjectsMetricDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5762. c.name = name
  5763. return c
  5764. }
  5765. // Filter sets the optional parameter "filter": If this field is empty,
  5766. // all custom and system-defined metric descriptors are returned.
  5767. // Otherwise, the filter specifies which metric descriptors are to be
  5768. // returned. For example, the following filter matches all custom
  5769. // metrics:
  5770. // metric.type = starts_with("custom.googleapis.com/")
  5771. func (c *ProjectsMetricDescriptorsListCall) Filter(filter string) *ProjectsMetricDescriptorsListCall {
  5772. c.urlParams_.Set("filter", filter)
  5773. return c
  5774. }
  5775. // PageSize sets the optional parameter "pageSize": A positive number
  5776. // that is the maximum number of results to return.
  5777. func (c *ProjectsMetricDescriptorsListCall) PageSize(pageSize int64) *ProjectsMetricDescriptorsListCall {
  5778. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5779. return c
  5780. }
  5781. // PageToken sets the optional parameter "pageToken": If this field is
  5782. // not empty then it must contain the nextPageToken value returned by a
  5783. // previous call to this method. Using this field causes the method to
  5784. // return additional results from the previous method call.
  5785. func (c *ProjectsMetricDescriptorsListCall) PageToken(pageToken string) *ProjectsMetricDescriptorsListCall {
  5786. c.urlParams_.Set("pageToken", pageToken)
  5787. return c
  5788. }
  5789. // Fields allows partial responses to be retrieved. See
  5790. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5791. // for more information.
  5792. func (c *ProjectsMetricDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsListCall {
  5793. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5794. return c
  5795. }
  5796. // IfNoneMatch sets the optional parameter which makes the operation
  5797. // fail if the object's ETag matches the given value. This is useful for
  5798. // getting updates only after the object has changed since the last
  5799. // request. Use googleapi.IsNotModified to check whether the response
  5800. // error from Do is the result of In-None-Match.
  5801. func (c *ProjectsMetricDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsMetricDescriptorsListCall {
  5802. c.ifNoneMatch_ = entityTag
  5803. return c
  5804. }
  5805. // Context sets the context to be used in this call's Do method. Any
  5806. // pending HTTP request will be aborted if the provided context is
  5807. // canceled.
  5808. func (c *ProjectsMetricDescriptorsListCall) Context(ctx context.Context) *ProjectsMetricDescriptorsListCall {
  5809. c.ctx_ = ctx
  5810. return c
  5811. }
  5812. // Header returns an http.Header that can be modified by the caller to
  5813. // add HTTP headers to the request.
  5814. func (c *ProjectsMetricDescriptorsListCall) Header() http.Header {
  5815. if c.header_ == nil {
  5816. c.header_ = make(http.Header)
  5817. }
  5818. return c.header_
  5819. }
  5820. func (c *ProjectsMetricDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  5821. reqHeaders := make(http.Header)
  5822. for k, v := range c.header_ {
  5823. reqHeaders[k] = v
  5824. }
  5825. reqHeaders.Set("User-Agent", c.s.userAgent())
  5826. if c.ifNoneMatch_ != "" {
  5827. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5828. }
  5829. var body io.Reader = nil
  5830. c.urlParams_.Set("alt", alt)
  5831. c.urlParams_.Set("prettyPrint", "false")
  5832. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/metricDescriptors")
  5833. urls += "?" + c.urlParams_.Encode()
  5834. req, err := http.NewRequest("GET", urls, body)
  5835. if err != nil {
  5836. return nil, err
  5837. }
  5838. req.Header = reqHeaders
  5839. googleapi.Expand(req.URL, map[string]string{
  5840. "name": c.name,
  5841. })
  5842. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5843. }
  5844. // Do executes the "monitoring.projects.metricDescriptors.list" call.
  5845. // Exactly one of *ListMetricDescriptorsResponse or error will be
  5846. // non-nil. Any non-2xx status code is an error. Response headers are in
  5847. // either *ListMetricDescriptorsResponse.ServerResponse.Header or (if a
  5848. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5849. // googleapi.IsNotModified to check whether the returned error was
  5850. // because http.StatusNotModified was returned.
  5851. func (c *ProjectsMetricDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMetricDescriptorsResponse, error) {
  5852. gensupport.SetOptions(c.urlParams_, opts...)
  5853. res, err := c.doRequest("json")
  5854. if res != nil && res.StatusCode == http.StatusNotModified {
  5855. if res.Body != nil {
  5856. res.Body.Close()
  5857. }
  5858. return nil, &googleapi.Error{
  5859. Code: res.StatusCode,
  5860. Header: res.Header,
  5861. }
  5862. }
  5863. if err != nil {
  5864. return nil, err
  5865. }
  5866. defer googleapi.CloseBody(res)
  5867. if err := googleapi.CheckResponse(res); err != nil {
  5868. return nil, err
  5869. }
  5870. ret := &ListMetricDescriptorsResponse{
  5871. ServerResponse: googleapi.ServerResponse{
  5872. Header: res.Header,
  5873. HTTPStatusCode: res.StatusCode,
  5874. },
  5875. }
  5876. target := &ret
  5877. if err := gensupport.DecodeResponse(target, res); err != nil {
  5878. return nil, err
  5879. }
  5880. return ret, nil
  5881. // {
  5882. // "description": "Lists metric descriptors that match a filter. This method does not require a Stackdriver account.",
  5883. // "flatPath": "v3/projects/{projectsId}/metricDescriptors",
  5884. // "httpMethod": "GET",
  5885. // "id": "monitoring.projects.metricDescriptors.list",
  5886. // "parameterOrder": [
  5887. // "name"
  5888. // ],
  5889. // "parameters": {
  5890. // "filter": {
  5891. // "description": "If this field is empty, all custom and system-defined metric descriptors are returned. Otherwise, the filter specifies which metric descriptors are to be returned. For example, the following filter matches all custom metrics:\nmetric.type = starts_with(\"custom.googleapis.com/\")\n",
  5892. // "location": "query",
  5893. // "type": "string"
  5894. // },
  5895. // "name": {
  5896. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  5897. // "location": "path",
  5898. // "pattern": "^projects/[^/]+$",
  5899. // "required": true,
  5900. // "type": "string"
  5901. // },
  5902. // "pageSize": {
  5903. // "description": "A positive number that is the maximum number of results to return.",
  5904. // "format": "int32",
  5905. // "location": "query",
  5906. // "type": "integer"
  5907. // },
  5908. // "pageToken": {
  5909. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.",
  5910. // "location": "query",
  5911. // "type": "string"
  5912. // }
  5913. // },
  5914. // "path": "v3/{+name}/metricDescriptors",
  5915. // "response": {
  5916. // "$ref": "ListMetricDescriptorsResponse"
  5917. // },
  5918. // "scopes": [
  5919. // "https://www.googleapis.com/auth/cloud-platform",
  5920. // "https://www.googleapis.com/auth/monitoring",
  5921. // "https://www.googleapis.com/auth/monitoring.read",
  5922. // "https://www.googleapis.com/auth/monitoring.write"
  5923. // ]
  5924. // }
  5925. }
  5926. // Pages invokes f for each page of results.
  5927. // A non-nil error returned from f will halt the iteration.
  5928. // The provided context supersedes any context provided to the Context method.
  5929. func (c *ProjectsMetricDescriptorsListCall) Pages(ctx context.Context, f func(*ListMetricDescriptorsResponse) error) error {
  5930. c.ctx_ = ctx
  5931. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5932. for {
  5933. x, err := c.Do()
  5934. if err != nil {
  5935. return err
  5936. }
  5937. if err := f(x); err != nil {
  5938. return err
  5939. }
  5940. if x.NextPageToken == "" {
  5941. return nil
  5942. }
  5943. c.PageToken(x.NextPageToken)
  5944. }
  5945. }
  5946. // method id "monitoring.projects.monitoredResourceDescriptors.get":
  5947. type ProjectsMonitoredResourceDescriptorsGetCall struct {
  5948. s *Service
  5949. name string
  5950. urlParams_ gensupport.URLParams
  5951. ifNoneMatch_ string
  5952. ctx_ context.Context
  5953. header_ http.Header
  5954. }
  5955. // Get: Gets a single monitored resource descriptor. This method does
  5956. // not require a Stackdriver account.
  5957. func (r *ProjectsMonitoredResourceDescriptorsService) Get(name string) *ProjectsMonitoredResourceDescriptorsGetCall {
  5958. c := &ProjectsMonitoredResourceDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5959. c.name = name
  5960. return c
  5961. }
  5962. // Fields allows partial responses to be retrieved. See
  5963. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5964. // for more information.
  5965. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsMonitoredResourceDescriptorsGetCall {
  5966. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5967. return c
  5968. }
  5969. // IfNoneMatch sets the optional parameter which makes the operation
  5970. // fail if the object's ETag matches the given value. This is useful for
  5971. // getting updates only after the object has changed since the last
  5972. // request. Use googleapi.IsNotModified to check whether the response
  5973. // error from Do is the result of In-None-Match.
  5974. func (c *ProjectsMonitoredResourceDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsMonitoredResourceDescriptorsGetCall {
  5975. c.ifNoneMatch_ = entityTag
  5976. return c
  5977. }
  5978. // Context sets the context to be used in this call's Do method. Any
  5979. // pending HTTP request will be aborted if the provided context is
  5980. // canceled.
  5981. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Context(ctx context.Context) *ProjectsMonitoredResourceDescriptorsGetCall {
  5982. c.ctx_ = ctx
  5983. return c
  5984. }
  5985. // Header returns an http.Header that can be modified by the caller to
  5986. // add HTTP headers to the request.
  5987. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Header() http.Header {
  5988. if c.header_ == nil {
  5989. c.header_ = make(http.Header)
  5990. }
  5991. return c.header_
  5992. }
  5993. func (c *ProjectsMonitoredResourceDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  5994. reqHeaders := make(http.Header)
  5995. for k, v := range c.header_ {
  5996. reqHeaders[k] = v
  5997. }
  5998. reqHeaders.Set("User-Agent", c.s.userAgent())
  5999. if c.ifNoneMatch_ != "" {
  6000. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6001. }
  6002. var body io.Reader = nil
  6003. c.urlParams_.Set("alt", alt)
  6004. c.urlParams_.Set("prettyPrint", "false")
  6005. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6006. urls += "?" + c.urlParams_.Encode()
  6007. req, err := http.NewRequest("GET", urls, body)
  6008. if err != nil {
  6009. return nil, err
  6010. }
  6011. req.Header = reqHeaders
  6012. googleapi.Expand(req.URL, map[string]string{
  6013. "name": c.name,
  6014. })
  6015. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6016. }
  6017. // Do executes the "monitoring.projects.monitoredResourceDescriptors.get" call.
  6018. // Exactly one of *MonitoredResourceDescriptor or error will be non-nil.
  6019. // Any non-2xx status code is an error. Response headers are in either
  6020. // *MonitoredResourceDescriptor.ServerResponse.Header or (if a response
  6021. // was returned at all) in error.(*googleapi.Error).Header. Use
  6022. // googleapi.IsNotModified to check whether the returned error was
  6023. // because http.StatusNotModified was returned.
  6024. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*MonitoredResourceDescriptor, error) {
  6025. gensupport.SetOptions(c.urlParams_, opts...)
  6026. res, err := c.doRequest("json")
  6027. if res != nil && res.StatusCode == http.StatusNotModified {
  6028. if res.Body != nil {
  6029. res.Body.Close()
  6030. }
  6031. return nil, &googleapi.Error{
  6032. Code: res.StatusCode,
  6033. Header: res.Header,
  6034. }
  6035. }
  6036. if err != nil {
  6037. return nil, err
  6038. }
  6039. defer googleapi.CloseBody(res)
  6040. if err := googleapi.CheckResponse(res); err != nil {
  6041. return nil, err
  6042. }
  6043. ret := &MonitoredResourceDescriptor{
  6044. ServerResponse: googleapi.ServerResponse{
  6045. Header: res.Header,
  6046. HTTPStatusCode: res.StatusCode,
  6047. },
  6048. }
  6049. target := &ret
  6050. if err := gensupport.DecodeResponse(target, res); err != nil {
  6051. return nil, err
  6052. }
  6053. return ret, nil
  6054. // {
  6055. // "description": "Gets a single monitored resource descriptor. This method does not require a Stackdriver account.",
  6056. // "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors/{monitoredResourceDescriptorsId}",
  6057. // "httpMethod": "GET",
  6058. // "id": "monitoring.projects.monitoredResourceDescriptors.get",
  6059. // "parameterOrder": [
  6060. // "name"
  6061. // ],
  6062. // "parameters": {
  6063. // "name": {
  6064. // "description": "The monitored resource descriptor to get. The format is \"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}\". The {resource_type} is a predefined type, such as cloudsql_database.",
  6065. // "location": "path",
  6066. // "pattern": "^projects/[^/]+/monitoredResourceDescriptors/[^/]+$",
  6067. // "required": true,
  6068. // "type": "string"
  6069. // }
  6070. // },
  6071. // "path": "v3/{+name}",
  6072. // "response": {
  6073. // "$ref": "MonitoredResourceDescriptor"
  6074. // },
  6075. // "scopes": [
  6076. // "https://www.googleapis.com/auth/cloud-platform",
  6077. // "https://www.googleapis.com/auth/monitoring",
  6078. // "https://www.googleapis.com/auth/monitoring.read",
  6079. // "https://www.googleapis.com/auth/monitoring.write"
  6080. // ]
  6081. // }
  6082. }
  6083. // method id "monitoring.projects.monitoredResourceDescriptors.list":
  6084. type ProjectsMonitoredResourceDescriptorsListCall struct {
  6085. s *Service
  6086. name string
  6087. urlParams_ gensupport.URLParams
  6088. ifNoneMatch_ string
  6089. ctx_ context.Context
  6090. header_ http.Header
  6091. }
  6092. // List: Lists monitored resource descriptors that match a filter. This
  6093. // method does not require a Stackdriver account.
  6094. func (r *ProjectsMonitoredResourceDescriptorsService) List(name string) *ProjectsMonitoredResourceDescriptorsListCall {
  6095. c := &ProjectsMonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6096. c.name = name
  6097. return c
  6098. }
  6099. // Filter sets the optional parameter "filter": An optional filter
  6100. // describing the descriptors to be returned. The filter can reference
  6101. // the descriptor's type and labels. For example, the following filter
  6102. // returns only Google Compute Engine descriptors that have an id
  6103. // label:
  6104. // resource.type = starts_with("gce_") AND resource.label:id
  6105. func (c *ProjectsMonitoredResourceDescriptorsListCall) Filter(filter string) *ProjectsMonitoredResourceDescriptorsListCall {
  6106. c.urlParams_.Set("filter", filter)
  6107. return c
  6108. }
  6109. // PageSize sets the optional parameter "pageSize": A positive number
  6110. // that is the maximum number of results to return.
  6111. func (c *ProjectsMonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *ProjectsMonitoredResourceDescriptorsListCall {
  6112. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6113. return c
  6114. }
  6115. // PageToken sets the optional parameter "pageToken": If this field is
  6116. // not empty then it must contain the nextPageToken value returned by a
  6117. // previous call to this method. Using this field causes the method to
  6118. // return additional results from the previous method call.
  6119. func (c *ProjectsMonitoredResourceDescriptorsListCall) PageToken(pageToken string) *ProjectsMonitoredResourceDescriptorsListCall {
  6120. c.urlParams_.Set("pageToken", pageToken)
  6121. return c
  6122. }
  6123. // Fields allows partial responses to be retrieved. See
  6124. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6125. // for more information.
  6126. func (c *ProjectsMonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsMonitoredResourceDescriptorsListCall {
  6127. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6128. return c
  6129. }
  6130. // IfNoneMatch sets the optional parameter which makes the operation
  6131. // fail if the object's ETag matches the given value. This is useful for
  6132. // getting updates only after the object has changed since the last
  6133. // request. Use googleapi.IsNotModified to check whether the response
  6134. // error from Do is the result of In-None-Match.
  6135. func (c *ProjectsMonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsMonitoredResourceDescriptorsListCall {
  6136. c.ifNoneMatch_ = entityTag
  6137. return c
  6138. }
  6139. // Context sets the context to be used in this call's Do method. Any
  6140. // pending HTTP request will be aborted if the provided context is
  6141. // canceled.
  6142. func (c *ProjectsMonitoredResourceDescriptorsListCall) Context(ctx context.Context) *ProjectsMonitoredResourceDescriptorsListCall {
  6143. c.ctx_ = ctx
  6144. return c
  6145. }
  6146. // Header returns an http.Header that can be modified by the caller to
  6147. // add HTTP headers to the request.
  6148. func (c *ProjectsMonitoredResourceDescriptorsListCall) Header() http.Header {
  6149. if c.header_ == nil {
  6150. c.header_ = make(http.Header)
  6151. }
  6152. return c.header_
  6153. }
  6154. func (c *ProjectsMonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  6155. reqHeaders := make(http.Header)
  6156. for k, v := range c.header_ {
  6157. reqHeaders[k] = v
  6158. }
  6159. reqHeaders.Set("User-Agent", c.s.userAgent())
  6160. if c.ifNoneMatch_ != "" {
  6161. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6162. }
  6163. var body io.Reader = nil
  6164. c.urlParams_.Set("alt", alt)
  6165. c.urlParams_.Set("prettyPrint", "false")
  6166. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/monitoredResourceDescriptors")
  6167. urls += "?" + c.urlParams_.Encode()
  6168. req, err := http.NewRequest("GET", urls, body)
  6169. if err != nil {
  6170. return nil, err
  6171. }
  6172. req.Header = reqHeaders
  6173. googleapi.Expand(req.URL, map[string]string{
  6174. "name": c.name,
  6175. })
  6176. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6177. }
  6178. // Do executes the "monitoring.projects.monitoredResourceDescriptors.list" call.
  6179. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  6180. // will be non-nil. Any non-2xx status code is an error. Response
  6181. // headers are in either
  6182. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  6183. // (if a response was returned at all) in
  6184. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6185. // whether the returned error was because http.StatusNotModified was
  6186. // returned.
  6187. func (c *ProjectsMonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  6188. gensupport.SetOptions(c.urlParams_, opts...)
  6189. res, err := c.doRequest("json")
  6190. if res != nil && res.StatusCode == http.StatusNotModified {
  6191. if res.Body != nil {
  6192. res.Body.Close()
  6193. }
  6194. return nil, &googleapi.Error{
  6195. Code: res.StatusCode,
  6196. Header: res.Header,
  6197. }
  6198. }
  6199. if err != nil {
  6200. return nil, err
  6201. }
  6202. defer googleapi.CloseBody(res)
  6203. if err := googleapi.CheckResponse(res); err != nil {
  6204. return nil, err
  6205. }
  6206. ret := &ListMonitoredResourceDescriptorsResponse{
  6207. ServerResponse: googleapi.ServerResponse{
  6208. Header: res.Header,
  6209. HTTPStatusCode: res.StatusCode,
  6210. },
  6211. }
  6212. target := &ret
  6213. if err := gensupport.DecodeResponse(target, res); err != nil {
  6214. return nil, err
  6215. }
  6216. return ret, nil
  6217. // {
  6218. // "description": "Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.",
  6219. // "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors",
  6220. // "httpMethod": "GET",
  6221. // "id": "monitoring.projects.monitoredResourceDescriptors.list",
  6222. // "parameterOrder": [
  6223. // "name"
  6224. // ],
  6225. // "parameters": {
  6226. // "filter": {
  6227. // "description": "An optional filter describing the descriptors to be returned. The filter can reference the descriptor's type and labels. For example, the following filter returns only Google Compute Engine descriptors that have an id label:\nresource.type = starts_with(\"gce_\") AND resource.label:id\n",
  6228. // "location": "query",
  6229. // "type": "string"
  6230. // },
  6231. // "name": {
  6232. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  6233. // "location": "path",
  6234. // "pattern": "^projects/[^/]+$",
  6235. // "required": true,
  6236. // "type": "string"
  6237. // },
  6238. // "pageSize": {
  6239. // "description": "A positive number that is the maximum number of results to return.",
  6240. // "format": "int32",
  6241. // "location": "query",
  6242. // "type": "integer"
  6243. // },
  6244. // "pageToken": {
  6245. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.",
  6246. // "location": "query",
  6247. // "type": "string"
  6248. // }
  6249. // },
  6250. // "path": "v3/{+name}/monitoredResourceDescriptors",
  6251. // "response": {
  6252. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  6253. // },
  6254. // "scopes": [
  6255. // "https://www.googleapis.com/auth/cloud-platform",
  6256. // "https://www.googleapis.com/auth/monitoring",
  6257. // "https://www.googleapis.com/auth/monitoring.read",
  6258. // "https://www.googleapis.com/auth/monitoring.write"
  6259. // ]
  6260. // }
  6261. }
  6262. // Pages invokes f for each page of results.
  6263. // A non-nil error returned from f will halt the iteration.
  6264. // The provided context supersedes any context provided to the Context method.
  6265. func (c *ProjectsMonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  6266. c.ctx_ = ctx
  6267. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6268. for {
  6269. x, err := c.Do()
  6270. if err != nil {
  6271. return err
  6272. }
  6273. if err := f(x); err != nil {
  6274. return err
  6275. }
  6276. if x.NextPageToken == "" {
  6277. return nil
  6278. }
  6279. c.PageToken(x.NextPageToken)
  6280. }
  6281. }
  6282. // method id "monitoring.projects.notificationChannelDescriptors.get":
  6283. type ProjectsNotificationChannelDescriptorsGetCall struct {
  6284. s *Service
  6285. name string
  6286. urlParams_ gensupport.URLParams
  6287. ifNoneMatch_ string
  6288. ctx_ context.Context
  6289. header_ http.Header
  6290. }
  6291. // Get: Gets a single channel descriptor. The descriptor indicates which
  6292. // fields are expected / permitted for a notification channel of the
  6293. // given type.
  6294. func (r *ProjectsNotificationChannelDescriptorsService) Get(name string) *ProjectsNotificationChannelDescriptorsGetCall {
  6295. c := &ProjectsNotificationChannelDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6296. c.name = name
  6297. return c
  6298. }
  6299. // Fields allows partial responses to be retrieved. See
  6300. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6301. // for more information.
  6302. func (c *ProjectsNotificationChannelDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelDescriptorsGetCall {
  6303. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6304. return c
  6305. }
  6306. // IfNoneMatch sets the optional parameter which makes the operation
  6307. // fail if the object's ETag matches the given value. This is useful for
  6308. // getting updates only after the object has changed since the last
  6309. // request. Use googleapi.IsNotModified to check whether the response
  6310. // error from Do is the result of In-None-Match.
  6311. func (c *ProjectsNotificationChannelDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelDescriptorsGetCall {
  6312. c.ifNoneMatch_ = entityTag
  6313. return c
  6314. }
  6315. // Context sets the context to be used in this call's Do method. Any
  6316. // pending HTTP request will be aborted if the provided context is
  6317. // canceled.
  6318. func (c *ProjectsNotificationChannelDescriptorsGetCall) Context(ctx context.Context) *ProjectsNotificationChannelDescriptorsGetCall {
  6319. c.ctx_ = ctx
  6320. return c
  6321. }
  6322. // Header returns an http.Header that can be modified by the caller to
  6323. // add HTTP headers to the request.
  6324. func (c *ProjectsNotificationChannelDescriptorsGetCall) Header() http.Header {
  6325. if c.header_ == nil {
  6326. c.header_ = make(http.Header)
  6327. }
  6328. return c.header_
  6329. }
  6330. func (c *ProjectsNotificationChannelDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  6331. reqHeaders := make(http.Header)
  6332. for k, v := range c.header_ {
  6333. reqHeaders[k] = v
  6334. }
  6335. reqHeaders.Set("User-Agent", c.s.userAgent())
  6336. if c.ifNoneMatch_ != "" {
  6337. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6338. }
  6339. var body io.Reader = nil
  6340. c.urlParams_.Set("alt", alt)
  6341. c.urlParams_.Set("prettyPrint", "false")
  6342. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6343. urls += "?" + c.urlParams_.Encode()
  6344. req, err := http.NewRequest("GET", urls, body)
  6345. if err != nil {
  6346. return nil, err
  6347. }
  6348. req.Header = reqHeaders
  6349. googleapi.Expand(req.URL, map[string]string{
  6350. "name": c.name,
  6351. })
  6352. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6353. }
  6354. // Do executes the "monitoring.projects.notificationChannelDescriptors.get" call.
  6355. // Exactly one of *NotificationChannelDescriptor or error will be
  6356. // non-nil. Any non-2xx status code is an error. Response headers are in
  6357. // either *NotificationChannelDescriptor.ServerResponse.Header or (if a
  6358. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6359. // googleapi.IsNotModified to check whether the returned error was
  6360. // because http.StatusNotModified was returned.
  6361. func (c *ProjectsNotificationChannelDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*NotificationChannelDescriptor, error) {
  6362. gensupport.SetOptions(c.urlParams_, opts...)
  6363. res, err := c.doRequest("json")
  6364. if res != nil && res.StatusCode == http.StatusNotModified {
  6365. if res.Body != nil {
  6366. res.Body.Close()
  6367. }
  6368. return nil, &googleapi.Error{
  6369. Code: res.StatusCode,
  6370. Header: res.Header,
  6371. }
  6372. }
  6373. if err != nil {
  6374. return nil, err
  6375. }
  6376. defer googleapi.CloseBody(res)
  6377. if err := googleapi.CheckResponse(res); err != nil {
  6378. return nil, err
  6379. }
  6380. ret := &NotificationChannelDescriptor{
  6381. ServerResponse: googleapi.ServerResponse{
  6382. Header: res.Header,
  6383. HTTPStatusCode: res.StatusCode,
  6384. },
  6385. }
  6386. target := &ret
  6387. if err := gensupport.DecodeResponse(target, res); err != nil {
  6388. return nil, err
  6389. }
  6390. return ret, nil
  6391. // {
  6392. // "description": "Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.",
  6393. // "flatPath": "v3/projects/{projectsId}/notificationChannelDescriptors/{notificationChannelDescriptorsId}",
  6394. // "httpMethod": "GET",
  6395. // "id": "monitoring.projects.notificationChannelDescriptors.get",
  6396. // "parameterOrder": [
  6397. // "name"
  6398. // ],
  6399. // "parameters": {
  6400. // "name": {
  6401. // "description": "The channel type for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}.",
  6402. // "location": "path",
  6403. // "pattern": "^projects/[^/]+/notificationChannelDescriptors/[^/]+$",
  6404. // "required": true,
  6405. // "type": "string"
  6406. // }
  6407. // },
  6408. // "path": "v3/{+name}",
  6409. // "response": {
  6410. // "$ref": "NotificationChannelDescriptor"
  6411. // },
  6412. // "scopes": [
  6413. // "https://www.googleapis.com/auth/cloud-platform",
  6414. // "https://www.googleapis.com/auth/monitoring",
  6415. // "https://www.googleapis.com/auth/monitoring.read"
  6416. // ]
  6417. // }
  6418. }
  6419. // method id "monitoring.projects.notificationChannelDescriptors.list":
  6420. type ProjectsNotificationChannelDescriptorsListCall struct {
  6421. s *Service
  6422. name string
  6423. urlParams_ gensupport.URLParams
  6424. ifNoneMatch_ string
  6425. ctx_ context.Context
  6426. header_ http.Header
  6427. }
  6428. // List: Lists the descriptors for supported channel types. The use of
  6429. // descriptors makes it possible for new channel types to be dynamically
  6430. // added.
  6431. func (r *ProjectsNotificationChannelDescriptorsService) List(name string) *ProjectsNotificationChannelDescriptorsListCall {
  6432. c := &ProjectsNotificationChannelDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6433. c.name = name
  6434. return c
  6435. }
  6436. // PageSize sets the optional parameter "pageSize": The maximum number
  6437. // of results to return in a single response. If not set to a positive
  6438. // number, a reasonable value will be chosen by the service.
  6439. func (c *ProjectsNotificationChannelDescriptorsListCall) PageSize(pageSize int64) *ProjectsNotificationChannelDescriptorsListCall {
  6440. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6441. return c
  6442. }
  6443. // PageToken sets the optional parameter "pageToken": If non-empty,
  6444. // page_token must contain a value returned as the next_page_token in a
  6445. // previous response to request the next set of results.
  6446. func (c *ProjectsNotificationChannelDescriptorsListCall) PageToken(pageToken string) *ProjectsNotificationChannelDescriptorsListCall {
  6447. c.urlParams_.Set("pageToken", pageToken)
  6448. return c
  6449. }
  6450. // Fields allows partial responses to be retrieved. See
  6451. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6452. // for more information.
  6453. func (c *ProjectsNotificationChannelDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelDescriptorsListCall {
  6454. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6455. return c
  6456. }
  6457. // IfNoneMatch sets the optional parameter which makes the operation
  6458. // fail if the object's ETag matches the given value. This is useful for
  6459. // getting updates only after the object has changed since the last
  6460. // request. Use googleapi.IsNotModified to check whether the response
  6461. // error from Do is the result of In-None-Match.
  6462. func (c *ProjectsNotificationChannelDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelDescriptorsListCall {
  6463. c.ifNoneMatch_ = entityTag
  6464. return c
  6465. }
  6466. // Context sets the context to be used in this call's Do method. Any
  6467. // pending HTTP request will be aborted if the provided context is
  6468. // canceled.
  6469. func (c *ProjectsNotificationChannelDescriptorsListCall) Context(ctx context.Context) *ProjectsNotificationChannelDescriptorsListCall {
  6470. c.ctx_ = ctx
  6471. return c
  6472. }
  6473. // Header returns an http.Header that can be modified by the caller to
  6474. // add HTTP headers to the request.
  6475. func (c *ProjectsNotificationChannelDescriptorsListCall) Header() http.Header {
  6476. if c.header_ == nil {
  6477. c.header_ = make(http.Header)
  6478. }
  6479. return c.header_
  6480. }
  6481. func (c *ProjectsNotificationChannelDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  6482. reqHeaders := make(http.Header)
  6483. for k, v := range c.header_ {
  6484. reqHeaders[k] = v
  6485. }
  6486. reqHeaders.Set("User-Agent", c.s.userAgent())
  6487. if c.ifNoneMatch_ != "" {
  6488. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6489. }
  6490. var body io.Reader = nil
  6491. c.urlParams_.Set("alt", alt)
  6492. c.urlParams_.Set("prettyPrint", "false")
  6493. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannelDescriptors")
  6494. urls += "?" + c.urlParams_.Encode()
  6495. req, err := http.NewRequest("GET", urls, body)
  6496. if err != nil {
  6497. return nil, err
  6498. }
  6499. req.Header = reqHeaders
  6500. googleapi.Expand(req.URL, map[string]string{
  6501. "name": c.name,
  6502. })
  6503. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6504. }
  6505. // Do executes the "monitoring.projects.notificationChannelDescriptors.list" call.
  6506. // Exactly one of *ListNotificationChannelDescriptorsResponse or error
  6507. // will be non-nil. Any non-2xx status code is an error. Response
  6508. // headers are in either
  6509. // *ListNotificationChannelDescriptorsResponse.ServerResponse.Header or
  6510. // (if a response was returned at all) in
  6511. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6512. // whether the returned error was because http.StatusNotModified was
  6513. // returned.
  6514. func (c *ProjectsNotificationChannelDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListNotificationChannelDescriptorsResponse, error) {
  6515. gensupport.SetOptions(c.urlParams_, opts...)
  6516. res, err := c.doRequest("json")
  6517. if res != nil && res.StatusCode == http.StatusNotModified {
  6518. if res.Body != nil {
  6519. res.Body.Close()
  6520. }
  6521. return nil, &googleapi.Error{
  6522. Code: res.StatusCode,
  6523. Header: res.Header,
  6524. }
  6525. }
  6526. if err != nil {
  6527. return nil, err
  6528. }
  6529. defer googleapi.CloseBody(res)
  6530. if err := googleapi.CheckResponse(res); err != nil {
  6531. return nil, err
  6532. }
  6533. ret := &ListNotificationChannelDescriptorsResponse{
  6534. ServerResponse: googleapi.ServerResponse{
  6535. Header: res.Header,
  6536. HTTPStatusCode: res.StatusCode,
  6537. },
  6538. }
  6539. target := &ret
  6540. if err := gensupport.DecodeResponse(target, res); err != nil {
  6541. return nil, err
  6542. }
  6543. return ret, nil
  6544. // {
  6545. // "description": "Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.",
  6546. // "flatPath": "v3/projects/{projectsId}/notificationChannelDescriptors",
  6547. // "httpMethod": "GET",
  6548. // "id": "monitoring.projects.notificationChannelDescriptors.list",
  6549. // "parameterOrder": [
  6550. // "name"
  6551. // ],
  6552. // "parameters": {
  6553. // "name": {
  6554. // "description": "The REST resource name of the parent from which to retrieve the notification channel descriptors. The expected syntax is:\nprojects/[PROJECT_ID]\nNote that this names the parent container in which to look for the descriptors; to retrieve a single descriptor by name, use the GetNotificationChannelDescriptor operation, instead.",
  6555. // "location": "path",
  6556. // "pattern": "^projects/[^/]+$",
  6557. // "required": true,
  6558. // "type": "string"
  6559. // },
  6560. // "pageSize": {
  6561. // "description": "The maximum number of results to return in a single response. If not set to a positive number, a reasonable value will be chosen by the service.",
  6562. // "format": "int32",
  6563. // "location": "query",
  6564. // "type": "integer"
  6565. // },
  6566. // "pageToken": {
  6567. // "description": "If non-empty, page_token must contain a value returned as the next_page_token in a previous response to request the next set of results.",
  6568. // "location": "query",
  6569. // "type": "string"
  6570. // }
  6571. // },
  6572. // "path": "v3/{+name}/notificationChannelDescriptors",
  6573. // "response": {
  6574. // "$ref": "ListNotificationChannelDescriptorsResponse"
  6575. // },
  6576. // "scopes": [
  6577. // "https://www.googleapis.com/auth/cloud-platform",
  6578. // "https://www.googleapis.com/auth/monitoring",
  6579. // "https://www.googleapis.com/auth/monitoring.read"
  6580. // ]
  6581. // }
  6582. }
  6583. // Pages invokes f for each page of results.
  6584. // A non-nil error returned from f will halt the iteration.
  6585. // The provided context supersedes any context provided to the Context method.
  6586. func (c *ProjectsNotificationChannelDescriptorsListCall) Pages(ctx context.Context, f func(*ListNotificationChannelDescriptorsResponse) error) error {
  6587. c.ctx_ = ctx
  6588. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6589. for {
  6590. x, err := c.Do()
  6591. if err != nil {
  6592. return err
  6593. }
  6594. if err := f(x); err != nil {
  6595. return err
  6596. }
  6597. if x.NextPageToken == "" {
  6598. return nil
  6599. }
  6600. c.PageToken(x.NextPageToken)
  6601. }
  6602. }
  6603. // method id "monitoring.projects.notificationChannels.create":
  6604. type ProjectsNotificationChannelsCreateCall struct {
  6605. s *Service
  6606. name string
  6607. notificationchannel *NotificationChannel
  6608. urlParams_ gensupport.URLParams
  6609. ctx_ context.Context
  6610. header_ http.Header
  6611. }
  6612. // Create: Creates a new notification channel, representing a single
  6613. // notification endpoint such as an email address, SMS number, or
  6614. // PagerDuty service.
  6615. func (r *ProjectsNotificationChannelsService) Create(name string, notificationchannel *NotificationChannel) *ProjectsNotificationChannelsCreateCall {
  6616. c := &ProjectsNotificationChannelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6617. c.name = name
  6618. c.notificationchannel = notificationchannel
  6619. return c
  6620. }
  6621. // Fields allows partial responses to be retrieved. See
  6622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6623. // for more information.
  6624. func (c *ProjectsNotificationChannelsCreateCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsCreateCall {
  6625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6626. return c
  6627. }
  6628. // Context sets the context to be used in this call's Do method. Any
  6629. // pending HTTP request will be aborted if the provided context is
  6630. // canceled.
  6631. func (c *ProjectsNotificationChannelsCreateCall) Context(ctx context.Context) *ProjectsNotificationChannelsCreateCall {
  6632. c.ctx_ = ctx
  6633. return c
  6634. }
  6635. // Header returns an http.Header that can be modified by the caller to
  6636. // add HTTP headers to the request.
  6637. func (c *ProjectsNotificationChannelsCreateCall) Header() http.Header {
  6638. if c.header_ == nil {
  6639. c.header_ = make(http.Header)
  6640. }
  6641. return c.header_
  6642. }
  6643. func (c *ProjectsNotificationChannelsCreateCall) doRequest(alt string) (*http.Response, error) {
  6644. reqHeaders := make(http.Header)
  6645. for k, v := range c.header_ {
  6646. reqHeaders[k] = v
  6647. }
  6648. reqHeaders.Set("User-Agent", c.s.userAgent())
  6649. var body io.Reader = nil
  6650. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notificationchannel)
  6651. if err != nil {
  6652. return nil, err
  6653. }
  6654. reqHeaders.Set("Content-Type", "application/json")
  6655. c.urlParams_.Set("alt", alt)
  6656. c.urlParams_.Set("prettyPrint", "false")
  6657. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannels")
  6658. urls += "?" + c.urlParams_.Encode()
  6659. req, err := http.NewRequest("POST", urls, body)
  6660. if err != nil {
  6661. return nil, err
  6662. }
  6663. req.Header = reqHeaders
  6664. googleapi.Expand(req.URL, map[string]string{
  6665. "name": c.name,
  6666. })
  6667. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6668. }
  6669. // Do executes the "monitoring.projects.notificationChannels.create" call.
  6670. // Exactly one of *NotificationChannel or error will be non-nil. Any
  6671. // non-2xx status code is an error. Response headers are in either
  6672. // *NotificationChannel.ServerResponse.Header or (if a response was
  6673. // returned at all) in error.(*googleapi.Error).Header. Use
  6674. // googleapi.IsNotModified to check whether the returned error was
  6675. // because http.StatusNotModified was returned.
  6676. func (c *ProjectsNotificationChannelsCreateCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  6677. gensupport.SetOptions(c.urlParams_, opts...)
  6678. res, err := c.doRequest("json")
  6679. if res != nil && res.StatusCode == http.StatusNotModified {
  6680. if res.Body != nil {
  6681. res.Body.Close()
  6682. }
  6683. return nil, &googleapi.Error{
  6684. Code: res.StatusCode,
  6685. Header: res.Header,
  6686. }
  6687. }
  6688. if err != nil {
  6689. return nil, err
  6690. }
  6691. defer googleapi.CloseBody(res)
  6692. if err := googleapi.CheckResponse(res); err != nil {
  6693. return nil, err
  6694. }
  6695. ret := &NotificationChannel{
  6696. ServerResponse: googleapi.ServerResponse{
  6697. Header: res.Header,
  6698. HTTPStatusCode: res.StatusCode,
  6699. },
  6700. }
  6701. target := &ret
  6702. if err := gensupport.DecodeResponse(target, res); err != nil {
  6703. return nil, err
  6704. }
  6705. return ret, nil
  6706. // {
  6707. // "description": "Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.",
  6708. // "flatPath": "v3/projects/{projectsId}/notificationChannels",
  6709. // "httpMethod": "POST",
  6710. // "id": "monitoring.projects.notificationChannels.create",
  6711. // "parameterOrder": [
  6712. // "name"
  6713. // ],
  6714. // "parameters": {
  6715. // "name": {
  6716. // "description": "The project on which to execute the request. The format is:\nprojects/[PROJECT_ID]\nNote that this names the container into which the channel will be written. This does not name the newly created channel. The resulting channel's name will have a normalized version of this field as a prefix, but will add /notificationChannels/[CHANNEL_ID] to identify the channel.",
  6717. // "location": "path",
  6718. // "pattern": "^projects/[^/]+$",
  6719. // "required": true,
  6720. // "type": "string"
  6721. // }
  6722. // },
  6723. // "path": "v3/{+name}/notificationChannels",
  6724. // "request": {
  6725. // "$ref": "NotificationChannel"
  6726. // },
  6727. // "response": {
  6728. // "$ref": "NotificationChannel"
  6729. // },
  6730. // "scopes": [
  6731. // "https://www.googleapis.com/auth/cloud-platform",
  6732. // "https://www.googleapis.com/auth/monitoring"
  6733. // ]
  6734. // }
  6735. }
  6736. // method id "monitoring.projects.notificationChannels.delete":
  6737. type ProjectsNotificationChannelsDeleteCall struct {
  6738. s *Service
  6739. name string
  6740. urlParams_ gensupport.URLParams
  6741. ctx_ context.Context
  6742. header_ http.Header
  6743. }
  6744. // Delete: Deletes a notification channel.
  6745. func (r *ProjectsNotificationChannelsService) Delete(name string) *ProjectsNotificationChannelsDeleteCall {
  6746. c := &ProjectsNotificationChannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6747. c.name = name
  6748. return c
  6749. }
  6750. // Force sets the optional parameter "force": If true, the notification
  6751. // channel will be deleted regardless of its use in alert policies (the
  6752. // policies will be updated to remove the channel). If false, channels
  6753. // that are still referenced by an existing alerting policy will fail to
  6754. // be deleted in a delete operation.
  6755. func (c *ProjectsNotificationChannelsDeleteCall) Force(force bool) *ProjectsNotificationChannelsDeleteCall {
  6756. c.urlParams_.Set("force", fmt.Sprint(force))
  6757. return c
  6758. }
  6759. // Fields allows partial responses to be retrieved. See
  6760. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6761. // for more information.
  6762. func (c *ProjectsNotificationChannelsDeleteCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsDeleteCall {
  6763. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6764. return c
  6765. }
  6766. // Context sets the context to be used in this call's Do method. Any
  6767. // pending HTTP request will be aborted if the provided context is
  6768. // canceled.
  6769. func (c *ProjectsNotificationChannelsDeleteCall) Context(ctx context.Context) *ProjectsNotificationChannelsDeleteCall {
  6770. c.ctx_ = ctx
  6771. return c
  6772. }
  6773. // Header returns an http.Header that can be modified by the caller to
  6774. // add HTTP headers to the request.
  6775. func (c *ProjectsNotificationChannelsDeleteCall) Header() http.Header {
  6776. if c.header_ == nil {
  6777. c.header_ = make(http.Header)
  6778. }
  6779. return c.header_
  6780. }
  6781. func (c *ProjectsNotificationChannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6782. reqHeaders := make(http.Header)
  6783. for k, v := range c.header_ {
  6784. reqHeaders[k] = v
  6785. }
  6786. reqHeaders.Set("User-Agent", c.s.userAgent())
  6787. var body io.Reader = nil
  6788. c.urlParams_.Set("alt", alt)
  6789. c.urlParams_.Set("prettyPrint", "false")
  6790. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6791. urls += "?" + c.urlParams_.Encode()
  6792. req, err := http.NewRequest("DELETE", urls, body)
  6793. if err != nil {
  6794. return nil, err
  6795. }
  6796. req.Header = reqHeaders
  6797. googleapi.Expand(req.URL, map[string]string{
  6798. "name": c.name,
  6799. })
  6800. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6801. }
  6802. // Do executes the "monitoring.projects.notificationChannels.delete" call.
  6803. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6804. // code is an error. Response headers are in either
  6805. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6806. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6807. // check whether the returned error was because http.StatusNotModified
  6808. // was returned.
  6809. func (c *ProjectsNotificationChannelsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6810. gensupport.SetOptions(c.urlParams_, opts...)
  6811. res, err := c.doRequest("json")
  6812. if res != nil && res.StatusCode == http.StatusNotModified {
  6813. if res.Body != nil {
  6814. res.Body.Close()
  6815. }
  6816. return nil, &googleapi.Error{
  6817. Code: res.StatusCode,
  6818. Header: res.Header,
  6819. }
  6820. }
  6821. if err != nil {
  6822. return nil, err
  6823. }
  6824. defer googleapi.CloseBody(res)
  6825. if err := googleapi.CheckResponse(res); err != nil {
  6826. return nil, err
  6827. }
  6828. ret := &Empty{
  6829. ServerResponse: googleapi.ServerResponse{
  6830. Header: res.Header,
  6831. HTTPStatusCode: res.StatusCode,
  6832. },
  6833. }
  6834. target := &ret
  6835. if err := gensupport.DecodeResponse(target, res); err != nil {
  6836. return nil, err
  6837. }
  6838. return ret, nil
  6839. // {
  6840. // "description": "Deletes a notification channel.",
  6841. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  6842. // "httpMethod": "DELETE",
  6843. // "id": "monitoring.projects.notificationChannels.delete",
  6844. // "parameterOrder": [
  6845. // "name"
  6846. // ],
  6847. // "parameters": {
  6848. // "force": {
  6849. // "description": "If true, the notification channel will be deleted regardless of its use in alert policies (the policies will be updated to remove the channel). If false, channels that are still referenced by an existing alerting policy will fail to be deleted in a delete operation.",
  6850. // "location": "query",
  6851. // "type": "boolean"
  6852. // },
  6853. // "name": {
  6854. // "description": "The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID].",
  6855. // "location": "path",
  6856. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  6857. // "required": true,
  6858. // "type": "string"
  6859. // }
  6860. // },
  6861. // "path": "v3/{+name}",
  6862. // "response": {
  6863. // "$ref": "Empty"
  6864. // },
  6865. // "scopes": [
  6866. // "https://www.googleapis.com/auth/cloud-platform",
  6867. // "https://www.googleapis.com/auth/monitoring"
  6868. // ]
  6869. // }
  6870. }
  6871. // method id "monitoring.projects.notificationChannels.get":
  6872. type ProjectsNotificationChannelsGetCall struct {
  6873. s *Service
  6874. name string
  6875. urlParams_ gensupport.URLParams
  6876. ifNoneMatch_ string
  6877. ctx_ context.Context
  6878. header_ http.Header
  6879. }
  6880. // Get: Gets a single notification channel. The channel includes the
  6881. // relevant configuration details with which the channel was created.
  6882. // However, the response may truncate or omit passwords, API keys, or
  6883. // other private key matter and thus the response may not be 100%
  6884. // identical to the information that was supplied in the call to the
  6885. // create method.
  6886. func (r *ProjectsNotificationChannelsService) Get(name string) *ProjectsNotificationChannelsGetCall {
  6887. c := &ProjectsNotificationChannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6888. c.name = name
  6889. return c
  6890. }
  6891. // Fields allows partial responses to be retrieved. See
  6892. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6893. // for more information.
  6894. func (c *ProjectsNotificationChannelsGetCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsGetCall {
  6895. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6896. return c
  6897. }
  6898. // IfNoneMatch sets the optional parameter which makes the operation
  6899. // fail if the object's ETag matches the given value. This is useful for
  6900. // getting updates only after the object has changed since the last
  6901. // request. Use googleapi.IsNotModified to check whether the response
  6902. // error from Do is the result of In-None-Match.
  6903. func (c *ProjectsNotificationChannelsGetCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelsGetCall {
  6904. c.ifNoneMatch_ = entityTag
  6905. return c
  6906. }
  6907. // Context sets the context to be used in this call's Do method. Any
  6908. // pending HTTP request will be aborted if the provided context is
  6909. // canceled.
  6910. func (c *ProjectsNotificationChannelsGetCall) Context(ctx context.Context) *ProjectsNotificationChannelsGetCall {
  6911. c.ctx_ = ctx
  6912. return c
  6913. }
  6914. // Header returns an http.Header that can be modified by the caller to
  6915. // add HTTP headers to the request.
  6916. func (c *ProjectsNotificationChannelsGetCall) Header() http.Header {
  6917. if c.header_ == nil {
  6918. c.header_ = make(http.Header)
  6919. }
  6920. return c.header_
  6921. }
  6922. func (c *ProjectsNotificationChannelsGetCall) doRequest(alt string) (*http.Response, error) {
  6923. reqHeaders := make(http.Header)
  6924. for k, v := range c.header_ {
  6925. reqHeaders[k] = v
  6926. }
  6927. reqHeaders.Set("User-Agent", c.s.userAgent())
  6928. if c.ifNoneMatch_ != "" {
  6929. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6930. }
  6931. var body io.Reader = nil
  6932. c.urlParams_.Set("alt", alt)
  6933. c.urlParams_.Set("prettyPrint", "false")
  6934. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6935. urls += "?" + c.urlParams_.Encode()
  6936. req, err := http.NewRequest("GET", urls, body)
  6937. if err != nil {
  6938. return nil, err
  6939. }
  6940. req.Header = reqHeaders
  6941. googleapi.Expand(req.URL, map[string]string{
  6942. "name": c.name,
  6943. })
  6944. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6945. }
  6946. // Do executes the "monitoring.projects.notificationChannels.get" call.
  6947. // Exactly one of *NotificationChannel or error will be non-nil. Any
  6948. // non-2xx status code is an error. Response headers are in either
  6949. // *NotificationChannel.ServerResponse.Header or (if a response was
  6950. // returned at all) in error.(*googleapi.Error).Header. Use
  6951. // googleapi.IsNotModified to check whether the returned error was
  6952. // because http.StatusNotModified was returned.
  6953. func (c *ProjectsNotificationChannelsGetCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  6954. gensupport.SetOptions(c.urlParams_, opts...)
  6955. res, err := c.doRequest("json")
  6956. if res != nil && res.StatusCode == http.StatusNotModified {
  6957. if res.Body != nil {
  6958. res.Body.Close()
  6959. }
  6960. return nil, &googleapi.Error{
  6961. Code: res.StatusCode,
  6962. Header: res.Header,
  6963. }
  6964. }
  6965. if err != nil {
  6966. return nil, err
  6967. }
  6968. defer googleapi.CloseBody(res)
  6969. if err := googleapi.CheckResponse(res); err != nil {
  6970. return nil, err
  6971. }
  6972. ret := &NotificationChannel{
  6973. ServerResponse: googleapi.ServerResponse{
  6974. Header: res.Header,
  6975. HTTPStatusCode: res.StatusCode,
  6976. },
  6977. }
  6978. target := &ret
  6979. if err := gensupport.DecodeResponse(target, res); err != nil {
  6980. return nil, err
  6981. }
  6982. return ret, nil
  6983. // {
  6984. // "description": "Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.",
  6985. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  6986. // "httpMethod": "GET",
  6987. // "id": "monitoring.projects.notificationChannels.get",
  6988. // "parameterOrder": [
  6989. // "name"
  6990. // ],
  6991. // "parameters": {
  6992. // "name": {
  6993. // "description": "The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID].",
  6994. // "location": "path",
  6995. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  6996. // "required": true,
  6997. // "type": "string"
  6998. // }
  6999. // },
  7000. // "path": "v3/{+name}",
  7001. // "response": {
  7002. // "$ref": "NotificationChannel"
  7003. // },
  7004. // "scopes": [
  7005. // "https://www.googleapis.com/auth/cloud-platform",
  7006. // "https://www.googleapis.com/auth/monitoring",
  7007. // "https://www.googleapis.com/auth/monitoring.read"
  7008. // ]
  7009. // }
  7010. }
  7011. // method id "monitoring.projects.notificationChannels.getVerificationCode":
  7012. type ProjectsNotificationChannelsGetVerificationCodeCall struct {
  7013. s *Service
  7014. name string
  7015. getnotificationchannelverificationcoderequest *GetNotificationChannelVerificationCodeRequest
  7016. urlParams_ gensupport.URLParams
  7017. ctx_ context.Context
  7018. header_ http.Header
  7019. }
  7020. // GetVerificationCode: Requests a verification code for an already
  7021. // verified channel that can then be used in a call to
  7022. // VerifyNotificationChannel() on a different channel with an equivalent
  7023. // identity in the same or in a different project. This makes it
  7024. // possible to copy a channel between projects without requiring manual
  7025. // reverification of the channel. If the channel is not in the verified
  7026. // state, this method will fail (in other words, this may only be used
  7027. // if the SendNotificationChannelVerificationCode and
  7028. // VerifyNotificationChannel paths have already been used to put the
  7029. // given channel into the verified state).There is no guarantee that the
  7030. // verification codes returned by this method will be of a similar
  7031. // structure or form as the ones that are delivered to the channel via
  7032. // SendNotificationChannelVerificationCode; while
  7033. // VerifyNotificationChannel() will recognize both the codes delivered
  7034. // via SendNotificationChannelVerificationCode() and returned from
  7035. // GetNotificationChannelVerificationCode(), it is typically the case
  7036. // that the verification codes delivered via
  7037. // SendNotificationChannelVerificationCode() will be shorter and also
  7038. // have a shorter expiration (e.g. codes such as "G-123456") whereas
  7039. // GetVerificationCode() will typically return a much longer, websafe
  7040. // base 64 encoded string that has a longer expiration time.
  7041. func (r *ProjectsNotificationChannelsService) GetVerificationCode(name string, getnotificationchannelverificationcoderequest *GetNotificationChannelVerificationCodeRequest) *ProjectsNotificationChannelsGetVerificationCodeCall {
  7042. c := &ProjectsNotificationChannelsGetVerificationCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7043. c.name = name
  7044. c.getnotificationchannelverificationcoderequest = getnotificationchannelverificationcoderequest
  7045. return c
  7046. }
  7047. // Fields allows partial responses to be retrieved. See
  7048. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7049. // for more information.
  7050. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsGetVerificationCodeCall {
  7051. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7052. return c
  7053. }
  7054. // Context sets the context to be used in this call's Do method. Any
  7055. // pending HTTP request will be aborted if the provided context is
  7056. // canceled.
  7057. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Context(ctx context.Context) *ProjectsNotificationChannelsGetVerificationCodeCall {
  7058. c.ctx_ = ctx
  7059. return c
  7060. }
  7061. // Header returns an http.Header that can be modified by the caller to
  7062. // add HTTP headers to the request.
  7063. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Header() http.Header {
  7064. if c.header_ == nil {
  7065. c.header_ = make(http.Header)
  7066. }
  7067. return c.header_
  7068. }
  7069. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) doRequest(alt string) (*http.Response, error) {
  7070. reqHeaders := make(http.Header)
  7071. for k, v := range c.header_ {
  7072. reqHeaders[k] = v
  7073. }
  7074. reqHeaders.Set("User-Agent", c.s.userAgent())
  7075. var body io.Reader = nil
  7076. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getnotificationchannelverificationcoderequest)
  7077. if err != nil {
  7078. return nil, err
  7079. }
  7080. reqHeaders.Set("Content-Type", "application/json")
  7081. c.urlParams_.Set("alt", alt)
  7082. c.urlParams_.Set("prettyPrint", "false")
  7083. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:getVerificationCode")
  7084. urls += "?" + c.urlParams_.Encode()
  7085. req, err := http.NewRequest("POST", urls, body)
  7086. if err != nil {
  7087. return nil, err
  7088. }
  7089. req.Header = reqHeaders
  7090. googleapi.Expand(req.URL, map[string]string{
  7091. "name": c.name,
  7092. })
  7093. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7094. }
  7095. // Do executes the "monitoring.projects.notificationChannels.getVerificationCode" call.
  7096. // Exactly one of *GetNotificationChannelVerificationCodeResponse or
  7097. // error will be non-nil. Any non-2xx status code is an error. Response
  7098. // headers are in either
  7099. // *GetNotificationChannelVerificationCodeResponse.ServerResponse.Header
  7100. // or (if a response was returned at all) in
  7101. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7102. // whether the returned error was because http.StatusNotModified was
  7103. // returned.
  7104. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Do(opts ...googleapi.CallOption) (*GetNotificationChannelVerificationCodeResponse, error) {
  7105. gensupport.SetOptions(c.urlParams_, opts...)
  7106. res, err := c.doRequest("json")
  7107. if res != nil && res.StatusCode == http.StatusNotModified {
  7108. if res.Body != nil {
  7109. res.Body.Close()
  7110. }
  7111. return nil, &googleapi.Error{
  7112. Code: res.StatusCode,
  7113. Header: res.Header,
  7114. }
  7115. }
  7116. if err != nil {
  7117. return nil, err
  7118. }
  7119. defer googleapi.CloseBody(res)
  7120. if err := googleapi.CheckResponse(res); err != nil {
  7121. return nil, err
  7122. }
  7123. ret := &GetNotificationChannelVerificationCodeResponse{
  7124. ServerResponse: googleapi.ServerResponse{
  7125. Header: res.Header,
  7126. HTTPStatusCode: res.StatusCode,
  7127. },
  7128. }
  7129. target := &ret
  7130. if err := gensupport.DecodeResponse(target, res); err != nil {
  7131. return nil, err
  7132. }
  7133. return ret, nil
  7134. // {
  7135. // "description": "Requests a verification code for an already verified channel that can then be used in a call to VerifyNotificationChannel() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state).There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as \"G-123456\") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.",
  7136. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:getVerificationCode",
  7137. // "httpMethod": "POST",
  7138. // "id": "monitoring.projects.notificationChannels.getVerificationCode",
  7139. // "parameterOrder": [
  7140. // "name"
  7141. // ],
  7142. // "parameters": {
  7143. // "name": {
  7144. // "description": "The notification channel for which a verification code is to be generated and retrieved. This must name a channel that is already verified; if the specified channel is not verified, the request will fail.",
  7145. // "location": "path",
  7146. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7147. // "required": true,
  7148. // "type": "string"
  7149. // }
  7150. // },
  7151. // "path": "v3/{+name}:getVerificationCode",
  7152. // "request": {
  7153. // "$ref": "GetNotificationChannelVerificationCodeRequest"
  7154. // },
  7155. // "response": {
  7156. // "$ref": "GetNotificationChannelVerificationCodeResponse"
  7157. // },
  7158. // "scopes": [
  7159. // "https://www.googleapis.com/auth/cloud-platform",
  7160. // "https://www.googleapis.com/auth/monitoring"
  7161. // ]
  7162. // }
  7163. }
  7164. // method id "monitoring.projects.notificationChannels.list":
  7165. type ProjectsNotificationChannelsListCall struct {
  7166. s *Service
  7167. name string
  7168. urlParams_ gensupport.URLParams
  7169. ifNoneMatch_ string
  7170. ctx_ context.Context
  7171. header_ http.Header
  7172. }
  7173. // List: Lists the notification channels that have been created for the
  7174. // project.
  7175. func (r *ProjectsNotificationChannelsService) List(name string) *ProjectsNotificationChannelsListCall {
  7176. c := &ProjectsNotificationChannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7177. c.name = name
  7178. return c
  7179. }
  7180. // Filter sets the optional parameter "filter": If provided, this field
  7181. // specifies the criteria that must be met by notification channels to
  7182. // be included in the response.For more details, see sorting and
  7183. // filtering.
  7184. func (c *ProjectsNotificationChannelsListCall) Filter(filter string) *ProjectsNotificationChannelsListCall {
  7185. c.urlParams_.Set("filter", filter)
  7186. return c
  7187. }
  7188. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  7189. // of fields by which to sort the result. Supports the same set of
  7190. // fields as in filter. Entries can be prefixed with a minus sign to
  7191. // sort in descending rather than ascending order.For more details, see
  7192. // sorting and filtering.
  7193. func (c *ProjectsNotificationChannelsListCall) OrderBy(orderBy string) *ProjectsNotificationChannelsListCall {
  7194. c.urlParams_.Set("orderBy", orderBy)
  7195. return c
  7196. }
  7197. // PageSize sets the optional parameter "pageSize": The maximum number
  7198. // of results to return in a single response. If not set to a positive
  7199. // number, a reasonable value will be chosen by the service.
  7200. func (c *ProjectsNotificationChannelsListCall) PageSize(pageSize int64) *ProjectsNotificationChannelsListCall {
  7201. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7202. return c
  7203. }
  7204. // PageToken sets the optional parameter "pageToken": If non-empty,
  7205. // page_token must contain a value returned as the next_page_token in a
  7206. // previous response to request the next set of results.
  7207. func (c *ProjectsNotificationChannelsListCall) PageToken(pageToken string) *ProjectsNotificationChannelsListCall {
  7208. c.urlParams_.Set("pageToken", pageToken)
  7209. return c
  7210. }
  7211. // Fields allows partial responses to be retrieved. See
  7212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7213. // for more information.
  7214. func (c *ProjectsNotificationChannelsListCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsListCall {
  7215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7216. return c
  7217. }
  7218. // IfNoneMatch sets the optional parameter which makes the operation
  7219. // fail if the object's ETag matches the given value. This is useful for
  7220. // getting updates only after the object has changed since the last
  7221. // request. Use googleapi.IsNotModified to check whether the response
  7222. // error from Do is the result of In-None-Match.
  7223. func (c *ProjectsNotificationChannelsListCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelsListCall {
  7224. c.ifNoneMatch_ = entityTag
  7225. return c
  7226. }
  7227. // Context sets the context to be used in this call's Do method. Any
  7228. // pending HTTP request will be aborted if the provided context is
  7229. // canceled.
  7230. func (c *ProjectsNotificationChannelsListCall) Context(ctx context.Context) *ProjectsNotificationChannelsListCall {
  7231. c.ctx_ = ctx
  7232. return c
  7233. }
  7234. // Header returns an http.Header that can be modified by the caller to
  7235. // add HTTP headers to the request.
  7236. func (c *ProjectsNotificationChannelsListCall) Header() http.Header {
  7237. if c.header_ == nil {
  7238. c.header_ = make(http.Header)
  7239. }
  7240. return c.header_
  7241. }
  7242. func (c *ProjectsNotificationChannelsListCall) doRequest(alt string) (*http.Response, error) {
  7243. reqHeaders := make(http.Header)
  7244. for k, v := range c.header_ {
  7245. reqHeaders[k] = v
  7246. }
  7247. reqHeaders.Set("User-Agent", c.s.userAgent())
  7248. if c.ifNoneMatch_ != "" {
  7249. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7250. }
  7251. var body io.Reader = nil
  7252. c.urlParams_.Set("alt", alt)
  7253. c.urlParams_.Set("prettyPrint", "false")
  7254. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannels")
  7255. urls += "?" + c.urlParams_.Encode()
  7256. req, err := http.NewRequest("GET", urls, body)
  7257. if err != nil {
  7258. return nil, err
  7259. }
  7260. req.Header = reqHeaders
  7261. googleapi.Expand(req.URL, map[string]string{
  7262. "name": c.name,
  7263. })
  7264. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7265. }
  7266. // Do executes the "monitoring.projects.notificationChannels.list" call.
  7267. // Exactly one of *ListNotificationChannelsResponse or error will be
  7268. // non-nil. Any non-2xx status code is an error. Response headers are in
  7269. // either *ListNotificationChannelsResponse.ServerResponse.Header or (if
  7270. // a response was returned at all) in error.(*googleapi.Error).Header.
  7271. // Use googleapi.IsNotModified to check whether the returned error was
  7272. // because http.StatusNotModified was returned.
  7273. func (c *ProjectsNotificationChannelsListCall) Do(opts ...googleapi.CallOption) (*ListNotificationChannelsResponse, error) {
  7274. gensupport.SetOptions(c.urlParams_, opts...)
  7275. res, err := c.doRequest("json")
  7276. if res != nil && res.StatusCode == http.StatusNotModified {
  7277. if res.Body != nil {
  7278. res.Body.Close()
  7279. }
  7280. return nil, &googleapi.Error{
  7281. Code: res.StatusCode,
  7282. Header: res.Header,
  7283. }
  7284. }
  7285. if err != nil {
  7286. return nil, err
  7287. }
  7288. defer googleapi.CloseBody(res)
  7289. if err := googleapi.CheckResponse(res); err != nil {
  7290. return nil, err
  7291. }
  7292. ret := &ListNotificationChannelsResponse{
  7293. ServerResponse: googleapi.ServerResponse{
  7294. Header: res.Header,
  7295. HTTPStatusCode: res.StatusCode,
  7296. },
  7297. }
  7298. target := &ret
  7299. if err := gensupport.DecodeResponse(target, res); err != nil {
  7300. return nil, err
  7301. }
  7302. return ret, nil
  7303. // {
  7304. // "description": "Lists the notification channels that have been created for the project.",
  7305. // "flatPath": "v3/projects/{projectsId}/notificationChannels",
  7306. // "httpMethod": "GET",
  7307. // "id": "monitoring.projects.notificationChannels.list",
  7308. // "parameterOrder": [
  7309. // "name"
  7310. // ],
  7311. // "parameters": {
  7312. // "filter": {
  7313. // "description": "If provided, this field specifies the criteria that must be met by notification channels to be included in the response.For more details, see sorting and filtering.",
  7314. // "location": "query",
  7315. // "type": "string"
  7316. // },
  7317. // "name": {
  7318. // "description": "The project on which to execute the request. The format is projects/[PROJECT_ID]. That is, this names the container in which to look for the notification channels; it does not name a specific channel. To query a specific channel by REST resource name, use the GetNotificationChannel operation.",
  7319. // "location": "path",
  7320. // "pattern": "^projects/[^/]+$",
  7321. // "required": true,
  7322. // "type": "string"
  7323. // },
  7324. // "orderBy": {
  7325. // "description": "A comma-separated list of fields by which to sort the result. Supports the same set of fields as in filter. Entries can be prefixed with a minus sign to sort in descending rather than ascending order.For more details, see sorting and filtering.",
  7326. // "location": "query",
  7327. // "type": "string"
  7328. // },
  7329. // "pageSize": {
  7330. // "description": "The maximum number of results to return in a single response. If not set to a positive number, a reasonable value will be chosen by the service.",
  7331. // "format": "int32",
  7332. // "location": "query",
  7333. // "type": "integer"
  7334. // },
  7335. // "pageToken": {
  7336. // "description": "If non-empty, page_token must contain a value returned as the next_page_token in a previous response to request the next set of results.",
  7337. // "location": "query",
  7338. // "type": "string"
  7339. // }
  7340. // },
  7341. // "path": "v3/{+name}/notificationChannels",
  7342. // "response": {
  7343. // "$ref": "ListNotificationChannelsResponse"
  7344. // },
  7345. // "scopes": [
  7346. // "https://www.googleapis.com/auth/cloud-platform",
  7347. // "https://www.googleapis.com/auth/monitoring",
  7348. // "https://www.googleapis.com/auth/monitoring.read"
  7349. // ]
  7350. // }
  7351. }
  7352. // Pages invokes f for each page of results.
  7353. // A non-nil error returned from f will halt the iteration.
  7354. // The provided context supersedes any context provided to the Context method.
  7355. func (c *ProjectsNotificationChannelsListCall) Pages(ctx context.Context, f func(*ListNotificationChannelsResponse) error) error {
  7356. c.ctx_ = ctx
  7357. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7358. for {
  7359. x, err := c.Do()
  7360. if err != nil {
  7361. return err
  7362. }
  7363. if err := f(x); err != nil {
  7364. return err
  7365. }
  7366. if x.NextPageToken == "" {
  7367. return nil
  7368. }
  7369. c.PageToken(x.NextPageToken)
  7370. }
  7371. }
  7372. // method id "monitoring.projects.notificationChannels.patch":
  7373. type ProjectsNotificationChannelsPatchCall struct {
  7374. s *Service
  7375. name string
  7376. notificationchannel *NotificationChannel
  7377. urlParams_ gensupport.URLParams
  7378. ctx_ context.Context
  7379. header_ http.Header
  7380. }
  7381. // Patch: Updates a notification channel. Fields not specified in the
  7382. // field mask remain unchanged.
  7383. func (r *ProjectsNotificationChannelsService) Patch(name string, notificationchannel *NotificationChannel) *ProjectsNotificationChannelsPatchCall {
  7384. c := &ProjectsNotificationChannelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7385. c.name = name
  7386. c.notificationchannel = notificationchannel
  7387. return c
  7388. }
  7389. // UpdateMask sets the optional parameter "updateMask": The fields to
  7390. // update.
  7391. func (c *ProjectsNotificationChannelsPatchCall) UpdateMask(updateMask string) *ProjectsNotificationChannelsPatchCall {
  7392. c.urlParams_.Set("updateMask", updateMask)
  7393. return c
  7394. }
  7395. // Fields allows partial responses to be retrieved. See
  7396. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7397. // for more information.
  7398. func (c *ProjectsNotificationChannelsPatchCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsPatchCall {
  7399. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7400. return c
  7401. }
  7402. // Context sets the context to be used in this call's Do method. Any
  7403. // pending HTTP request will be aborted if the provided context is
  7404. // canceled.
  7405. func (c *ProjectsNotificationChannelsPatchCall) Context(ctx context.Context) *ProjectsNotificationChannelsPatchCall {
  7406. c.ctx_ = ctx
  7407. return c
  7408. }
  7409. // Header returns an http.Header that can be modified by the caller to
  7410. // add HTTP headers to the request.
  7411. func (c *ProjectsNotificationChannelsPatchCall) Header() http.Header {
  7412. if c.header_ == nil {
  7413. c.header_ = make(http.Header)
  7414. }
  7415. return c.header_
  7416. }
  7417. func (c *ProjectsNotificationChannelsPatchCall) doRequest(alt string) (*http.Response, error) {
  7418. reqHeaders := make(http.Header)
  7419. for k, v := range c.header_ {
  7420. reqHeaders[k] = v
  7421. }
  7422. reqHeaders.Set("User-Agent", c.s.userAgent())
  7423. var body io.Reader = nil
  7424. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notificationchannel)
  7425. if err != nil {
  7426. return nil, err
  7427. }
  7428. reqHeaders.Set("Content-Type", "application/json")
  7429. c.urlParams_.Set("alt", alt)
  7430. c.urlParams_.Set("prettyPrint", "false")
  7431. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  7432. urls += "?" + c.urlParams_.Encode()
  7433. req, err := http.NewRequest("PATCH", urls, body)
  7434. if err != nil {
  7435. return nil, err
  7436. }
  7437. req.Header = reqHeaders
  7438. googleapi.Expand(req.URL, map[string]string{
  7439. "name": c.name,
  7440. })
  7441. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7442. }
  7443. // Do executes the "monitoring.projects.notificationChannels.patch" call.
  7444. // Exactly one of *NotificationChannel or error will be non-nil. Any
  7445. // non-2xx status code is an error. Response headers are in either
  7446. // *NotificationChannel.ServerResponse.Header or (if a response was
  7447. // returned at all) in error.(*googleapi.Error).Header. Use
  7448. // googleapi.IsNotModified to check whether the returned error was
  7449. // because http.StatusNotModified was returned.
  7450. func (c *ProjectsNotificationChannelsPatchCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  7451. gensupport.SetOptions(c.urlParams_, opts...)
  7452. res, err := c.doRequest("json")
  7453. if res != nil && res.StatusCode == http.StatusNotModified {
  7454. if res.Body != nil {
  7455. res.Body.Close()
  7456. }
  7457. return nil, &googleapi.Error{
  7458. Code: res.StatusCode,
  7459. Header: res.Header,
  7460. }
  7461. }
  7462. if err != nil {
  7463. return nil, err
  7464. }
  7465. defer googleapi.CloseBody(res)
  7466. if err := googleapi.CheckResponse(res); err != nil {
  7467. return nil, err
  7468. }
  7469. ret := &NotificationChannel{
  7470. ServerResponse: googleapi.ServerResponse{
  7471. Header: res.Header,
  7472. HTTPStatusCode: res.StatusCode,
  7473. },
  7474. }
  7475. target := &ret
  7476. if err := gensupport.DecodeResponse(target, res); err != nil {
  7477. return nil, err
  7478. }
  7479. return ret, nil
  7480. // {
  7481. // "description": "Updates a notification channel. Fields not specified in the field mask remain unchanged.",
  7482. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  7483. // "httpMethod": "PATCH",
  7484. // "id": "monitoring.projects.notificationChannels.patch",
  7485. // "parameterOrder": [
  7486. // "name"
  7487. // ],
  7488. // "parameters": {
  7489. // "name": {
  7490. // "description": "The full REST resource name for this channel. The syntax is:\nprojects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]\nThe [CHANNEL_ID] is automatically assigned by the server on creation.",
  7491. // "location": "path",
  7492. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7493. // "required": true,
  7494. // "type": "string"
  7495. // },
  7496. // "updateMask": {
  7497. // "description": "The fields to update.",
  7498. // "format": "google-fieldmask",
  7499. // "location": "query",
  7500. // "type": "string"
  7501. // }
  7502. // },
  7503. // "path": "v3/{+name}",
  7504. // "request": {
  7505. // "$ref": "NotificationChannel"
  7506. // },
  7507. // "response": {
  7508. // "$ref": "NotificationChannel"
  7509. // },
  7510. // "scopes": [
  7511. // "https://www.googleapis.com/auth/cloud-platform",
  7512. // "https://www.googleapis.com/auth/monitoring"
  7513. // ]
  7514. // }
  7515. }
  7516. // method id "monitoring.projects.notificationChannels.sendVerificationCode":
  7517. type ProjectsNotificationChannelsSendVerificationCodeCall struct {
  7518. s *Service
  7519. name string
  7520. sendnotificationchannelverificationcoderequest *SendNotificationChannelVerificationCodeRequest
  7521. urlParams_ gensupport.URLParams
  7522. ctx_ context.Context
  7523. header_ http.Header
  7524. }
  7525. // SendVerificationCode: Causes a verification code to be delivered to
  7526. // the channel. The code can then be supplied in
  7527. // VerifyNotificationChannel to verify the channel.
  7528. func (r *ProjectsNotificationChannelsService) SendVerificationCode(name string, sendnotificationchannelverificationcoderequest *SendNotificationChannelVerificationCodeRequest) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7529. c := &ProjectsNotificationChannelsSendVerificationCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7530. c.name = name
  7531. c.sendnotificationchannelverificationcoderequest = sendnotificationchannelverificationcoderequest
  7532. return c
  7533. }
  7534. // Fields allows partial responses to be retrieved. See
  7535. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7536. // for more information.
  7537. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7538. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7539. return c
  7540. }
  7541. // Context sets the context to be used in this call's Do method. Any
  7542. // pending HTTP request will be aborted if the provided context is
  7543. // canceled.
  7544. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Context(ctx context.Context) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7545. c.ctx_ = ctx
  7546. return c
  7547. }
  7548. // Header returns an http.Header that can be modified by the caller to
  7549. // add HTTP headers to the request.
  7550. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Header() http.Header {
  7551. if c.header_ == nil {
  7552. c.header_ = make(http.Header)
  7553. }
  7554. return c.header_
  7555. }
  7556. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) doRequest(alt string) (*http.Response, error) {
  7557. reqHeaders := make(http.Header)
  7558. for k, v := range c.header_ {
  7559. reqHeaders[k] = v
  7560. }
  7561. reqHeaders.Set("User-Agent", c.s.userAgent())
  7562. var body io.Reader = nil
  7563. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendnotificationchannelverificationcoderequest)
  7564. if err != nil {
  7565. return nil, err
  7566. }
  7567. reqHeaders.Set("Content-Type", "application/json")
  7568. c.urlParams_.Set("alt", alt)
  7569. c.urlParams_.Set("prettyPrint", "false")
  7570. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:sendVerificationCode")
  7571. urls += "?" + c.urlParams_.Encode()
  7572. req, err := http.NewRequest("POST", urls, body)
  7573. if err != nil {
  7574. return nil, err
  7575. }
  7576. req.Header = reqHeaders
  7577. googleapi.Expand(req.URL, map[string]string{
  7578. "name": c.name,
  7579. })
  7580. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7581. }
  7582. // Do executes the "monitoring.projects.notificationChannels.sendVerificationCode" call.
  7583. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7584. // code is an error. Response headers are in either
  7585. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7586. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7587. // check whether the returned error was because http.StatusNotModified
  7588. // was returned.
  7589. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7590. gensupport.SetOptions(c.urlParams_, opts...)
  7591. res, err := c.doRequest("json")
  7592. if res != nil && res.StatusCode == http.StatusNotModified {
  7593. if res.Body != nil {
  7594. res.Body.Close()
  7595. }
  7596. return nil, &googleapi.Error{
  7597. Code: res.StatusCode,
  7598. Header: res.Header,
  7599. }
  7600. }
  7601. if err != nil {
  7602. return nil, err
  7603. }
  7604. defer googleapi.CloseBody(res)
  7605. if err := googleapi.CheckResponse(res); err != nil {
  7606. return nil, err
  7607. }
  7608. ret := &Empty{
  7609. ServerResponse: googleapi.ServerResponse{
  7610. Header: res.Header,
  7611. HTTPStatusCode: res.StatusCode,
  7612. },
  7613. }
  7614. target := &ret
  7615. if err := gensupport.DecodeResponse(target, res); err != nil {
  7616. return nil, err
  7617. }
  7618. return ret, nil
  7619. // {
  7620. // "description": "Causes a verification code to be delivered to the channel. The code can then be supplied in VerifyNotificationChannel to verify the channel.",
  7621. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:sendVerificationCode",
  7622. // "httpMethod": "POST",
  7623. // "id": "monitoring.projects.notificationChannels.sendVerificationCode",
  7624. // "parameterOrder": [
  7625. // "name"
  7626. // ],
  7627. // "parameters": {
  7628. // "name": {
  7629. // "description": "The notification channel to which to send a verification code.",
  7630. // "location": "path",
  7631. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7632. // "required": true,
  7633. // "type": "string"
  7634. // }
  7635. // },
  7636. // "path": "v3/{+name}:sendVerificationCode",
  7637. // "request": {
  7638. // "$ref": "SendNotificationChannelVerificationCodeRequest"
  7639. // },
  7640. // "response": {
  7641. // "$ref": "Empty"
  7642. // },
  7643. // "scopes": [
  7644. // "https://www.googleapis.com/auth/cloud-platform",
  7645. // "https://www.googleapis.com/auth/monitoring"
  7646. // ]
  7647. // }
  7648. }
  7649. // method id "monitoring.projects.notificationChannels.verify":
  7650. type ProjectsNotificationChannelsVerifyCall struct {
  7651. s *Service
  7652. name string
  7653. verifynotificationchannelrequest *VerifyNotificationChannelRequest
  7654. urlParams_ gensupport.URLParams
  7655. ctx_ context.Context
  7656. header_ http.Header
  7657. }
  7658. // Verify: Verifies a NotificationChannel by proving receipt of the code
  7659. // delivered to the channel as a result of calling
  7660. // SendNotificationChannelVerificationCode.
  7661. func (r *ProjectsNotificationChannelsService) Verify(name string, verifynotificationchannelrequest *VerifyNotificationChannelRequest) *ProjectsNotificationChannelsVerifyCall {
  7662. c := &ProjectsNotificationChannelsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7663. c.name = name
  7664. c.verifynotificationchannelrequest = verifynotificationchannelrequest
  7665. return c
  7666. }
  7667. // Fields allows partial responses to be retrieved. See
  7668. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7669. // for more information.
  7670. func (c *ProjectsNotificationChannelsVerifyCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsVerifyCall {
  7671. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7672. return c
  7673. }
  7674. // Context sets the context to be used in this call's Do method. Any
  7675. // pending HTTP request will be aborted if the provided context is
  7676. // canceled.
  7677. func (c *ProjectsNotificationChannelsVerifyCall) Context(ctx context.Context) *ProjectsNotificationChannelsVerifyCall {
  7678. c.ctx_ = ctx
  7679. return c
  7680. }
  7681. // Header returns an http.Header that can be modified by the caller to
  7682. // add HTTP headers to the request.
  7683. func (c *ProjectsNotificationChannelsVerifyCall) Header() http.Header {
  7684. if c.header_ == nil {
  7685. c.header_ = make(http.Header)
  7686. }
  7687. return c.header_
  7688. }
  7689. func (c *ProjectsNotificationChannelsVerifyCall) doRequest(alt string) (*http.Response, error) {
  7690. reqHeaders := make(http.Header)
  7691. for k, v := range c.header_ {
  7692. reqHeaders[k] = v
  7693. }
  7694. reqHeaders.Set("User-Agent", c.s.userAgent())
  7695. var body io.Reader = nil
  7696. body, err := googleapi.WithoutDataWrapper.JSONReader(c.verifynotificationchannelrequest)
  7697. if err != nil {
  7698. return nil, err
  7699. }
  7700. reqHeaders.Set("Content-Type", "application/json")
  7701. c.urlParams_.Set("alt", alt)
  7702. c.urlParams_.Set("prettyPrint", "false")
  7703. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:verify")
  7704. urls += "?" + c.urlParams_.Encode()
  7705. req, err := http.NewRequest("POST", urls, body)
  7706. if err != nil {
  7707. return nil, err
  7708. }
  7709. req.Header = reqHeaders
  7710. googleapi.Expand(req.URL, map[string]string{
  7711. "name": c.name,
  7712. })
  7713. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7714. }
  7715. // Do executes the "monitoring.projects.notificationChannels.verify" call.
  7716. // Exactly one of *NotificationChannel or error will be non-nil. Any
  7717. // non-2xx status code is an error. Response headers are in either
  7718. // *NotificationChannel.ServerResponse.Header or (if a response was
  7719. // returned at all) in error.(*googleapi.Error).Header. Use
  7720. // googleapi.IsNotModified to check whether the returned error was
  7721. // because http.StatusNotModified was returned.
  7722. func (c *ProjectsNotificationChannelsVerifyCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  7723. gensupport.SetOptions(c.urlParams_, opts...)
  7724. res, err := c.doRequest("json")
  7725. if res != nil && res.StatusCode == http.StatusNotModified {
  7726. if res.Body != nil {
  7727. res.Body.Close()
  7728. }
  7729. return nil, &googleapi.Error{
  7730. Code: res.StatusCode,
  7731. Header: res.Header,
  7732. }
  7733. }
  7734. if err != nil {
  7735. return nil, err
  7736. }
  7737. defer googleapi.CloseBody(res)
  7738. if err := googleapi.CheckResponse(res); err != nil {
  7739. return nil, err
  7740. }
  7741. ret := &NotificationChannel{
  7742. ServerResponse: googleapi.ServerResponse{
  7743. Header: res.Header,
  7744. HTTPStatusCode: res.StatusCode,
  7745. },
  7746. }
  7747. target := &ret
  7748. if err := gensupport.DecodeResponse(target, res); err != nil {
  7749. return nil, err
  7750. }
  7751. return ret, nil
  7752. // {
  7753. // "description": "Verifies a NotificationChannel by proving receipt of the code delivered to the channel as a result of calling SendNotificationChannelVerificationCode.",
  7754. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:verify",
  7755. // "httpMethod": "POST",
  7756. // "id": "monitoring.projects.notificationChannels.verify",
  7757. // "parameterOrder": [
  7758. // "name"
  7759. // ],
  7760. // "parameters": {
  7761. // "name": {
  7762. // "description": "The notification channel to verify.",
  7763. // "location": "path",
  7764. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7765. // "required": true,
  7766. // "type": "string"
  7767. // }
  7768. // },
  7769. // "path": "v3/{+name}:verify",
  7770. // "request": {
  7771. // "$ref": "VerifyNotificationChannelRequest"
  7772. // },
  7773. // "response": {
  7774. // "$ref": "NotificationChannel"
  7775. // },
  7776. // "scopes": [
  7777. // "https://www.googleapis.com/auth/cloud-platform",
  7778. // "https://www.googleapis.com/auth/monitoring"
  7779. // ]
  7780. // }
  7781. }
  7782. // method id "monitoring.projects.timeSeries.create":
  7783. type ProjectsTimeSeriesCreateCall struct {
  7784. s *Service
  7785. name string
  7786. createtimeseriesrequest *CreateTimeSeriesRequest
  7787. urlParams_ gensupport.URLParams
  7788. ctx_ context.Context
  7789. header_ http.Header
  7790. }
  7791. // Create: Creates or adds data to one or more time series. The response
  7792. // is empty if all time series in the request were written. If any time
  7793. // series could not be written, a corresponding failure message is
  7794. // included in the error response.
  7795. func (r *ProjectsTimeSeriesService) Create(name string, createtimeseriesrequest *CreateTimeSeriesRequest) *ProjectsTimeSeriesCreateCall {
  7796. c := &ProjectsTimeSeriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7797. c.name = name
  7798. c.createtimeseriesrequest = createtimeseriesrequest
  7799. return c
  7800. }
  7801. // Fields allows partial responses to be retrieved. See
  7802. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7803. // for more information.
  7804. func (c *ProjectsTimeSeriesCreateCall) Fields(s ...googleapi.Field) *ProjectsTimeSeriesCreateCall {
  7805. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7806. return c
  7807. }
  7808. // Context sets the context to be used in this call's Do method. Any
  7809. // pending HTTP request will be aborted if the provided context is
  7810. // canceled.
  7811. func (c *ProjectsTimeSeriesCreateCall) Context(ctx context.Context) *ProjectsTimeSeriesCreateCall {
  7812. c.ctx_ = ctx
  7813. return c
  7814. }
  7815. // Header returns an http.Header that can be modified by the caller to
  7816. // add HTTP headers to the request.
  7817. func (c *ProjectsTimeSeriesCreateCall) Header() http.Header {
  7818. if c.header_ == nil {
  7819. c.header_ = make(http.Header)
  7820. }
  7821. return c.header_
  7822. }
  7823. func (c *ProjectsTimeSeriesCreateCall) doRequest(alt string) (*http.Response, error) {
  7824. reqHeaders := make(http.Header)
  7825. for k, v := range c.header_ {
  7826. reqHeaders[k] = v
  7827. }
  7828. reqHeaders.Set("User-Agent", c.s.userAgent())
  7829. var body io.Reader = nil
  7830. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createtimeseriesrequest)
  7831. if err != nil {
  7832. return nil, err
  7833. }
  7834. reqHeaders.Set("Content-Type", "application/json")
  7835. c.urlParams_.Set("alt", alt)
  7836. c.urlParams_.Set("prettyPrint", "false")
  7837. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/timeSeries")
  7838. urls += "?" + c.urlParams_.Encode()
  7839. req, err := http.NewRequest("POST", urls, body)
  7840. if err != nil {
  7841. return nil, err
  7842. }
  7843. req.Header = reqHeaders
  7844. googleapi.Expand(req.URL, map[string]string{
  7845. "name": c.name,
  7846. })
  7847. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7848. }
  7849. // Do executes the "monitoring.projects.timeSeries.create" call.
  7850. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7851. // code is an error. Response headers are in either
  7852. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7853. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7854. // check whether the returned error was because http.StatusNotModified
  7855. // was returned.
  7856. func (c *ProjectsTimeSeriesCreateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7857. gensupport.SetOptions(c.urlParams_, opts...)
  7858. res, err := c.doRequest("json")
  7859. if res != nil && res.StatusCode == http.StatusNotModified {
  7860. if res.Body != nil {
  7861. res.Body.Close()
  7862. }
  7863. return nil, &googleapi.Error{
  7864. Code: res.StatusCode,
  7865. Header: res.Header,
  7866. }
  7867. }
  7868. if err != nil {
  7869. return nil, err
  7870. }
  7871. defer googleapi.CloseBody(res)
  7872. if err := googleapi.CheckResponse(res); err != nil {
  7873. return nil, err
  7874. }
  7875. ret := &Empty{
  7876. ServerResponse: googleapi.ServerResponse{
  7877. Header: res.Header,
  7878. HTTPStatusCode: res.StatusCode,
  7879. },
  7880. }
  7881. target := &ret
  7882. if err := gensupport.DecodeResponse(target, res); err != nil {
  7883. return nil, err
  7884. }
  7885. return ret, nil
  7886. // {
  7887. // "description": "Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.",
  7888. // "flatPath": "v3/projects/{projectsId}/timeSeries",
  7889. // "httpMethod": "POST",
  7890. // "id": "monitoring.projects.timeSeries.create",
  7891. // "parameterOrder": [
  7892. // "name"
  7893. // ],
  7894. // "parameters": {
  7895. // "name": {
  7896. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  7897. // "location": "path",
  7898. // "pattern": "^projects/[^/]+$",
  7899. // "required": true,
  7900. // "type": "string"
  7901. // }
  7902. // },
  7903. // "path": "v3/{+name}/timeSeries",
  7904. // "request": {
  7905. // "$ref": "CreateTimeSeriesRequest"
  7906. // },
  7907. // "response": {
  7908. // "$ref": "Empty"
  7909. // },
  7910. // "scopes": [
  7911. // "https://www.googleapis.com/auth/cloud-platform",
  7912. // "https://www.googleapis.com/auth/monitoring",
  7913. // "https://www.googleapis.com/auth/monitoring.write"
  7914. // ]
  7915. // }
  7916. }
  7917. // method id "monitoring.projects.timeSeries.list":
  7918. type ProjectsTimeSeriesListCall struct {
  7919. s *Service
  7920. name string
  7921. urlParams_ gensupport.URLParams
  7922. ifNoneMatch_ string
  7923. ctx_ context.Context
  7924. header_ http.Header
  7925. }
  7926. // List: Lists time series that match a filter. This method does not
  7927. // require a Stackdriver account.
  7928. func (r *ProjectsTimeSeriesService) List(name string) *ProjectsTimeSeriesListCall {
  7929. c := &ProjectsTimeSeriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7930. c.name = name
  7931. return c
  7932. }
  7933. // AggregationAlignmentPeriod sets the optional parameter
  7934. // "aggregation.alignmentPeriod": The alignment period for per-time
  7935. // series alignment. If present, alignmentPeriod must be at least 60
  7936. // seconds. After per-time series alignment, each time series will
  7937. // contain data points only on the period boundaries. If
  7938. // perSeriesAligner is not specified or equals ALIGN_NONE, then this
  7939. // field is ignored. If perSeriesAligner is specified and does not equal
  7940. // ALIGN_NONE, then this field must be defined; otherwise an error is
  7941. // returned.
  7942. func (c *ProjectsTimeSeriesListCall) AggregationAlignmentPeriod(aggregationAlignmentPeriod string) *ProjectsTimeSeriesListCall {
  7943. c.urlParams_.Set("aggregation.alignmentPeriod", aggregationAlignmentPeriod)
  7944. return c
  7945. }
  7946. // AggregationCrossSeriesReducer sets the optional parameter
  7947. // "aggregation.crossSeriesReducer": The approach to be used to combine
  7948. // time series. Not all reducer functions may be applied to all time
  7949. // series, depending on the metric type and the value type of the
  7950. // original time series. Reduction may change the metric type of value
  7951. // type of the time series.Time series data must be aligned in order to
  7952. // perform cross-time series reduction. If crossSeriesReducer is
  7953. // specified, then perSeriesAligner must be specified and not equal
  7954. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  7955. // is returned.
  7956. //
  7957. // Possible values:
  7958. // "REDUCE_NONE"
  7959. // "REDUCE_MEAN"
  7960. // "REDUCE_MIN"
  7961. // "REDUCE_MAX"
  7962. // "REDUCE_SUM"
  7963. // "REDUCE_STDDEV"
  7964. // "REDUCE_COUNT"
  7965. // "REDUCE_COUNT_TRUE"
  7966. // "REDUCE_COUNT_FALSE"
  7967. // "REDUCE_FRACTION_TRUE"
  7968. // "REDUCE_PERCENTILE_99"
  7969. // "REDUCE_PERCENTILE_95"
  7970. // "REDUCE_PERCENTILE_50"
  7971. // "REDUCE_PERCENTILE_05"
  7972. func (c *ProjectsTimeSeriesListCall) AggregationCrossSeriesReducer(aggregationCrossSeriesReducer string) *ProjectsTimeSeriesListCall {
  7973. c.urlParams_.Set("aggregation.crossSeriesReducer", aggregationCrossSeriesReducer)
  7974. return c
  7975. }
  7976. // AggregationGroupByFields sets the optional parameter
  7977. // "aggregation.groupByFields": The set of fields to preserve when
  7978. // crossSeriesReducer is specified. The groupByFields determine how the
  7979. // time series are partitioned into subsets prior to applying the
  7980. // aggregation function. Each subset contains time series that have the
  7981. // same value for each of the grouping fields. Each individual time
  7982. // series is a member of exactly one subset. The crossSeriesReducer is
  7983. // applied to each subset of time series. It is not possible to reduce
  7984. // across different resource types, so this field implicitly contains
  7985. // resource.type. Fields not specified in groupByFields are aggregated
  7986. // away. If groupByFields is not specified and all the time series have
  7987. // the same resource type, then the time series are aggregated into a
  7988. // single output time series. If crossSeriesReducer is not defined, this
  7989. // field is ignored.
  7990. func (c *ProjectsTimeSeriesListCall) AggregationGroupByFields(aggregationGroupByFields ...string) *ProjectsTimeSeriesListCall {
  7991. c.urlParams_.SetMulti("aggregation.groupByFields", append([]string{}, aggregationGroupByFields...))
  7992. return c
  7993. }
  7994. // AggregationPerSeriesAligner sets the optional parameter
  7995. // "aggregation.perSeriesAligner": The approach to be used to align
  7996. // individual time series. Not all alignment functions may be applied to
  7997. // all time series, depending on the metric type and value type of the
  7998. // original time series. Alignment may change the metric type or the
  7999. // value type of the time series.Time series data must be aligned in
  8000. // order to perform cross-time series reduction. If crossSeriesReducer
  8001. // is specified, then perSeriesAligner must be specified and not equal
  8002. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  8003. // is returned.
  8004. //
  8005. // Possible values:
  8006. // "ALIGN_NONE"
  8007. // "ALIGN_DELTA"
  8008. // "ALIGN_RATE"
  8009. // "ALIGN_INTERPOLATE"
  8010. // "ALIGN_NEXT_OLDER"
  8011. // "ALIGN_MIN"
  8012. // "ALIGN_MAX"
  8013. // "ALIGN_MEAN"
  8014. // "ALIGN_COUNT"
  8015. // "ALIGN_SUM"
  8016. // "ALIGN_STDDEV"
  8017. // "ALIGN_COUNT_TRUE"
  8018. // "ALIGN_COUNT_FALSE"
  8019. // "ALIGN_FRACTION_TRUE"
  8020. // "ALIGN_PERCENTILE_99"
  8021. // "ALIGN_PERCENTILE_95"
  8022. // "ALIGN_PERCENTILE_50"
  8023. // "ALIGN_PERCENTILE_05"
  8024. // "ALIGN_PERCENT_CHANGE"
  8025. func (c *ProjectsTimeSeriesListCall) AggregationPerSeriesAligner(aggregationPerSeriesAligner string) *ProjectsTimeSeriesListCall {
  8026. c.urlParams_.Set("aggregation.perSeriesAligner", aggregationPerSeriesAligner)
  8027. return c
  8028. }
  8029. // Filter sets the optional parameter "filter": A monitoring filter that
  8030. // specifies which time series should be returned. The filter must
  8031. // specify a single metric type, and can additionally specify metric
  8032. // labels and other information. For example:
  8033. // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
  8034. // metric.label.instance_name = "my-instance-name"
  8035. func (c *ProjectsTimeSeriesListCall) Filter(filter string) *ProjectsTimeSeriesListCall {
  8036. c.urlParams_.Set("filter", filter)
  8037. return c
  8038. }
  8039. // IntervalEndTime sets the optional parameter "interval.endTime":
  8040. // Required. The end of the time interval.
  8041. func (c *ProjectsTimeSeriesListCall) IntervalEndTime(intervalEndTime string) *ProjectsTimeSeriesListCall {
  8042. c.urlParams_.Set("interval.endTime", intervalEndTime)
  8043. return c
  8044. }
  8045. // IntervalStartTime sets the optional parameter "interval.startTime":
  8046. // The beginning of the time interval. The default value for the start
  8047. // time is the end time. The start time must not be later than the end
  8048. // time.
  8049. func (c *ProjectsTimeSeriesListCall) IntervalStartTime(intervalStartTime string) *ProjectsTimeSeriesListCall {
  8050. c.urlParams_.Set("interval.startTime", intervalStartTime)
  8051. return c
  8052. }
  8053. // OrderBy sets the optional parameter "orderBy": Unsupported: must be
  8054. // left blank. The points in each time series are returned in reverse
  8055. // time order.
  8056. func (c *ProjectsTimeSeriesListCall) OrderBy(orderBy string) *ProjectsTimeSeriesListCall {
  8057. c.urlParams_.Set("orderBy", orderBy)
  8058. return c
  8059. }
  8060. // PageSize sets the optional parameter "pageSize": A positive number
  8061. // that is the maximum number of results to return. If page_size is
  8062. // empty or more than 100,000 results, the effective page_size is
  8063. // 100,000 results. If view is set to FULL, this is the maximum number
  8064. // of Points returned. If view is set to HEADERS, this is the maximum
  8065. // number of TimeSeries returned.
  8066. func (c *ProjectsTimeSeriesListCall) PageSize(pageSize int64) *ProjectsTimeSeriesListCall {
  8067. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8068. return c
  8069. }
  8070. // PageToken sets the optional parameter "pageToken": If this field is
  8071. // not empty then it must contain the nextPageToken value returned by a
  8072. // previous call to this method. Using this field causes the method to
  8073. // return additional results from the previous method call.
  8074. func (c *ProjectsTimeSeriesListCall) PageToken(pageToken string) *ProjectsTimeSeriesListCall {
  8075. c.urlParams_.Set("pageToken", pageToken)
  8076. return c
  8077. }
  8078. // View sets the optional parameter "view": Specifies which information
  8079. // is returned about the time series.
  8080. //
  8081. // Possible values:
  8082. // "FULL"
  8083. // "HEADERS"
  8084. func (c *ProjectsTimeSeriesListCall) View(view string) *ProjectsTimeSeriesListCall {
  8085. c.urlParams_.Set("view", view)
  8086. return c
  8087. }
  8088. // Fields allows partial responses to be retrieved. See
  8089. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8090. // for more information.
  8091. func (c *ProjectsTimeSeriesListCall) Fields(s ...googleapi.Field) *ProjectsTimeSeriesListCall {
  8092. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8093. return c
  8094. }
  8095. // IfNoneMatch sets the optional parameter which makes the operation
  8096. // fail if the object's ETag matches the given value. This is useful for
  8097. // getting updates only after the object has changed since the last
  8098. // request. Use googleapi.IsNotModified to check whether the response
  8099. // error from Do is the result of In-None-Match.
  8100. func (c *ProjectsTimeSeriesListCall) IfNoneMatch(entityTag string) *ProjectsTimeSeriesListCall {
  8101. c.ifNoneMatch_ = entityTag
  8102. return c
  8103. }
  8104. // Context sets the context to be used in this call's Do method. Any
  8105. // pending HTTP request will be aborted if the provided context is
  8106. // canceled.
  8107. func (c *ProjectsTimeSeriesListCall) Context(ctx context.Context) *ProjectsTimeSeriesListCall {
  8108. c.ctx_ = ctx
  8109. return c
  8110. }
  8111. // Header returns an http.Header that can be modified by the caller to
  8112. // add HTTP headers to the request.
  8113. func (c *ProjectsTimeSeriesListCall) Header() http.Header {
  8114. if c.header_ == nil {
  8115. c.header_ = make(http.Header)
  8116. }
  8117. return c.header_
  8118. }
  8119. func (c *ProjectsTimeSeriesListCall) doRequest(alt string) (*http.Response, error) {
  8120. reqHeaders := make(http.Header)
  8121. for k, v := range c.header_ {
  8122. reqHeaders[k] = v
  8123. }
  8124. reqHeaders.Set("User-Agent", c.s.userAgent())
  8125. if c.ifNoneMatch_ != "" {
  8126. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8127. }
  8128. var body io.Reader = nil
  8129. c.urlParams_.Set("alt", alt)
  8130. c.urlParams_.Set("prettyPrint", "false")
  8131. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/timeSeries")
  8132. urls += "?" + c.urlParams_.Encode()
  8133. req, err := http.NewRequest("GET", urls, body)
  8134. if err != nil {
  8135. return nil, err
  8136. }
  8137. req.Header = reqHeaders
  8138. googleapi.Expand(req.URL, map[string]string{
  8139. "name": c.name,
  8140. })
  8141. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8142. }
  8143. // Do executes the "monitoring.projects.timeSeries.list" call.
  8144. // Exactly one of *ListTimeSeriesResponse or error will be non-nil. Any
  8145. // non-2xx status code is an error. Response headers are in either
  8146. // *ListTimeSeriesResponse.ServerResponse.Header or (if a response was
  8147. // returned at all) in error.(*googleapi.Error).Header. Use
  8148. // googleapi.IsNotModified to check whether the returned error was
  8149. // because http.StatusNotModified was returned.
  8150. func (c *ProjectsTimeSeriesListCall) Do(opts ...googleapi.CallOption) (*ListTimeSeriesResponse, error) {
  8151. gensupport.SetOptions(c.urlParams_, opts...)
  8152. res, err := c.doRequest("json")
  8153. if res != nil && res.StatusCode == http.StatusNotModified {
  8154. if res.Body != nil {
  8155. res.Body.Close()
  8156. }
  8157. return nil, &googleapi.Error{
  8158. Code: res.StatusCode,
  8159. Header: res.Header,
  8160. }
  8161. }
  8162. if err != nil {
  8163. return nil, err
  8164. }
  8165. defer googleapi.CloseBody(res)
  8166. if err := googleapi.CheckResponse(res); err != nil {
  8167. return nil, err
  8168. }
  8169. ret := &ListTimeSeriesResponse{
  8170. ServerResponse: googleapi.ServerResponse{
  8171. Header: res.Header,
  8172. HTTPStatusCode: res.StatusCode,
  8173. },
  8174. }
  8175. target := &ret
  8176. if err := gensupport.DecodeResponse(target, res); err != nil {
  8177. return nil, err
  8178. }
  8179. return ret, nil
  8180. // {
  8181. // "description": "Lists time series that match a filter. This method does not require a Stackdriver account.",
  8182. // "flatPath": "v3/projects/{projectsId}/timeSeries",
  8183. // "httpMethod": "GET",
  8184. // "id": "monitoring.projects.timeSeries.list",
  8185. // "parameterOrder": [
  8186. // "name"
  8187. // ],
  8188. // "parameters": {
  8189. // "aggregation.alignmentPeriod": {
  8190. // "description": "The alignment period for per-time series alignment. If present, alignmentPeriod must be at least 60 seconds. After per-time series alignment, each time series will contain data points only on the period boundaries. If perSeriesAligner is not specified or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then this field must be defined; otherwise an error is returned.",
  8191. // "format": "google-duration",
  8192. // "location": "query",
  8193. // "type": "string"
  8194. // },
  8195. // "aggregation.crossSeriesReducer": {
  8196. // "description": "The approach to be used to combine time series. Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series. Reduction may change the metric type of value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned.",
  8197. // "enum": [
  8198. // "REDUCE_NONE",
  8199. // "REDUCE_MEAN",
  8200. // "REDUCE_MIN",
  8201. // "REDUCE_MAX",
  8202. // "REDUCE_SUM",
  8203. // "REDUCE_STDDEV",
  8204. // "REDUCE_COUNT",
  8205. // "REDUCE_COUNT_TRUE",
  8206. // "REDUCE_COUNT_FALSE",
  8207. // "REDUCE_FRACTION_TRUE",
  8208. // "REDUCE_PERCENTILE_99",
  8209. // "REDUCE_PERCENTILE_95",
  8210. // "REDUCE_PERCENTILE_50",
  8211. // "REDUCE_PERCENTILE_05"
  8212. // ],
  8213. // "location": "query",
  8214. // "type": "string"
  8215. // },
  8216. // "aggregation.groupByFields": {
  8217. // "description": "The set of fields to preserve when crossSeriesReducer is specified. The groupByFields determine how the time series are partitioned into subsets prior to applying the aggregation function. Each subset contains time series that have the same value for each of the grouping fields. Each individual time series is a member of exactly one subset. The crossSeriesReducer is applied to each subset of time series. It is not possible to reduce across different resource types, so this field implicitly contains resource.type. Fields not specified in groupByFields are aggregated away. If groupByFields is not specified and all the time series have the same resource type, then the time series are aggregated into a single output time series. If crossSeriesReducer is not defined, this field is ignored.",
  8218. // "location": "query",
  8219. // "repeated": true,
  8220. // "type": "string"
  8221. // },
  8222. // "aggregation.perSeriesAligner": {
  8223. // "description": "The approach to be used to align individual time series. Not all alignment functions may be applied to all time series, depending on the metric type and value type of the original time series. Alignment may change the metric type or the value type of the time series.Time series data must be aligned in order to perform cross-time series reduction. If crossSeriesReducer is specified, then perSeriesAligner must be specified and not equal ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error is returned.",
  8224. // "enum": [
  8225. // "ALIGN_NONE",
  8226. // "ALIGN_DELTA",
  8227. // "ALIGN_RATE",
  8228. // "ALIGN_INTERPOLATE",
  8229. // "ALIGN_NEXT_OLDER",
  8230. // "ALIGN_MIN",
  8231. // "ALIGN_MAX",
  8232. // "ALIGN_MEAN",
  8233. // "ALIGN_COUNT",
  8234. // "ALIGN_SUM",
  8235. // "ALIGN_STDDEV",
  8236. // "ALIGN_COUNT_TRUE",
  8237. // "ALIGN_COUNT_FALSE",
  8238. // "ALIGN_FRACTION_TRUE",
  8239. // "ALIGN_PERCENTILE_99",
  8240. // "ALIGN_PERCENTILE_95",
  8241. // "ALIGN_PERCENTILE_50",
  8242. // "ALIGN_PERCENTILE_05",
  8243. // "ALIGN_PERCENT_CHANGE"
  8244. // ],
  8245. // "location": "query",
  8246. // "type": "string"
  8247. // },
  8248. // "filter": {
  8249. // "description": "A monitoring filter that specifies which time series should be returned. The filter must specify a single metric type, and can additionally specify metric labels and other information. For example:\nmetric.type = \"compute.googleapis.com/instance/cpu/usage_time\" AND\n metric.label.instance_name = \"my-instance-name\"\n",
  8250. // "location": "query",
  8251. // "type": "string"
  8252. // },
  8253. // "interval.endTime": {
  8254. // "description": "Required. The end of the time interval.",
  8255. // "format": "google-datetime",
  8256. // "location": "query",
  8257. // "type": "string"
  8258. // },
  8259. // "interval.startTime": {
  8260. // "description": "Optional. The beginning of the time interval. The default value for the start time is the end time. The start time must not be later than the end time.",
  8261. // "format": "google-datetime",
  8262. // "location": "query",
  8263. // "type": "string"
  8264. // },
  8265. // "name": {
  8266. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  8267. // "location": "path",
  8268. // "pattern": "^projects/[^/]+$",
  8269. // "required": true,
  8270. // "type": "string"
  8271. // },
  8272. // "orderBy": {
  8273. // "description": "Unsupported: must be left blank. The points in each time series are returned in reverse time order.",
  8274. // "location": "query",
  8275. // "type": "string"
  8276. // },
  8277. // "pageSize": {
  8278. // "description": "A positive number that is the maximum number of results to return. If page_size is empty or more than 100,000 results, the effective page_size is 100,000 results. If view is set to FULL, this is the maximum number of Points returned. If view is set to HEADERS, this is the maximum number of TimeSeries returned.",
  8279. // "format": "int32",
  8280. // "location": "query",
  8281. // "type": "integer"
  8282. // },
  8283. // "pageToken": {
  8284. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return additional results from the previous method call.",
  8285. // "location": "query",
  8286. // "type": "string"
  8287. // },
  8288. // "view": {
  8289. // "description": "Specifies which information is returned about the time series.",
  8290. // "enum": [
  8291. // "FULL",
  8292. // "HEADERS"
  8293. // ],
  8294. // "location": "query",
  8295. // "type": "string"
  8296. // }
  8297. // },
  8298. // "path": "v3/{+name}/timeSeries",
  8299. // "response": {
  8300. // "$ref": "ListTimeSeriesResponse"
  8301. // },
  8302. // "scopes": [
  8303. // "https://www.googleapis.com/auth/cloud-platform",
  8304. // "https://www.googleapis.com/auth/monitoring",
  8305. // "https://www.googleapis.com/auth/monitoring.read"
  8306. // ]
  8307. // }
  8308. }
  8309. // Pages invokes f for each page of results.
  8310. // A non-nil error returned from f will halt the iteration.
  8311. // The provided context supersedes any context provided to the Context method.
  8312. func (c *ProjectsTimeSeriesListCall) Pages(ctx context.Context, f func(*ListTimeSeriesResponse) error) error {
  8313. c.ctx_ = ctx
  8314. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8315. for {
  8316. x, err := c.Do()
  8317. if err != nil {
  8318. return err
  8319. }
  8320. if err := f(x); err != nil {
  8321. return err
  8322. }
  8323. if x.NextPageToken == "" {
  8324. return nil
  8325. }
  8326. c.PageToken(x.NextPageToken)
  8327. }
  8328. }
  8329. // method id "monitoring.projects.uptimeCheckConfigs.create":
  8330. type ProjectsUptimeCheckConfigsCreateCall struct {
  8331. s *Service
  8332. parent string
  8333. uptimecheckconfig *UptimeCheckConfig
  8334. urlParams_ gensupport.URLParams
  8335. ctx_ context.Context
  8336. header_ http.Header
  8337. }
  8338. // Create: Creates a new uptime check configuration.
  8339. func (r *ProjectsUptimeCheckConfigsService) Create(parent string, uptimecheckconfig *UptimeCheckConfig) *ProjectsUptimeCheckConfigsCreateCall {
  8340. c := &ProjectsUptimeCheckConfigsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8341. c.parent = parent
  8342. c.uptimecheckconfig = uptimecheckconfig
  8343. return c
  8344. }
  8345. // Fields allows partial responses to be retrieved. See
  8346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8347. // for more information.
  8348. func (c *ProjectsUptimeCheckConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsCreateCall {
  8349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8350. return c
  8351. }
  8352. // Context sets the context to be used in this call's Do method. Any
  8353. // pending HTTP request will be aborted if the provided context is
  8354. // canceled.
  8355. func (c *ProjectsUptimeCheckConfigsCreateCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsCreateCall {
  8356. c.ctx_ = ctx
  8357. return c
  8358. }
  8359. // Header returns an http.Header that can be modified by the caller to
  8360. // add HTTP headers to the request.
  8361. func (c *ProjectsUptimeCheckConfigsCreateCall) Header() http.Header {
  8362. if c.header_ == nil {
  8363. c.header_ = make(http.Header)
  8364. }
  8365. return c.header_
  8366. }
  8367. func (c *ProjectsUptimeCheckConfigsCreateCall) doRequest(alt string) (*http.Response, error) {
  8368. reqHeaders := make(http.Header)
  8369. for k, v := range c.header_ {
  8370. reqHeaders[k] = v
  8371. }
  8372. reqHeaders.Set("User-Agent", c.s.userAgent())
  8373. var body io.Reader = nil
  8374. body, err := googleapi.WithoutDataWrapper.JSONReader(c.uptimecheckconfig)
  8375. if err != nil {
  8376. return nil, err
  8377. }
  8378. reqHeaders.Set("Content-Type", "application/json")
  8379. c.urlParams_.Set("alt", alt)
  8380. c.urlParams_.Set("prettyPrint", "false")
  8381. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/uptimeCheckConfigs")
  8382. urls += "?" + c.urlParams_.Encode()
  8383. req, err := http.NewRequest("POST", urls, body)
  8384. if err != nil {
  8385. return nil, err
  8386. }
  8387. req.Header = reqHeaders
  8388. googleapi.Expand(req.URL, map[string]string{
  8389. "parent": c.parent,
  8390. })
  8391. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8392. }
  8393. // Do executes the "monitoring.projects.uptimeCheckConfigs.create" call.
  8394. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  8395. // non-2xx status code is an error. Response headers are in either
  8396. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  8397. // returned at all) in error.(*googleapi.Error).Header. Use
  8398. // googleapi.IsNotModified to check whether the returned error was
  8399. // because http.StatusNotModified was returned.
  8400. func (c *ProjectsUptimeCheckConfigsCreateCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  8401. gensupport.SetOptions(c.urlParams_, opts...)
  8402. res, err := c.doRequest("json")
  8403. if res != nil && res.StatusCode == http.StatusNotModified {
  8404. if res.Body != nil {
  8405. res.Body.Close()
  8406. }
  8407. return nil, &googleapi.Error{
  8408. Code: res.StatusCode,
  8409. Header: res.Header,
  8410. }
  8411. }
  8412. if err != nil {
  8413. return nil, err
  8414. }
  8415. defer googleapi.CloseBody(res)
  8416. if err := googleapi.CheckResponse(res); err != nil {
  8417. return nil, err
  8418. }
  8419. ret := &UptimeCheckConfig{
  8420. ServerResponse: googleapi.ServerResponse{
  8421. Header: res.Header,
  8422. HTTPStatusCode: res.StatusCode,
  8423. },
  8424. }
  8425. target := &ret
  8426. if err := gensupport.DecodeResponse(target, res); err != nil {
  8427. return nil, err
  8428. }
  8429. return ret, nil
  8430. // {
  8431. // "description": "Creates a new uptime check configuration.",
  8432. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs",
  8433. // "httpMethod": "POST",
  8434. // "id": "monitoring.projects.uptimeCheckConfigs.create",
  8435. // "parameterOrder": [
  8436. // "parent"
  8437. // ],
  8438. // "parameters": {
  8439. // "parent": {
  8440. // "description": "The project in which to create the uptime check. The format is projects/[PROJECT_ID].",
  8441. // "location": "path",
  8442. // "pattern": "^projects/[^/]+$",
  8443. // "required": true,
  8444. // "type": "string"
  8445. // }
  8446. // },
  8447. // "path": "v3/{+parent}/uptimeCheckConfigs",
  8448. // "request": {
  8449. // "$ref": "UptimeCheckConfig"
  8450. // },
  8451. // "response": {
  8452. // "$ref": "UptimeCheckConfig"
  8453. // },
  8454. // "scopes": [
  8455. // "https://www.googleapis.com/auth/cloud-platform",
  8456. // "https://www.googleapis.com/auth/monitoring"
  8457. // ]
  8458. // }
  8459. }
  8460. // method id "monitoring.projects.uptimeCheckConfigs.delete":
  8461. type ProjectsUptimeCheckConfigsDeleteCall struct {
  8462. s *Service
  8463. name string
  8464. urlParams_ gensupport.URLParams
  8465. ctx_ context.Context
  8466. header_ http.Header
  8467. }
  8468. // Delete: Deletes an uptime check configuration. Note that this method
  8469. // will fail if the uptime check configuration is referenced by an alert
  8470. // policy or other dependent configs that would be rendered invalid by
  8471. // the deletion.
  8472. func (r *ProjectsUptimeCheckConfigsService) Delete(name string) *ProjectsUptimeCheckConfigsDeleteCall {
  8473. c := &ProjectsUptimeCheckConfigsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8474. c.name = name
  8475. return c
  8476. }
  8477. // Fields allows partial responses to be retrieved. See
  8478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8479. // for more information.
  8480. func (c *ProjectsUptimeCheckConfigsDeleteCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsDeleteCall {
  8481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8482. return c
  8483. }
  8484. // Context sets the context to be used in this call's Do method. Any
  8485. // pending HTTP request will be aborted if the provided context is
  8486. // canceled.
  8487. func (c *ProjectsUptimeCheckConfigsDeleteCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsDeleteCall {
  8488. c.ctx_ = ctx
  8489. return c
  8490. }
  8491. // Header returns an http.Header that can be modified by the caller to
  8492. // add HTTP headers to the request.
  8493. func (c *ProjectsUptimeCheckConfigsDeleteCall) Header() http.Header {
  8494. if c.header_ == nil {
  8495. c.header_ = make(http.Header)
  8496. }
  8497. return c.header_
  8498. }
  8499. func (c *ProjectsUptimeCheckConfigsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8500. reqHeaders := make(http.Header)
  8501. for k, v := range c.header_ {
  8502. reqHeaders[k] = v
  8503. }
  8504. reqHeaders.Set("User-Agent", c.s.userAgent())
  8505. var body io.Reader = nil
  8506. c.urlParams_.Set("alt", alt)
  8507. c.urlParams_.Set("prettyPrint", "false")
  8508. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8509. urls += "?" + c.urlParams_.Encode()
  8510. req, err := http.NewRequest("DELETE", urls, body)
  8511. if err != nil {
  8512. return nil, err
  8513. }
  8514. req.Header = reqHeaders
  8515. googleapi.Expand(req.URL, map[string]string{
  8516. "name": c.name,
  8517. })
  8518. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8519. }
  8520. // Do executes the "monitoring.projects.uptimeCheckConfigs.delete" call.
  8521. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8522. // code is an error. Response headers are in either
  8523. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8524. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8525. // check whether the returned error was because http.StatusNotModified
  8526. // was returned.
  8527. func (c *ProjectsUptimeCheckConfigsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8528. gensupport.SetOptions(c.urlParams_, opts...)
  8529. res, err := c.doRequest("json")
  8530. if res != nil && res.StatusCode == http.StatusNotModified {
  8531. if res.Body != nil {
  8532. res.Body.Close()
  8533. }
  8534. return nil, &googleapi.Error{
  8535. Code: res.StatusCode,
  8536. Header: res.Header,
  8537. }
  8538. }
  8539. if err != nil {
  8540. return nil, err
  8541. }
  8542. defer googleapi.CloseBody(res)
  8543. if err := googleapi.CheckResponse(res); err != nil {
  8544. return nil, err
  8545. }
  8546. ret := &Empty{
  8547. ServerResponse: googleapi.ServerResponse{
  8548. Header: res.Header,
  8549. HTTPStatusCode: res.StatusCode,
  8550. },
  8551. }
  8552. target := &ret
  8553. if err := gensupport.DecodeResponse(target, res); err != nil {
  8554. return nil, err
  8555. }
  8556. return ret, nil
  8557. // {
  8558. // "description": "Deletes an uptime check configuration. Note that this method will fail if the uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.",
  8559. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  8560. // "httpMethod": "DELETE",
  8561. // "id": "monitoring.projects.uptimeCheckConfigs.delete",
  8562. // "parameterOrder": [
  8563. // "name"
  8564. // ],
  8565. // "parameters": {
  8566. // "name": {
  8567. // "description": "The uptime check configuration to delete. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].",
  8568. // "location": "path",
  8569. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  8570. // "required": true,
  8571. // "type": "string"
  8572. // }
  8573. // },
  8574. // "path": "v3/{+name}",
  8575. // "response": {
  8576. // "$ref": "Empty"
  8577. // },
  8578. // "scopes": [
  8579. // "https://www.googleapis.com/auth/cloud-platform",
  8580. // "https://www.googleapis.com/auth/monitoring"
  8581. // ]
  8582. // }
  8583. }
  8584. // method id "monitoring.projects.uptimeCheckConfigs.get":
  8585. type ProjectsUptimeCheckConfigsGetCall struct {
  8586. s *Service
  8587. name string
  8588. urlParams_ gensupport.URLParams
  8589. ifNoneMatch_ string
  8590. ctx_ context.Context
  8591. header_ http.Header
  8592. }
  8593. // Get: Gets a single uptime check configuration.
  8594. func (r *ProjectsUptimeCheckConfigsService) Get(name string) *ProjectsUptimeCheckConfigsGetCall {
  8595. c := &ProjectsUptimeCheckConfigsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8596. c.name = name
  8597. return c
  8598. }
  8599. // Fields allows partial responses to be retrieved. See
  8600. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8601. // for more information.
  8602. func (c *ProjectsUptimeCheckConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsGetCall {
  8603. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8604. return c
  8605. }
  8606. // IfNoneMatch sets the optional parameter which makes the operation
  8607. // fail if the object's ETag matches the given value. This is useful for
  8608. // getting updates only after the object has changed since the last
  8609. // request. Use googleapi.IsNotModified to check whether the response
  8610. // error from Do is the result of In-None-Match.
  8611. func (c *ProjectsUptimeCheckConfigsGetCall) IfNoneMatch(entityTag string) *ProjectsUptimeCheckConfigsGetCall {
  8612. c.ifNoneMatch_ = entityTag
  8613. return c
  8614. }
  8615. // Context sets the context to be used in this call's Do method. Any
  8616. // pending HTTP request will be aborted if the provided context is
  8617. // canceled.
  8618. func (c *ProjectsUptimeCheckConfigsGetCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsGetCall {
  8619. c.ctx_ = ctx
  8620. return c
  8621. }
  8622. // Header returns an http.Header that can be modified by the caller to
  8623. // add HTTP headers to the request.
  8624. func (c *ProjectsUptimeCheckConfigsGetCall) Header() http.Header {
  8625. if c.header_ == nil {
  8626. c.header_ = make(http.Header)
  8627. }
  8628. return c.header_
  8629. }
  8630. func (c *ProjectsUptimeCheckConfigsGetCall) doRequest(alt string) (*http.Response, error) {
  8631. reqHeaders := make(http.Header)
  8632. for k, v := range c.header_ {
  8633. reqHeaders[k] = v
  8634. }
  8635. reqHeaders.Set("User-Agent", c.s.userAgent())
  8636. if c.ifNoneMatch_ != "" {
  8637. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8638. }
  8639. var body io.Reader = nil
  8640. c.urlParams_.Set("alt", alt)
  8641. c.urlParams_.Set("prettyPrint", "false")
  8642. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8643. urls += "?" + c.urlParams_.Encode()
  8644. req, err := http.NewRequest("GET", urls, body)
  8645. if err != nil {
  8646. return nil, err
  8647. }
  8648. req.Header = reqHeaders
  8649. googleapi.Expand(req.URL, map[string]string{
  8650. "name": c.name,
  8651. })
  8652. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8653. }
  8654. // Do executes the "monitoring.projects.uptimeCheckConfigs.get" call.
  8655. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  8656. // non-2xx status code is an error. Response headers are in either
  8657. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  8658. // returned at all) in error.(*googleapi.Error).Header. Use
  8659. // googleapi.IsNotModified to check whether the returned error was
  8660. // because http.StatusNotModified was returned.
  8661. func (c *ProjectsUptimeCheckConfigsGetCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  8662. gensupport.SetOptions(c.urlParams_, opts...)
  8663. res, err := c.doRequest("json")
  8664. if res != nil && res.StatusCode == http.StatusNotModified {
  8665. if res.Body != nil {
  8666. res.Body.Close()
  8667. }
  8668. return nil, &googleapi.Error{
  8669. Code: res.StatusCode,
  8670. Header: res.Header,
  8671. }
  8672. }
  8673. if err != nil {
  8674. return nil, err
  8675. }
  8676. defer googleapi.CloseBody(res)
  8677. if err := googleapi.CheckResponse(res); err != nil {
  8678. return nil, err
  8679. }
  8680. ret := &UptimeCheckConfig{
  8681. ServerResponse: googleapi.ServerResponse{
  8682. Header: res.Header,
  8683. HTTPStatusCode: res.StatusCode,
  8684. },
  8685. }
  8686. target := &ret
  8687. if err := gensupport.DecodeResponse(target, res); err != nil {
  8688. return nil, err
  8689. }
  8690. return ret, nil
  8691. // {
  8692. // "description": "Gets a single uptime check configuration.",
  8693. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  8694. // "httpMethod": "GET",
  8695. // "id": "monitoring.projects.uptimeCheckConfigs.get",
  8696. // "parameterOrder": [
  8697. // "name"
  8698. // ],
  8699. // "parameters": {
  8700. // "name": {
  8701. // "description": "The uptime check configuration to retrieve. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].",
  8702. // "location": "path",
  8703. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  8704. // "required": true,
  8705. // "type": "string"
  8706. // }
  8707. // },
  8708. // "path": "v3/{+name}",
  8709. // "response": {
  8710. // "$ref": "UptimeCheckConfig"
  8711. // },
  8712. // "scopes": [
  8713. // "https://www.googleapis.com/auth/cloud-platform",
  8714. // "https://www.googleapis.com/auth/monitoring",
  8715. // "https://www.googleapis.com/auth/monitoring.read"
  8716. // ]
  8717. // }
  8718. }
  8719. // method id "monitoring.projects.uptimeCheckConfigs.list":
  8720. type ProjectsUptimeCheckConfigsListCall struct {
  8721. s *Service
  8722. parent string
  8723. urlParams_ gensupport.URLParams
  8724. ifNoneMatch_ string
  8725. ctx_ context.Context
  8726. header_ http.Header
  8727. }
  8728. // List: Lists the existing valid uptime check configurations for the
  8729. // project, leaving out any invalid configurations.
  8730. func (r *ProjectsUptimeCheckConfigsService) List(parent string) *ProjectsUptimeCheckConfigsListCall {
  8731. c := &ProjectsUptimeCheckConfigsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8732. c.parent = parent
  8733. return c
  8734. }
  8735. // PageSize sets the optional parameter "pageSize": The maximum number
  8736. // of results to return in a single response. The server may further
  8737. // constrain the maximum number of results returned in a single page. If
  8738. // the page_size is <=0, the server will decide the number of results to
  8739. // be returned.
  8740. func (c *ProjectsUptimeCheckConfigsListCall) PageSize(pageSize int64) *ProjectsUptimeCheckConfigsListCall {
  8741. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8742. return c
  8743. }
  8744. // PageToken sets the optional parameter "pageToken": If this field is
  8745. // not empty then it must contain the nextPageToken value returned by a
  8746. // previous call to this method. Using this field causes the method to
  8747. // return more results from the previous method call.
  8748. func (c *ProjectsUptimeCheckConfigsListCall) PageToken(pageToken string) *ProjectsUptimeCheckConfigsListCall {
  8749. c.urlParams_.Set("pageToken", pageToken)
  8750. return c
  8751. }
  8752. // Fields allows partial responses to be retrieved. See
  8753. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8754. // for more information.
  8755. func (c *ProjectsUptimeCheckConfigsListCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsListCall {
  8756. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8757. return c
  8758. }
  8759. // IfNoneMatch sets the optional parameter which makes the operation
  8760. // fail if the object's ETag matches the given value. This is useful for
  8761. // getting updates only after the object has changed since the last
  8762. // request. Use googleapi.IsNotModified to check whether the response
  8763. // error from Do is the result of In-None-Match.
  8764. func (c *ProjectsUptimeCheckConfigsListCall) IfNoneMatch(entityTag string) *ProjectsUptimeCheckConfigsListCall {
  8765. c.ifNoneMatch_ = entityTag
  8766. return c
  8767. }
  8768. // Context sets the context to be used in this call's Do method. Any
  8769. // pending HTTP request will be aborted if the provided context is
  8770. // canceled.
  8771. func (c *ProjectsUptimeCheckConfigsListCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsListCall {
  8772. c.ctx_ = ctx
  8773. return c
  8774. }
  8775. // Header returns an http.Header that can be modified by the caller to
  8776. // add HTTP headers to the request.
  8777. func (c *ProjectsUptimeCheckConfigsListCall) Header() http.Header {
  8778. if c.header_ == nil {
  8779. c.header_ = make(http.Header)
  8780. }
  8781. return c.header_
  8782. }
  8783. func (c *ProjectsUptimeCheckConfigsListCall) doRequest(alt string) (*http.Response, error) {
  8784. reqHeaders := make(http.Header)
  8785. for k, v := range c.header_ {
  8786. reqHeaders[k] = v
  8787. }
  8788. reqHeaders.Set("User-Agent", c.s.userAgent())
  8789. if c.ifNoneMatch_ != "" {
  8790. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8791. }
  8792. var body io.Reader = nil
  8793. c.urlParams_.Set("alt", alt)
  8794. c.urlParams_.Set("prettyPrint", "false")
  8795. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/uptimeCheckConfigs")
  8796. urls += "?" + c.urlParams_.Encode()
  8797. req, err := http.NewRequest("GET", urls, body)
  8798. if err != nil {
  8799. return nil, err
  8800. }
  8801. req.Header = reqHeaders
  8802. googleapi.Expand(req.URL, map[string]string{
  8803. "parent": c.parent,
  8804. })
  8805. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8806. }
  8807. // Do executes the "monitoring.projects.uptimeCheckConfigs.list" call.
  8808. // Exactly one of *ListUptimeCheckConfigsResponse or error will be
  8809. // non-nil. Any non-2xx status code is an error. Response headers are in
  8810. // either *ListUptimeCheckConfigsResponse.ServerResponse.Header or (if a
  8811. // response was returned at all) in error.(*googleapi.Error).Header. Use
  8812. // googleapi.IsNotModified to check whether the returned error was
  8813. // because http.StatusNotModified was returned.
  8814. func (c *ProjectsUptimeCheckConfigsListCall) Do(opts ...googleapi.CallOption) (*ListUptimeCheckConfigsResponse, error) {
  8815. gensupport.SetOptions(c.urlParams_, opts...)
  8816. res, err := c.doRequest("json")
  8817. if res != nil && res.StatusCode == http.StatusNotModified {
  8818. if res.Body != nil {
  8819. res.Body.Close()
  8820. }
  8821. return nil, &googleapi.Error{
  8822. Code: res.StatusCode,
  8823. Header: res.Header,
  8824. }
  8825. }
  8826. if err != nil {
  8827. return nil, err
  8828. }
  8829. defer googleapi.CloseBody(res)
  8830. if err := googleapi.CheckResponse(res); err != nil {
  8831. return nil, err
  8832. }
  8833. ret := &ListUptimeCheckConfigsResponse{
  8834. ServerResponse: googleapi.ServerResponse{
  8835. Header: res.Header,
  8836. HTTPStatusCode: res.StatusCode,
  8837. },
  8838. }
  8839. target := &ret
  8840. if err := gensupport.DecodeResponse(target, res); err != nil {
  8841. return nil, err
  8842. }
  8843. return ret, nil
  8844. // {
  8845. // "description": "Lists the existing valid uptime check configurations for the project, leaving out any invalid configurations.",
  8846. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs",
  8847. // "httpMethod": "GET",
  8848. // "id": "monitoring.projects.uptimeCheckConfigs.list",
  8849. // "parameterOrder": [
  8850. // "parent"
  8851. // ],
  8852. // "parameters": {
  8853. // "pageSize": {
  8854. // "description": "The maximum number of results to return in a single response. The server may further constrain the maximum number of results returned in a single page. If the page_size is \u003c=0, the server will decide the number of results to be returned.",
  8855. // "format": "int32",
  8856. // "location": "query",
  8857. // "type": "integer"
  8858. // },
  8859. // "pageToken": {
  8860. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return more results from the previous method call.",
  8861. // "location": "query",
  8862. // "type": "string"
  8863. // },
  8864. // "parent": {
  8865. // "description": "The project whose uptime check configurations are listed. The format is projects/[PROJECT_ID].",
  8866. // "location": "path",
  8867. // "pattern": "^projects/[^/]+$",
  8868. // "required": true,
  8869. // "type": "string"
  8870. // }
  8871. // },
  8872. // "path": "v3/{+parent}/uptimeCheckConfigs",
  8873. // "response": {
  8874. // "$ref": "ListUptimeCheckConfigsResponse"
  8875. // },
  8876. // "scopes": [
  8877. // "https://www.googleapis.com/auth/cloud-platform",
  8878. // "https://www.googleapis.com/auth/monitoring",
  8879. // "https://www.googleapis.com/auth/monitoring.read"
  8880. // ]
  8881. // }
  8882. }
  8883. // Pages invokes f for each page of results.
  8884. // A non-nil error returned from f will halt the iteration.
  8885. // The provided context supersedes any context provided to the Context method.
  8886. func (c *ProjectsUptimeCheckConfigsListCall) Pages(ctx context.Context, f func(*ListUptimeCheckConfigsResponse) error) error {
  8887. c.ctx_ = ctx
  8888. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8889. for {
  8890. x, err := c.Do()
  8891. if err != nil {
  8892. return err
  8893. }
  8894. if err := f(x); err != nil {
  8895. return err
  8896. }
  8897. if x.NextPageToken == "" {
  8898. return nil
  8899. }
  8900. c.PageToken(x.NextPageToken)
  8901. }
  8902. }
  8903. // method id "monitoring.projects.uptimeCheckConfigs.patch":
  8904. type ProjectsUptimeCheckConfigsPatchCall struct {
  8905. s *Service
  8906. name string
  8907. uptimecheckconfig *UptimeCheckConfig
  8908. urlParams_ gensupport.URLParams
  8909. ctx_ context.Context
  8910. header_ http.Header
  8911. }
  8912. // Patch: Updates an uptime check configuration. You can either replace
  8913. // the entire configuration with a new one or replace only certain
  8914. // fields in the current configuration by specifying the fields to be
  8915. // updated via "updateMask". Returns the updated configuration.
  8916. func (r *ProjectsUptimeCheckConfigsService) Patch(name string, uptimecheckconfig *UptimeCheckConfig) *ProjectsUptimeCheckConfigsPatchCall {
  8917. c := &ProjectsUptimeCheckConfigsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8918. c.name = name
  8919. c.uptimecheckconfig = uptimecheckconfig
  8920. return c
  8921. }
  8922. // UpdateMask sets the optional parameter "updateMask": If present, only
  8923. // the listed fields in the current uptime check configuration are
  8924. // updated with values from the new configuration. If this field is
  8925. // empty, then the current configuration is completely replaced with the
  8926. // new configuration.
  8927. func (c *ProjectsUptimeCheckConfigsPatchCall) UpdateMask(updateMask string) *ProjectsUptimeCheckConfigsPatchCall {
  8928. c.urlParams_.Set("updateMask", updateMask)
  8929. return c
  8930. }
  8931. // Fields allows partial responses to be retrieved. See
  8932. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8933. // for more information.
  8934. func (c *ProjectsUptimeCheckConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsPatchCall {
  8935. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8936. return c
  8937. }
  8938. // Context sets the context to be used in this call's Do method. Any
  8939. // pending HTTP request will be aborted if the provided context is
  8940. // canceled.
  8941. func (c *ProjectsUptimeCheckConfigsPatchCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsPatchCall {
  8942. c.ctx_ = ctx
  8943. return c
  8944. }
  8945. // Header returns an http.Header that can be modified by the caller to
  8946. // add HTTP headers to the request.
  8947. func (c *ProjectsUptimeCheckConfigsPatchCall) Header() http.Header {
  8948. if c.header_ == nil {
  8949. c.header_ = make(http.Header)
  8950. }
  8951. return c.header_
  8952. }
  8953. func (c *ProjectsUptimeCheckConfigsPatchCall) doRequest(alt string) (*http.Response, error) {
  8954. reqHeaders := make(http.Header)
  8955. for k, v := range c.header_ {
  8956. reqHeaders[k] = v
  8957. }
  8958. reqHeaders.Set("User-Agent", c.s.userAgent())
  8959. var body io.Reader = nil
  8960. body, err := googleapi.WithoutDataWrapper.JSONReader(c.uptimecheckconfig)
  8961. if err != nil {
  8962. return nil, err
  8963. }
  8964. reqHeaders.Set("Content-Type", "application/json")
  8965. c.urlParams_.Set("alt", alt)
  8966. c.urlParams_.Set("prettyPrint", "false")
  8967. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8968. urls += "?" + c.urlParams_.Encode()
  8969. req, err := http.NewRequest("PATCH", urls, body)
  8970. if err != nil {
  8971. return nil, err
  8972. }
  8973. req.Header = reqHeaders
  8974. googleapi.Expand(req.URL, map[string]string{
  8975. "name": c.name,
  8976. })
  8977. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8978. }
  8979. // Do executes the "monitoring.projects.uptimeCheckConfigs.patch" call.
  8980. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  8981. // non-2xx status code is an error. Response headers are in either
  8982. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  8983. // returned at all) in error.(*googleapi.Error).Header. Use
  8984. // googleapi.IsNotModified to check whether the returned error was
  8985. // because http.StatusNotModified was returned.
  8986. func (c *ProjectsUptimeCheckConfigsPatchCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  8987. gensupport.SetOptions(c.urlParams_, opts...)
  8988. res, err := c.doRequest("json")
  8989. if res != nil && res.StatusCode == http.StatusNotModified {
  8990. if res.Body != nil {
  8991. res.Body.Close()
  8992. }
  8993. return nil, &googleapi.Error{
  8994. Code: res.StatusCode,
  8995. Header: res.Header,
  8996. }
  8997. }
  8998. if err != nil {
  8999. return nil, err
  9000. }
  9001. defer googleapi.CloseBody(res)
  9002. if err := googleapi.CheckResponse(res); err != nil {
  9003. return nil, err
  9004. }
  9005. ret := &UptimeCheckConfig{
  9006. ServerResponse: googleapi.ServerResponse{
  9007. Header: res.Header,
  9008. HTTPStatusCode: res.StatusCode,
  9009. },
  9010. }
  9011. target := &ret
  9012. if err := gensupport.DecodeResponse(target, res); err != nil {
  9013. return nil, err
  9014. }
  9015. return ret, nil
  9016. // {
  9017. // "description": "Updates an uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via \"updateMask\". Returns the updated configuration.",
  9018. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  9019. // "httpMethod": "PATCH",
  9020. // "id": "monitoring.projects.uptimeCheckConfigs.patch",
  9021. // "parameterOrder": [
  9022. // "name"
  9023. // ],
  9024. // "parameters": {
  9025. // "name": {
  9026. // "description": "A unique resource name for this UptimeCheckConfig. The format is:projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].This field should be omitted when creating the uptime check configuration; on create, the resource name is assigned by the server and included in the response.",
  9027. // "location": "path",
  9028. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  9029. // "required": true,
  9030. // "type": "string"
  9031. // },
  9032. // "updateMask": {
  9033. // "description": "Optional. If present, only the listed fields in the current uptime check configuration are updated with values from the new configuration. If this field is empty, then the current configuration is completely replaced with the new configuration.",
  9034. // "format": "google-fieldmask",
  9035. // "location": "query",
  9036. // "type": "string"
  9037. // }
  9038. // },
  9039. // "path": "v3/{+name}",
  9040. // "request": {
  9041. // "$ref": "UptimeCheckConfig"
  9042. // },
  9043. // "response": {
  9044. // "$ref": "UptimeCheckConfig"
  9045. // },
  9046. // "scopes": [
  9047. // "https://www.googleapis.com/auth/cloud-platform",
  9048. // "https://www.googleapis.com/auth/monitoring"
  9049. // ]
  9050. // }
  9051. }
  9052. // method id "monitoring.uptimeCheckIps.list":
  9053. type UptimeCheckIpsListCall struct {
  9054. s *Service
  9055. urlParams_ gensupport.URLParams
  9056. ifNoneMatch_ string
  9057. ctx_ context.Context
  9058. header_ http.Header
  9059. }
  9060. // List: Returns the list of IPs that checkers run from
  9061. func (r *UptimeCheckIpsService) List() *UptimeCheckIpsListCall {
  9062. c := &UptimeCheckIpsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9063. return c
  9064. }
  9065. // PageSize sets the optional parameter "pageSize": The maximum number
  9066. // of results to return in a single response. The server may further
  9067. // constrain the maximum number of results returned in a single page. If
  9068. // the page_size is <=0, the server will decide the number of results to
  9069. // be returned. NOTE: this field is not yet implemented
  9070. func (c *UptimeCheckIpsListCall) PageSize(pageSize int64) *UptimeCheckIpsListCall {
  9071. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  9072. return c
  9073. }
  9074. // PageToken sets the optional parameter "pageToken": If this field is
  9075. // not empty then it must contain the nextPageToken value returned by a
  9076. // previous call to this method. Using this field causes the method to
  9077. // return more results from the previous method call. NOTE: this field
  9078. // is not yet implemented
  9079. func (c *UptimeCheckIpsListCall) PageToken(pageToken string) *UptimeCheckIpsListCall {
  9080. c.urlParams_.Set("pageToken", pageToken)
  9081. return c
  9082. }
  9083. // Fields allows partial responses to be retrieved. See
  9084. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9085. // for more information.
  9086. func (c *UptimeCheckIpsListCall) Fields(s ...googleapi.Field) *UptimeCheckIpsListCall {
  9087. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9088. return c
  9089. }
  9090. // IfNoneMatch sets the optional parameter which makes the operation
  9091. // fail if the object's ETag matches the given value. This is useful for
  9092. // getting updates only after the object has changed since the last
  9093. // request. Use googleapi.IsNotModified to check whether the response
  9094. // error from Do is the result of In-None-Match.
  9095. func (c *UptimeCheckIpsListCall) IfNoneMatch(entityTag string) *UptimeCheckIpsListCall {
  9096. c.ifNoneMatch_ = entityTag
  9097. return c
  9098. }
  9099. // Context sets the context to be used in this call's Do method. Any
  9100. // pending HTTP request will be aborted if the provided context is
  9101. // canceled.
  9102. func (c *UptimeCheckIpsListCall) Context(ctx context.Context) *UptimeCheckIpsListCall {
  9103. c.ctx_ = ctx
  9104. return c
  9105. }
  9106. // Header returns an http.Header that can be modified by the caller to
  9107. // add HTTP headers to the request.
  9108. func (c *UptimeCheckIpsListCall) Header() http.Header {
  9109. if c.header_ == nil {
  9110. c.header_ = make(http.Header)
  9111. }
  9112. return c.header_
  9113. }
  9114. func (c *UptimeCheckIpsListCall) doRequest(alt string) (*http.Response, error) {
  9115. reqHeaders := make(http.Header)
  9116. for k, v := range c.header_ {
  9117. reqHeaders[k] = v
  9118. }
  9119. reqHeaders.Set("User-Agent", c.s.userAgent())
  9120. if c.ifNoneMatch_ != "" {
  9121. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9122. }
  9123. var body io.Reader = nil
  9124. c.urlParams_.Set("alt", alt)
  9125. c.urlParams_.Set("prettyPrint", "false")
  9126. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/uptimeCheckIps")
  9127. urls += "?" + c.urlParams_.Encode()
  9128. req, err := http.NewRequest("GET", urls, body)
  9129. if err != nil {
  9130. return nil, err
  9131. }
  9132. req.Header = reqHeaders
  9133. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9134. }
  9135. // Do executes the "monitoring.uptimeCheckIps.list" call.
  9136. // Exactly one of *ListUptimeCheckIpsResponse or error will be non-nil.
  9137. // Any non-2xx status code is an error. Response headers are in either
  9138. // *ListUptimeCheckIpsResponse.ServerResponse.Header or (if a response
  9139. // was returned at all) in error.(*googleapi.Error).Header. Use
  9140. // googleapi.IsNotModified to check whether the returned error was
  9141. // because http.StatusNotModified was returned.
  9142. func (c *UptimeCheckIpsListCall) Do(opts ...googleapi.CallOption) (*ListUptimeCheckIpsResponse, error) {
  9143. gensupport.SetOptions(c.urlParams_, opts...)
  9144. res, err := c.doRequest("json")
  9145. if res != nil && res.StatusCode == http.StatusNotModified {
  9146. if res.Body != nil {
  9147. res.Body.Close()
  9148. }
  9149. return nil, &googleapi.Error{
  9150. Code: res.StatusCode,
  9151. Header: res.Header,
  9152. }
  9153. }
  9154. if err != nil {
  9155. return nil, err
  9156. }
  9157. defer googleapi.CloseBody(res)
  9158. if err := googleapi.CheckResponse(res); err != nil {
  9159. return nil, err
  9160. }
  9161. ret := &ListUptimeCheckIpsResponse{
  9162. ServerResponse: googleapi.ServerResponse{
  9163. Header: res.Header,
  9164. HTTPStatusCode: res.StatusCode,
  9165. },
  9166. }
  9167. target := &ret
  9168. if err := gensupport.DecodeResponse(target, res); err != nil {
  9169. return nil, err
  9170. }
  9171. return ret, nil
  9172. // {
  9173. // "description": "Returns the list of IPs that checkers run from",
  9174. // "flatPath": "v3/uptimeCheckIps",
  9175. // "httpMethod": "GET",
  9176. // "id": "monitoring.uptimeCheckIps.list",
  9177. // "parameterOrder": [],
  9178. // "parameters": {
  9179. // "pageSize": {
  9180. // "description": "The maximum number of results to return in a single response. The server may further constrain the maximum number of results returned in a single page. If the page_size is \u003c=0, the server will decide the number of results to be returned. NOTE: this field is not yet implemented",
  9181. // "format": "int32",
  9182. // "location": "query",
  9183. // "type": "integer"
  9184. // },
  9185. // "pageToken": {
  9186. // "description": "If this field is not empty then it must contain the nextPageToken value returned by a previous call to this method. Using this field causes the method to return more results from the previous method call. NOTE: this field is not yet implemented",
  9187. // "location": "query",
  9188. // "type": "string"
  9189. // }
  9190. // },
  9191. // "path": "v3/uptimeCheckIps",
  9192. // "response": {
  9193. // "$ref": "ListUptimeCheckIpsResponse"
  9194. // },
  9195. // "scopes": [
  9196. // "https://www.googleapis.com/auth/cloud-platform",
  9197. // "https://www.googleapis.com/auth/monitoring",
  9198. // "https://www.googleapis.com/auth/monitoring.read"
  9199. // ]
  9200. // }
  9201. }
  9202. // Pages invokes f for each page of results.
  9203. // A non-nil error returned from f will halt the iteration.
  9204. // The provided context supersedes any context provided to the Context method.
  9205. func (c *UptimeCheckIpsListCall) Pages(ctx context.Context, f func(*ListUptimeCheckIpsResponse) error) error {
  9206. c.ctx_ = ctx
  9207. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9208. for {
  9209. x, err := c.Do()
  9210. if err != nil {
  9211. return err
  9212. }
  9213. if err := f(x); err != nil {
  9214. return err
  9215. }
  9216. if x.NextPageToken == "" {
  9217. return nil
  9218. }
  9219. c.PageToken(x.NextPageToken)
  9220. }
  9221. }