Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

9661 righe
381 KiB

  1. // Package monitoring provides access to the Stackdriver Monitoring API.
  2. //
  3. // See https://cloud.google.com/monitoring/api/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/monitoring/v3"
  8. // ...
  9. // monitoringService, err := monitoring.New(oauthHttpClient)
  10. package monitoring // import "google.golang.org/api/monitoring/v3"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "monitoring:v3"
  41. const apiName = "monitoring"
  42. const apiVersion = "v3"
  43. const basePath = "https://monitoring.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // View and write monitoring data for all of your Google and third-party
  49. // Cloud and API projects
  50. MonitoringScope = "https://www.googleapis.com/auth/monitoring"
  51. // View monitoring data for all of your Google Cloud and third-party
  52. // projects
  53. MonitoringReadScope = "https://www.googleapis.com/auth/monitoring.read"
  54. // Publish metric data to your Google Cloud projects
  55. MonitoringWriteScope = "https://www.googleapis.com/auth/monitoring.write"
  56. )
  57. func New(client *http.Client) (*Service, error) {
  58. if client == nil {
  59. return nil, errors.New("client is nil")
  60. }
  61. s := &Service{client: client, BasePath: basePath}
  62. s.Projects = NewProjectsService(s)
  63. s.UptimeCheckIps = NewUptimeCheckIpsService(s)
  64. return s, nil
  65. }
  66. type Service struct {
  67. client *http.Client
  68. BasePath string // API endpoint base URL
  69. UserAgent string // optional additional User-Agent fragment
  70. Projects *ProjectsService
  71. UptimeCheckIps *UptimeCheckIpsService
  72. }
  73. func (s *Service) userAgent() string {
  74. if s.UserAgent == "" {
  75. return googleapi.UserAgent
  76. }
  77. return googleapi.UserAgent + " " + s.UserAgent
  78. }
  79. func NewProjectsService(s *Service) *ProjectsService {
  80. rs := &ProjectsService{s: s}
  81. rs.AlertPolicies = NewProjectsAlertPoliciesService(s)
  82. rs.CollectdTimeSeries = NewProjectsCollectdTimeSeriesService(s)
  83. rs.Groups = NewProjectsGroupsService(s)
  84. rs.MetricDescriptors = NewProjectsMetricDescriptorsService(s)
  85. rs.MonitoredResourceDescriptors = NewProjectsMonitoredResourceDescriptorsService(s)
  86. rs.NotificationChannelDescriptors = NewProjectsNotificationChannelDescriptorsService(s)
  87. rs.NotificationChannels = NewProjectsNotificationChannelsService(s)
  88. rs.TimeSeries = NewProjectsTimeSeriesService(s)
  89. rs.UptimeCheckConfigs = NewProjectsUptimeCheckConfigsService(s)
  90. return rs
  91. }
  92. type ProjectsService struct {
  93. s *Service
  94. AlertPolicies *ProjectsAlertPoliciesService
  95. CollectdTimeSeries *ProjectsCollectdTimeSeriesService
  96. Groups *ProjectsGroupsService
  97. MetricDescriptors *ProjectsMetricDescriptorsService
  98. MonitoredResourceDescriptors *ProjectsMonitoredResourceDescriptorsService
  99. NotificationChannelDescriptors *ProjectsNotificationChannelDescriptorsService
  100. NotificationChannels *ProjectsNotificationChannelsService
  101. TimeSeries *ProjectsTimeSeriesService
  102. UptimeCheckConfigs *ProjectsUptimeCheckConfigsService
  103. }
  104. func NewProjectsAlertPoliciesService(s *Service) *ProjectsAlertPoliciesService {
  105. rs := &ProjectsAlertPoliciesService{s: s}
  106. return rs
  107. }
  108. type ProjectsAlertPoliciesService struct {
  109. s *Service
  110. }
  111. func NewProjectsCollectdTimeSeriesService(s *Service) *ProjectsCollectdTimeSeriesService {
  112. rs := &ProjectsCollectdTimeSeriesService{s: s}
  113. return rs
  114. }
  115. type ProjectsCollectdTimeSeriesService struct {
  116. s *Service
  117. }
  118. func NewProjectsGroupsService(s *Service) *ProjectsGroupsService {
  119. rs := &ProjectsGroupsService{s: s}
  120. rs.Members = NewProjectsGroupsMembersService(s)
  121. return rs
  122. }
  123. type ProjectsGroupsService struct {
  124. s *Service
  125. Members *ProjectsGroupsMembersService
  126. }
  127. func NewProjectsGroupsMembersService(s *Service) *ProjectsGroupsMembersService {
  128. rs := &ProjectsGroupsMembersService{s: s}
  129. return rs
  130. }
  131. type ProjectsGroupsMembersService struct {
  132. s *Service
  133. }
  134. func NewProjectsMetricDescriptorsService(s *Service) *ProjectsMetricDescriptorsService {
  135. rs := &ProjectsMetricDescriptorsService{s: s}
  136. return rs
  137. }
  138. type ProjectsMetricDescriptorsService struct {
  139. s *Service
  140. }
  141. func NewProjectsMonitoredResourceDescriptorsService(s *Service) *ProjectsMonitoredResourceDescriptorsService {
  142. rs := &ProjectsMonitoredResourceDescriptorsService{s: s}
  143. return rs
  144. }
  145. type ProjectsMonitoredResourceDescriptorsService struct {
  146. s *Service
  147. }
  148. func NewProjectsNotificationChannelDescriptorsService(s *Service) *ProjectsNotificationChannelDescriptorsService {
  149. rs := &ProjectsNotificationChannelDescriptorsService{s: s}
  150. return rs
  151. }
  152. type ProjectsNotificationChannelDescriptorsService struct {
  153. s *Service
  154. }
  155. func NewProjectsNotificationChannelsService(s *Service) *ProjectsNotificationChannelsService {
  156. rs := &ProjectsNotificationChannelsService{s: s}
  157. return rs
  158. }
  159. type ProjectsNotificationChannelsService struct {
  160. s *Service
  161. }
  162. func NewProjectsTimeSeriesService(s *Service) *ProjectsTimeSeriesService {
  163. rs := &ProjectsTimeSeriesService{s: s}
  164. return rs
  165. }
  166. type ProjectsTimeSeriesService struct {
  167. s *Service
  168. }
  169. func NewProjectsUptimeCheckConfigsService(s *Service) *ProjectsUptimeCheckConfigsService {
  170. rs := &ProjectsUptimeCheckConfigsService{s: s}
  171. return rs
  172. }
  173. type ProjectsUptimeCheckConfigsService struct {
  174. s *Service
  175. }
  176. func NewUptimeCheckIpsService(s *Service) *UptimeCheckIpsService {
  177. rs := &UptimeCheckIpsService{s: s}
  178. return rs
  179. }
  180. type UptimeCheckIpsService struct {
  181. s *Service
  182. }
  183. // Aggregation: Describes how to combine multiple time series to provide
  184. // different views of the data. Aggregation consists of an alignment
  185. // step on individual time series (alignment_period and
  186. // per_series_aligner) followed by an optional reduction step of the
  187. // data across the aligned time series (cross_series_reducer and
  188. // group_by_fields). For more details, see Aggregation.
  189. type Aggregation struct {
  190. // AlignmentPeriod: The alignment period for per-time series alignment.
  191. // If present, alignmentPeriod must be at least 60 seconds. After
  192. // per-time series alignment, each time series will contain data points
  193. // only on the period boundaries. If perSeriesAligner is not specified
  194. // or equals ALIGN_NONE, then this field is ignored. If perSeriesAligner
  195. // is specified and does not equal ALIGN_NONE, then this field must be
  196. // defined; otherwise an error is returned.
  197. AlignmentPeriod string `json:"alignmentPeriod,omitempty"`
  198. // CrossSeriesReducer: The approach to be used to combine time series.
  199. // Not all reducer functions may be applied to all time series,
  200. // depending on the metric type and the value type of the original time
  201. // series. Reduction may change the metric type of value type of the
  202. // time series.Time series data must be aligned in order to perform
  203. // cross-time series reduction. If crossSeriesReducer is specified, then
  204. // perSeriesAligner must be specified and not equal ALIGN_NONE and
  205. // alignmentPeriod must be specified; otherwise, an error is returned.
  206. //
  207. // Possible values:
  208. // "REDUCE_NONE" - No cross-time series reduction. The output of the
  209. // aligner is returned.
  210. // "REDUCE_MEAN" - Reduce by computing the mean across time series for
  211. // each alignment period. This reducer is valid for delta and gauge
  212. // metrics with numeric or distribution values. The value type of the
  213. // output is DOUBLE.
  214. // "REDUCE_MIN" - Reduce by computing the minimum across time series
  215. // for each alignment period. This reducer is valid for delta and gauge
  216. // metrics with numeric values. The value type of the output is the same
  217. // as the value type of the input.
  218. // "REDUCE_MAX" - Reduce by computing the maximum across time series
  219. // for each alignment period. This reducer is valid for delta and gauge
  220. // metrics with numeric values. The value type of the output is the same
  221. // as the value type of the input.
  222. // "REDUCE_SUM" - Reduce by computing the sum across time series for
  223. // each alignment period. This reducer is valid for delta and gauge
  224. // metrics with numeric and distribution values. The value type of the
  225. // output is the same as the value type of the input.
  226. // "REDUCE_STDDEV" - Reduce by computing the standard deviation across
  227. // time series for each alignment period. This reducer is valid for
  228. // delta and gauge metrics with numeric or distribution values. The
  229. // value type of the output is DOUBLE.
  230. // "REDUCE_COUNT" - Reduce by computing the count of data points
  231. // across time series for each alignment period. This reducer is valid
  232. // for delta and gauge metrics of numeric, Boolean, distribution, and
  233. // string value type. The value type of the output is INT64.
  234. // "REDUCE_COUNT_TRUE" - Reduce by computing the count of True-valued
  235. // data points across time series for each alignment period. This
  236. // reducer is valid for delta and gauge metrics of Boolean value type.
  237. // The value type of the output is INT64.
  238. // "REDUCE_COUNT_FALSE" - Reduce by computing the count of
  239. // False-valued data points across time series for each alignment
  240. // period. This reducer is valid for delta and gauge metrics of Boolean
  241. // value type. The value type of the output is INT64.
  242. // "REDUCE_FRACTION_TRUE" - Reduce by computing the fraction of
  243. // True-valued data points across time series for each alignment period.
  244. // This reducer is valid for delta and gauge metrics of Boolean value
  245. // type. The output value is in the range 0, 1 and has value type
  246. // DOUBLE.
  247. // "REDUCE_PERCENTILE_99" - Reduce by computing 99th percentile of
  248. // data points across time series for each alignment period. This
  249. // reducer is valid for gauge and delta metrics of numeric and
  250. // distribution type. The value of the output is DOUBLE
  251. // "REDUCE_PERCENTILE_95" - Reduce by computing 95th percentile of
  252. // data points across time series for each alignment period. This
  253. // reducer is valid for gauge and delta metrics of numeric and
  254. // distribution type. The value of the output is DOUBLE
  255. // "REDUCE_PERCENTILE_50" - Reduce by computing 50th percentile of
  256. // data points across time series for each alignment period. This
  257. // reducer is valid for gauge and delta metrics of numeric and
  258. // distribution type. The value of the output is DOUBLE
  259. // "REDUCE_PERCENTILE_05" - Reduce by computing 5th percentile of data
  260. // points across time series for each alignment period. This reducer is
  261. // valid for gauge and delta metrics of numeric and distribution type.
  262. // The value of the output is DOUBLE
  263. CrossSeriesReducer string `json:"crossSeriesReducer,omitempty"`
  264. // GroupByFields: The set of fields to preserve when crossSeriesReducer
  265. // is specified. The groupByFields determine how the time series are
  266. // partitioned into subsets prior to applying the aggregation function.
  267. // Each subset contains time series that have the same value for each of
  268. // the grouping fields. Each individual time series is a member of
  269. // exactly one subset. The crossSeriesReducer is applied to each subset
  270. // of time series. It is not possible to reduce across different
  271. // resource types, so this field implicitly contains resource.type.
  272. // Fields not specified in groupByFields are aggregated away. If
  273. // groupByFields is not specified and all the time series have the same
  274. // resource type, then the time series are aggregated into a single
  275. // output time series. If crossSeriesReducer is not defined, this field
  276. // is ignored.
  277. GroupByFields []string `json:"groupByFields,omitempty"`
  278. // PerSeriesAligner: The approach to be used to align individual time
  279. // series. Not all alignment functions may be applied to all time
  280. // series, depending on the metric type and value type of the original
  281. // time series. Alignment may change the metric type or the value type
  282. // of the time series.Time series data must be aligned in order to
  283. // perform cross-time series reduction. If crossSeriesReducer is
  284. // specified, then perSeriesAligner must be specified and not equal
  285. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  286. // is returned.
  287. //
  288. // Possible values:
  289. // "ALIGN_NONE" - No alignment. Raw data is returned. Not valid if
  290. // cross-time series reduction is requested. The value type of the
  291. // result is the same as the value type of the input.
  292. // "ALIGN_DELTA" - Align and convert to delta metric type. This
  293. // alignment is valid for cumulative metrics and delta metrics. Aligning
  294. // an existing delta metric to a delta metric requires that the
  295. // alignment period be increased. The value type of the result is the
  296. // same as the value type of the input.One can think of this aligner as
  297. // a rate but without time units; that is, the output is conceptually
  298. // (second_point - first_point).
  299. // "ALIGN_RATE" - Align and convert to a rate. This alignment is valid
  300. // for cumulative metrics and delta metrics with numeric values. The
  301. // output is a gauge metric with value type DOUBLE.One can think of this
  302. // aligner as conceptually providing the slope of the line that passes
  303. // through the value at the start and end of the window. In other words,
  304. // this is conceptually ((y1 - y0)/(t1 - t0)), and the output unit is
  305. // one that has a "/time" dimension.If, by rate, you are looking for
  306. // percentage change, see the ALIGN_PERCENT_CHANGE aligner option.
  307. // "ALIGN_INTERPOLATE" - Align by interpolating between adjacent
  308. // points around the period boundary. This alignment is valid for gauge
  309. // metrics with numeric values. The value type of the result is the same
  310. // as the value type of the input.
  311. // "ALIGN_NEXT_OLDER" - Align by shifting the oldest data point before
  312. // the period boundary to the boundary. This alignment is valid for
  313. // gauge metrics. The value type of the result is the same as the value
  314. // type of the input.
  315. // "ALIGN_MIN" - Align time series via aggregation. The resulting data
  316. // point in the alignment period is the minimum of all data points in
  317. // the period. This alignment is valid for gauge and delta metrics with
  318. // numeric values. The value type of the result is the same as the value
  319. // type of the input.
  320. // "ALIGN_MAX" - Align time series via aggregation. The resulting data
  321. // point in the alignment period is the maximum of all data points in
  322. // the period. This alignment is valid for gauge and delta metrics with
  323. // numeric values. The value type of the result is the same as the value
  324. // type of the input.
  325. // "ALIGN_MEAN" - Align time series via aggregation. The resulting
  326. // data point in the alignment period is the average or arithmetic mean
  327. // of all data points in the period. This alignment is valid for gauge
  328. // and delta metrics with numeric values. The value type of the output
  329. // is DOUBLE.
  330. // "ALIGN_COUNT" - Align time series via aggregation. The resulting
  331. // data point in the alignment period is the count of all data points in
  332. // the period. This alignment is valid for gauge and delta metrics with
  333. // numeric or Boolean values. The value type of the output is INT64.
  334. // "ALIGN_SUM" - Align time series via aggregation. The resulting data
  335. // point in the alignment period is the sum of all data points in the
  336. // period. This alignment is valid for gauge and delta metrics with
  337. // numeric and distribution values. The value type of the output is the
  338. // same as the value type of the input.
  339. // "ALIGN_STDDEV" - Align time series via aggregation. The resulting
  340. // data point in the alignment period is the standard deviation of all
  341. // data points in the period. This alignment is valid for gauge and
  342. // delta metrics with numeric values. The value type of the output is
  343. // DOUBLE.
  344. // "ALIGN_COUNT_TRUE" - Align time series via aggregation. The
  345. // resulting data point in the alignment period is the count of
  346. // True-valued data points in the period. This alignment is valid for
  347. // gauge metrics with Boolean values. The value type of the output is
  348. // INT64.
  349. // "ALIGN_COUNT_FALSE" - Align time series via aggregation. The
  350. // resulting data point in the alignment period is the count of
  351. // False-valued data points in the period. This alignment is valid for
  352. // gauge metrics with Boolean values. The value type of the output is
  353. // INT64.
  354. // "ALIGN_FRACTION_TRUE" - Align time series via aggregation. The
  355. // resulting data point in the alignment period is the fraction of
  356. // True-valued data points in the period. This alignment is valid for
  357. // gauge metrics with Boolean values. The output value is in the range
  358. // 0, 1 and has value type DOUBLE.
  359. // "ALIGN_PERCENTILE_99" - Align time series via aggregation. The
  360. // resulting data point in the alignment period is the 99th percentile
  361. // of all data points in the period. This alignment is valid for gauge
  362. // and delta metrics with distribution values. The output is a gauge
  363. // metric with value type DOUBLE.
  364. // "ALIGN_PERCENTILE_95" - Align time series via aggregation. The
  365. // resulting data point in the alignment period is the 95th percentile
  366. // of all data points in the period. This alignment is valid for gauge
  367. // and delta metrics with distribution values. The output is a gauge
  368. // metric with value type DOUBLE.
  369. // "ALIGN_PERCENTILE_50" - Align time series via aggregation. The
  370. // resulting data point in the alignment period is the 50th percentile
  371. // of all data points in the period. This alignment is valid for gauge
  372. // and delta metrics with distribution values. The output is a gauge
  373. // metric with value type DOUBLE.
  374. // "ALIGN_PERCENTILE_05" - Align time series via aggregation. The
  375. // resulting data point in the alignment period is the 5th percentile of
  376. // all data points in the period. This alignment is valid for gauge and
  377. // delta metrics with distribution values. The output is a gauge metric
  378. // with value type DOUBLE.
  379. // "ALIGN_PERCENT_CHANGE" - Align and convert to a percentage change.
  380. // This alignment is valid for gauge and delta metrics with numeric
  381. // values. This alignment conceptually computes the equivalent of
  382. // "((current - previous)/previous)*100" where previous value is
  383. // determined based on the alignmentPeriod. In the event that previous
  384. // is 0 the calculated value is infinity with the exception that if both
  385. // (current - previous) and previous are 0 the calculated value is 0. A
  386. // 10 minute moving mean is computed at each point of the time window
  387. // prior to the above calculation to smooth the metric and prevent false
  388. // positives from very short lived spikes. Only applicable for data that
  389. // is >= 0. Any values < 0 are treated as no data. While delta metrics
  390. // are accepted by this alignment special care should be taken that the
  391. // values for the metric will always be positive. The output is a gauge
  392. // metric with value type DOUBLE.
  393. PerSeriesAligner string `json:"perSeriesAligner,omitempty"`
  394. // ForceSendFields is a list of field names (e.g. "AlignmentPeriod") to
  395. // unconditionally include in API requests. By default, fields with
  396. // empty values are omitted from API requests. However, any non-pointer,
  397. // non-interface field appearing in ForceSendFields will be sent to the
  398. // server regardless of whether the field is empty or not. This may be
  399. // used to include empty fields in Patch requests.
  400. ForceSendFields []string `json:"-"`
  401. // NullFields is a list of field names (e.g. "AlignmentPeriod") to
  402. // include in API requests with the JSON null value. By default, fields
  403. // with empty values are omitted from API requests. However, any field
  404. // with an empty value appearing in NullFields will be sent to the
  405. // server as null. It is an error if a field in this list has a
  406. // non-empty value. This may be used to include null fields in Patch
  407. // requests.
  408. NullFields []string `json:"-"`
  409. }
  410. func (s *Aggregation) MarshalJSON() ([]byte, error) {
  411. type NoMethod Aggregation
  412. raw := NoMethod(*s)
  413. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  414. }
  415. // AlertPolicy: A description of the conditions under which some aspect
  416. // of your system is considered to be "unhealthy" and the ways to notify
  417. // people or services about this state. For an overview of alert
  418. // policies, see Introduction to Alerting.
  419. type AlertPolicy struct {
  420. // Combiner: How to combine the results of multiple conditions to
  421. // determine if an incident should be opened.
  422. //
  423. // Possible values:
  424. // "COMBINE_UNSPECIFIED" - An unspecified combiner.
  425. // "AND" - Combine conditions using the logical AND operator. An
  426. // incident is created only if all conditions are met simultaneously.
  427. // This combiner is satisfied if all conditions are met, even if they
  428. // are met on completely different resources.
  429. // "OR" - Combine conditions using the logical OR operator. An
  430. // incident is created if any of the listed conditions is met.
  431. // "AND_WITH_MATCHING_RESOURCE" - Combine conditions using logical AND
  432. // operator, but unlike the regular AND option, an incident is created
  433. // only if all conditions are met simultaneously on at least one
  434. // resource.
  435. Combiner string `json:"combiner,omitempty"`
  436. // Conditions: A list of conditions for the policy. The conditions are
  437. // combined by AND or OR according to the combiner field. If the
  438. // combined conditions evaluate to true, then an incident is created. A
  439. // policy can have from one to six conditions.
  440. Conditions []*Condition `json:"conditions,omitempty"`
  441. // CreationRecord: A read-only record of the creation of the alerting
  442. // policy. If provided in a call to create or update, this field will be
  443. // ignored.
  444. CreationRecord *MutationRecord `json:"creationRecord,omitempty"`
  445. // DisplayName: A short name or phrase used to identify the policy in
  446. // dashboards, notifications, and incidents. To avoid confusion, don't
  447. // use the same display name for multiple policies in the same project.
  448. // The name is limited to 512 Unicode characters.
  449. DisplayName string `json:"displayName,omitempty"`
  450. // Documentation: Documentation that is included with notifications and
  451. // incidents related to this policy. Best practice is for the
  452. // documentation to include information to help responders understand,
  453. // mitigate, escalate, and correct the underlying problems detected by
  454. // the alerting policy. Notification channels that have limited capacity
  455. // might not show this documentation.
  456. Documentation *Documentation `json:"documentation,omitempty"`
  457. // Enabled: Whether or not the policy is enabled. On write, the default
  458. // interpretation if unset is that the policy is enabled. On read,
  459. // clients should not make any assumption about the state if it has not
  460. // been populated. The field should always be populated on List and Get
  461. // operations, unless a field projection has been specified that strips
  462. // it out.
  463. Enabled bool `json:"enabled,omitempty"`
  464. // MutationRecord: A read-only record of the most recent change to the
  465. // alerting policy. If provided in a call to create or update, this
  466. // field will be ignored.
  467. MutationRecord *MutationRecord `json:"mutationRecord,omitempty"`
  468. // Name: Required if the policy exists. The resource name for this
  469. // policy. The syntax
  470. // is:
  471. // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
  472. // [ALERT_POLIC
  473. // Y_ID] is assigned by Stackdriver Monitoring when the policy is
  474. // created. When calling the alertPolicies.create method, do not include
  475. // the name field in the alerting policy passed as part of the request.
  476. Name string `json:"name,omitempty"`
  477. // NotificationChannels: Identifies the notification channels to which
  478. // notifications should be sent when incidents are opened or closed or
  479. // when new violations occur on an already opened incident. Each element
  480. // of this array corresponds to the name field in each of the
  481. // NotificationChannel objects that are returned from the
  482. // ListNotificationChannels method. The syntax of the entries in this
  483. // field is:
  484. // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
  485. //
  486. NotificationChannels []string `json:"notificationChannels,omitempty"`
  487. // UserLabels: User-supplied key/value data to be used for organizing
  488. // and identifying the AlertPolicy objects.The field can contain up to
  489. // 64 entries. Each key and value is limited to 63 Unicode characters or
  490. // 128 bytes, whichever is smaller. Labels and values can contain only
  491. // lowercase letters, numerals, underscores, and dashes. Keys must begin
  492. // with a letter.
  493. UserLabels map[string]string `json:"userLabels,omitempty"`
  494. // ServerResponse contains the HTTP response code and headers from the
  495. // server.
  496. googleapi.ServerResponse `json:"-"`
  497. // ForceSendFields is a list of field names (e.g. "Combiner") to
  498. // unconditionally include in API requests. By default, fields with
  499. // empty values are omitted from API requests. However, any non-pointer,
  500. // non-interface field appearing in ForceSendFields will be sent to the
  501. // server regardless of whether the field is empty or not. This may be
  502. // used to include empty fields in Patch requests.
  503. ForceSendFields []string `json:"-"`
  504. // NullFields is a list of field names (e.g. "Combiner") to include in
  505. // API requests with the JSON null value. By default, fields with empty
  506. // values are omitted from API requests. However, any field with an
  507. // empty value appearing in NullFields will be sent to the server as
  508. // null. It is an error if a field in this list has a non-empty value.
  509. // This may be used to include null fields in Patch requests.
  510. NullFields []string `json:"-"`
  511. }
  512. func (s *AlertPolicy) MarshalJSON() ([]byte, error) {
  513. type NoMethod AlertPolicy
  514. raw := NoMethod(*s)
  515. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  516. }
  517. // BasicAuthentication: A type of authentication to perform against the
  518. // specified resource or URL that uses username and password. Currently,
  519. // only Basic authentication is supported in Uptime Monitoring.
  520. type BasicAuthentication struct {
  521. // Password: The password to authenticate.
  522. Password string `json:"password,omitempty"`
  523. // Username: The username to authenticate.
  524. Username string `json:"username,omitempty"`
  525. // ForceSendFields is a list of field names (e.g. "Password") to
  526. // unconditionally include in API requests. By default, fields with
  527. // empty values are omitted from API requests. However, any non-pointer,
  528. // non-interface field appearing in ForceSendFields will be sent to the
  529. // server regardless of whether the field is empty or not. This may be
  530. // used to include empty fields in Patch requests.
  531. ForceSendFields []string `json:"-"`
  532. // NullFields is a list of field names (e.g. "Password") to include in
  533. // API requests with the JSON null value. By default, fields with empty
  534. // values are omitted from API requests. However, any field with an
  535. // empty value appearing in NullFields will be sent to the server as
  536. // null. It is an error if a field in this list has a non-empty value.
  537. // This may be used to include null fields in Patch requests.
  538. NullFields []string `json:"-"`
  539. }
  540. func (s *BasicAuthentication) MarshalJSON() ([]byte, error) {
  541. type NoMethod BasicAuthentication
  542. raw := NoMethod(*s)
  543. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  544. }
  545. // BucketOptions: BucketOptions describes the bucket boundaries used to
  546. // create a histogram for the distribution. The buckets can be in a
  547. // linear sequence, an exponential sequence, or each bucket can be
  548. // specified explicitly. BucketOptions does not include the number of
  549. // values in each bucket.A bucket has an inclusive lower bound and
  550. // exclusive upper bound for the values that are counted for that
  551. // bucket. The upper bound of a bucket must be strictly greater than the
  552. // lower bound. The sequence of N buckets for a distribution consists of
  553. // an underflow bucket (number 0), zero or more finite buckets (number 1
  554. // through N - 2) and an overflow bucket (number N - 1). The buckets are
  555. // contiguous: the lower bound of bucket i (i > 0) is the same as the
  556. // upper bound of bucket i - 1. The buckets span the whole range of
  557. // finite values: lower bound of the underflow bucket is -infinity and
  558. // the upper bound of the overflow bucket is +infinity. The finite
  559. // buckets are so-called because both bounds are finite.
  560. type BucketOptions struct {
  561. // ExplicitBuckets: The explicit buckets.
  562. ExplicitBuckets *Explicit `json:"explicitBuckets,omitempty"`
  563. // ExponentialBuckets: The exponential buckets.
  564. ExponentialBuckets *Exponential `json:"exponentialBuckets,omitempty"`
  565. // LinearBuckets: The linear bucket.
  566. LinearBuckets *Linear `json:"linearBuckets,omitempty"`
  567. // ForceSendFields is a list of field names (e.g. "ExplicitBuckets") to
  568. // unconditionally include in API requests. By default, fields with
  569. // empty values are omitted from API requests. However, any non-pointer,
  570. // non-interface field appearing in ForceSendFields will be sent to the
  571. // server regardless of whether the field is empty or not. This may be
  572. // used to include empty fields in Patch requests.
  573. ForceSendFields []string `json:"-"`
  574. // NullFields is a list of field names (e.g. "ExplicitBuckets") to
  575. // include in API requests with the JSON null value. By default, fields
  576. // with empty values are omitted from API requests. However, any field
  577. // with an empty value appearing in NullFields will be sent to the
  578. // server as null. It is an error if a field in this list has a
  579. // non-empty value. This may be used to include null fields in Patch
  580. // requests.
  581. NullFields []string `json:"-"`
  582. }
  583. func (s *BucketOptions) MarshalJSON() ([]byte, error) {
  584. type NoMethod BucketOptions
  585. raw := NoMethod(*s)
  586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  587. }
  588. // CollectdPayload: A collection of data points sent from a
  589. // collectd-based plugin. See the collectd documentation for more
  590. // information.
  591. type CollectdPayload struct {
  592. // EndTime: The end time of the interval.
  593. EndTime string `json:"endTime,omitempty"`
  594. // Metadata: The measurement metadata. Example: "process_id" -> 12345
  595. Metadata map[string]TypedValue `json:"metadata,omitempty"`
  596. // Plugin: The name of the plugin. Example: "disk".
  597. Plugin string `json:"plugin,omitempty"`
  598. // PluginInstance: The instance name of the plugin Example: "hdcl".
  599. PluginInstance string `json:"pluginInstance,omitempty"`
  600. // StartTime: The start time of the interval.
  601. StartTime string `json:"startTime,omitempty"`
  602. // Type: The measurement type. Example: "memory".
  603. Type string `json:"type,omitempty"`
  604. // TypeInstance: The measurement type instance. Example: "used".
  605. TypeInstance string `json:"typeInstance,omitempty"`
  606. // Values: The measured values during this time interval. Each value
  607. // must have a different dataSourceName.
  608. Values []*CollectdValue `json:"values,omitempty"`
  609. // ForceSendFields is a list of field names (e.g. "EndTime") to
  610. // unconditionally include in API requests. By default, fields with
  611. // empty values are omitted from API requests. However, any non-pointer,
  612. // non-interface field appearing in ForceSendFields will be sent to the
  613. // server regardless of whether the field is empty or not. This may be
  614. // used to include empty fields in Patch requests.
  615. ForceSendFields []string `json:"-"`
  616. // NullFields is a list of field names (e.g. "EndTime") to include in
  617. // API requests with the JSON null value. By default, fields with empty
  618. // values are omitted from API requests. However, any field with an
  619. // empty value appearing in NullFields will be sent to the server as
  620. // null. It is an error if a field in this list has a non-empty value.
  621. // This may be used to include null fields in Patch requests.
  622. NullFields []string `json:"-"`
  623. }
  624. func (s *CollectdPayload) MarshalJSON() ([]byte, error) {
  625. type NoMethod CollectdPayload
  626. raw := NoMethod(*s)
  627. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  628. }
  629. // CollectdPayloadError: Describes the error status for payloads that
  630. // were not written.
  631. type CollectdPayloadError struct {
  632. // Error: Records the error status for the payload. If this field is
  633. // present, the partial errors for nested values won't be populated.
  634. Error *Status `json:"error,omitempty"`
  635. // Index: The zero-based index in
  636. // CreateCollectdTimeSeriesRequest.collectd_payloads.
  637. Index int64 `json:"index,omitempty"`
  638. // ValueErrors: Records the error status for values that were not
  639. // written due to an error.Failed payloads for which nothing is written
  640. // will not include partial value errors.
  641. ValueErrors []*CollectdValueError `json:"valueErrors,omitempty"`
  642. // ForceSendFields is a list of field names (e.g. "Error") to
  643. // unconditionally include in API requests. By default, fields with
  644. // empty values are omitted from API requests. However, any non-pointer,
  645. // non-interface field appearing in ForceSendFields will be sent to the
  646. // server regardless of whether the field is empty or not. This may be
  647. // used to include empty fields in Patch requests.
  648. ForceSendFields []string `json:"-"`
  649. // NullFields is a list of field names (e.g. "Error") to include in API
  650. // requests with the JSON null value. By default, fields with empty
  651. // values are omitted from API requests. However, any field with an
  652. // empty value appearing in NullFields will be sent to the server as
  653. // null. It is an error if a field in this list has a non-empty value.
  654. // This may be used to include null fields in Patch requests.
  655. NullFields []string `json:"-"`
  656. }
  657. func (s *CollectdPayloadError) MarshalJSON() ([]byte, error) {
  658. type NoMethod CollectdPayloadError
  659. raw := NoMethod(*s)
  660. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  661. }
  662. // CollectdValue: A single data point from a collectd-based plugin.
  663. type CollectdValue struct {
  664. // DataSourceName: The data source for the collectd value. For example
  665. // there are two data sources for network measurements: "rx" and "tx".
  666. DataSourceName string `json:"dataSourceName,omitempty"`
  667. // DataSourceType: The type of measurement.
  668. //
  669. // Possible values:
  670. // "UNSPECIFIED_DATA_SOURCE_TYPE" - An unspecified data source type.
  671. // This corresponds to
  672. // google.api.MetricDescriptor.MetricKind.METRIC_KIND_UNSPECIFIED.
  673. // "GAUGE" - An instantaneous measurement of a varying quantity. This
  674. // corresponds to google.api.MetricDescriptor.MetricKind.GAUGE.
  675. // "COUNTER" - A cumulative value over time. This corresponds to
  676. // google.api.MetricDescriptor.MetricKind.CUMULATIVE.
  677. // "DERIVE" - A rate of change of the measurement.
  678. // "ABSOLUTE" - An amount of change since the last measurement
  679. // interval. This corresponds to
  680. // google.api.MetricDescriptor.MetricKind.DELTA.
  681. DataSourceType string `json:"dataSourceType,omitempty"`
  682. // Value: The measurement value.
  683. Value *TypedValue `json:"value,omitempty"`
  684. // ForceSendFields is a list of field names (e.g. "DataSourceName") to
  685. // unconditionally include in API requests. By default, fields with
  686. // empty values are omitted from API requests. However, any non-pointer,
  687. // non-interface field appearing in ForceSendFields will be sent to the
  688. // server regardless of whether the field is empty or not. This may be
  689. // used to include empty fields in Patch requests.
  690. ForceSendFields []string `json:"-"`
  691. // NullFields is a list of field names (e.g. "DataSourceName") to
  692. // include in API requests with the JSON null value. By default, fields
  693. // with empty values are omitted from API requests. However, any field
  694. // with an empty value appearing in NullFields will be sent to the
  695. // server as null. It is an error if a field in this list has a
  696. // non-empty value. This may be used to include null fields in Patch
  697. // requests.
  698. NullFields []string `json:"-"`
  699. }
  700. func (s *CollectdValue) MarshalJSON() ([]byte, error) {
  701. type NoMethod CollectdValue
  702. raw := NoMethod(*s)
  703. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  704. }
  705. // CollectdValueError: Describes the error status for values that were
  706. // not written.
  707. type CollectdValueError struct {
  708. // Error: Records the error status for the value.
  709. Error *Status `json:"error,omitempty"`
  710. // Index: The zero-based index in CollectdPayload.values within the
  711. // parent CreateCollectdTimeSeriesRequest.collectd_payloads.
  712. Index int64 `json:"index,omitempty"`
  713. // ForceSendFields is a list of field names (e.g. "Error") to
  714. // unconditionally include in API requests. By default, fields with
  715. // empty values are omitted from API requests. However, any non-pointer,
  716. // non-interface field appearing in ForceSendFields will be sent to the
  717. // server regardless of whether the field is empty or not. This may be
  718. // used to include empty fields in Patch requests.
  719. ForceSendFields []string `json:"-"`
  720. // NullFields is a list of field names (e.g. "Error") to include in API
  721. // requests with the JSON null value. By default, fields with empty
  722. // values are omitted from API requests. However, any field with an
  723. // empty value appearing in NullFields will be sent to the server as
  724. // null. It is an error if a field in this list has a non-empty value.
  725. // This may be used to include null fields in Patch requests.
  726. NullFields []string `json:"-"`
  727. }
  728. func (s *CollectdValueError) MarshalJSON() ([]byte, error) {
  729. type NoMethod CollectdValueError
  730. raw := NoMethod(*s)
  731. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  732. }
  733. // Condition: A condition is a true/false test that determines when an
  734. // alerting policy should open an incident. If a condition evaluates to
  735. // true, it signifies that something is wrong.
  736. type Condition struct {
  737. // ConditionAbsent: A condition that checks that a time series continues
  738. // to receive new data points.
  739. ConditionAbsent *MetricAbsence `json:"conditionAbsent,omitempty"`
  740. // ConditionThreshold: A condition that compares a time series against a
  741. // threshold.
  742. ConditionThreshold *MetricThreshold `json:"conditionThreshold,omitempty"`
  743. // DisplayName: A short name or phrase used to identify the condition in
  744. // dashboards, notifications, and incidents. To avoid confusion, don't
  745. // use the same display name for multiple conditions in the same policy.
  746. DisplayName string `json:"displayName,omitempty"`
  747. // Name: Required if the condition exists. The unique resource name for
  748. // this condition. Its syntax
  749. // is:
  750. // projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDIT
  751. // ION_ID]
  752. // [CONDITION_ID] is assigned by Stackdriver Monitoring when the
  753. // condition is created as part of a new or updated alerting policy.When
  754. // calling the alertPolicies.create method, do not include the name
  755. // field in the conditions of the requested alerting policy. Stackdriver
  756. // Monitoring creates the condition identifiers and includes them in the
  757. // new policy.When calling the alertPolicies.update method to update a
  758. // policy, including a condition name causes the existing condition to
  759. // be updated. Conditions without names are added to the updated policy.
  760. // Existing conditions are deleted if they are not updated.Best practice
  761. // is to preserve [CONDITION_ID] if you make only small changes, such as
  762. // those to condition thresholds, durations, or trigger values.
  763. // Otherwise, treat the change as a new condition and let the existing
  764. // condition be deleted.
  765. Name string `json:"name,omitempty"`
  766. // ForceSendFields is a list of field names (e.g. "ConditionAbsent") to
  767. // unconditionally include in API requests. By default, fields with
  768. // empty values are omitted from API requests. However, any non-pointer,
  769. // non-interface field appearing in ForceSendFields will be sent to the
  770. // server regardless of whether the field is empty or not. This may be
  771. // used to include empty fields in Patch requests.
  772. ForceSendFields []string `json:"-"`
  773. // NullFields is a list of field names (e.g. "ConditionAbsent") to
  774. // include in API requests with the JSON null value. By default, fields
  775. // with empty values are omitted from API requests. However, any field
  776. // with an empty value appearing in NullFields will be sent to the
  777. // server as null. It is an error if a field in this list has a
  778. // non-empty value. This may be used to include null fields in Patch
  779. // requests.
  780. NullFields []string `json:"-"`
  781. }
  782. func (s *Condition) MarshalJSON() ([]byte, error) {
  783. type NoMethod Condition
  784. raw := NoMethod(*s)
  785. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  786. }
  787. // ContentMatcher: Used to perform string matching. Currently, this
  788. // matches on the exact content. In the future, it can be expanded to
  789. // allow for regular expressions and more complex matching.
  790. type ContentMatcher struct {
  791. // Content: String content to match (max 1024 bytes)
  792. Content string `json:"content,omitempty"`
  793. // ForceSendFields is a list of field names (e.g. "Content") to
  794. // unconditionally include in API requests. By default, fields with
  795. // empty values are omitted from API requests. However, any non-pointer,
  796. // non-interface field appearing in ForceSendFields will be sent to the
  797. // server regardless of whether the field is empty or not. This may be
  798. // used to include empty fields in Patch requests.
  799. ForceSendFields []string `json:"-"`
  800. // NullFields is a list of field names (e.g. "Content") to include in
  801. // API requests with the JSON null value. By default, fields with empty
  802. // values are omitted from API requests. However, any field with an
  803. // empty value appearing in NullFields will be sent to the server as
  804. // null. It is an error if a field in this list has a non-empty value.
  805. // This may be used to include null fields in Patch requests.
  806. NullFields []string `json:"-"`
  807. }
  808. func (s *ContentMatcher) MarshalJSON() ([]byte, error) {
  809. type NoMethod ContentMatcher
  810. raw := NoMethod(*s)
  811. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  812. }
  813. // CreateCollectdTimeSeriesRequest: The CreateCollectdTimeSeries
  814. // request.
  815. type CreateCollectdTimeSeriesRequest struct {
  816. // CollectdPayloads: The collectd payloads representing the time series
  817. // data. You must not include more than a single point for each time
  818. // series, so no two payloads can have the same values for all of the
  819. // fields plugin, plugin_instance, type, and type_instance.
  820. CollectdPayloads []*CollectdPayload `json:"collectdPayloads,omitempty"`
  821. // CollectdVersion: The version of collectd that collected the data.
  822. // Example: "5.3.0-192.el6".
  823. CollectdVersion string `json:"collectdVersion,omitempty"`
  824. // Resource: The monitored resource associated with the time series.
  825. Resource *MonitoredResource `json:"resource,omitempty"`
  826. // ForceSendFields is a list of field names (e.g. "CollectdPayloads") 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. "CollectdPayloads") 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 *CreateCollectdTimeSeriesRequest) MarshalJSON() ([]byte, error) {
  843. type NoMethod CreateCollectdTimeSeriesRequest
  844. raw := NoMethod(*s)
  845. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  846. }
  847. // CreateCollectdTimeSeriesResponse: The CreateCollectdTimeSeries
  848. // response.
  849. type CreateCollectdTimeSeriesResponse struct {
  850. // PayloadErrors: Records the error status for points that were not
  851. // written due to an error.Failed requests for which nothing is written
  852. // will return an error response instead.
  853. PayloadErrors []*CollectdPayloadError `json:"payloadErrors,omitempty"`
  854. // ServerResponse contains the HTTP response code and headers from the
  855. // server.
  856. googleapi.ServerResponse `json:"-"`
  857. // ForceSendFields is a list of field names (e.g. "PayloadErrors") to
  858. // unconditionally include in API requests. By default, fields with
  859. // empty values are omitted from API requests. However, any non-pointer,
  860. // non-interface field appearing in ForceSendFields will be sent to the
  861. // server regardless of whether the field is empty or not. This may be
  862. // used to include empty fields in Patch requests.
  863. ForceSendFields []string `json:"-"`
  864. // NullFields is a list of field names (e.g. "PayloadErrors") to include
  865. // in API requests with the JSON null value. By default, fields with
  866. // empty values are omitted from API requests. However, any field with
  867. // an empty value appearing in NullFields will be sent to the server as
  868. // null. It is an error if a field in this list has a non-empty value.
  869. // This may be used to include null fields in Patch requests.
  870. NullFields []string `json:"-"`
  871. }
  872. func (s *CreateCollectdTimeSeriesResponse) MarshalJSON() ([]byte, error) {
  873. type NoMethod CreateCollectdTimeSeriesResponse
  874. raw := NoMethod(*s)
  875. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  876. }
  877. // CreateTimeSeriesRequest: The CreateTimeSeries request.
  878. type CreateTimeSeriesRequest struct {
  879. // TimeSeries: The new data to be added to a list of time series. Adds
  880. // at most one data point to each of several time series. The new data
  881. // point must be more recent than any other point in its time series.
  882. // Each TimeSeries value must fully specify a unique time series by
  883. // supplying all label values for the metric and the monitored resource.
  884. TimeSeries []*TimeSeries `json:"timeSeries,omitempty"`
  885. // ForceSendFields is a list of field names (e.g. "TimeSeries") 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. "TimeSeries") to include in
  893. // API requests with the JSON null value. By default, fields with empty
  894. // values are omitted from API requests. However, any field with an
  895. // empty value appearing in NullFields will be sent to the server as
  896. // null. It is an error if a field in this list has a non-empty value.
  897. // This may be used to include null fields in Patch requests.
  898. NullFields []string `json:"-"`
  899. }
  900. func (s *CreateTimeSeriesRequest) MarshalJSON() ([]byte, error) {
  901. type NoMethod CreateTimeSeriesRequest
  902. raw := NoMethod(*s)
  903. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  904. }
  905. // Distribution: Distribution contains summary statistics for a
  906. // population of values. It optionally contains a histogram representing
  907. // the distribution of those values across a set of buckets.The summary
  908. // statistics are the count, mean, sum of the squared deviation from the
  909. // mean, the minimum, and the maximum of the set of population of
  910. // values. The histogram is based on a sequence of buckets and gives a
  911. // count of values that fall into each bucket. The boundaries of the
  912. // buckets are given either explicitly or by formulas for buckets of
  913. // fixed or exponentially increasing widths.Although it is not
  914. // forbidden, it is generally a bad idea to include non-finite values
  915. // (infinities or NaNs) in the population of values, as this will render
  916. // the mean and sum_of_squared_deviation fields meaningless.
  917. type Distribution struct {
  918. // BucketCounts: Required in the Stackdriver Monitoring API v3. The
  919. // values for each bucket specified in bucket_options. The sum of the
  920. // values in bucketCounts must equal the value in the count field of the
  921. // Distribution object. The order of the bucket counts follows the
  922. // numbering schemes described for the three bucket types. The underflow
  923. // bucket has number 0; the finite buckets, if any, have numbers 1
  924. // through N-2; and the overflow bucket has number N-1. The size of
  925. // bucket_counts must not be greater than N. If the size is less than N,
  926. // then the remaining buckets are assigned values of zero.
  927. BucketCounts googleapi.Int64s `json:"bucketCounts,omitempty"`
  928. // BucketOptions: Required in the Stackdriver Monitoring API v3. Defines
  929. // the histogram bucket boundaries.
  930. BucketOptions *BucketOptions `json:"bucketOptions,omitempty"`
  931. // Count: The number of values in the population. Must be non-negative.
  932. // This value must equal the sum of the values in bucket_counts if a
  933. // histogram is provided.
  934. Count int64 `json:"count,omitempty,string"`
  935. // Exemplars: Must be in increasing order of value field.
  936. Exemplars []*Exemplar `json:"exemplars,omitempty"`
  937. // Mean: The arithmetic mean of the values in the population. If count
  938. // is zero then this field must be zero.
  939. Mean float64 `json:"mean,omitempty"`
  940. // Range: If specified, contains the range of the population values. The
  941. // field must not be present if the count is zero. This field is
  942. // presently ignored by the Stackdriver Monitoring API v3.
  943. Range *Range `json:"range,omitempty"`
  944. // SumOfSquaredDeviation: The sum of squared deviations from the mean of
  945. // the values in the population. For values x_i this
  946. // is:
  947. // Sum[i=1..n]((x_i - mean)^2)
  948. // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd
  949. // edition describes Welford's method for accumulating this sum in one
  950. // pass.If count is zero then this field must be zero.
  951. SumOfSquaredDeviation float64 `json:"sumOfSquaredDeviation,omitempty"`
  952. // ForceSendFields is a list of field names (e.g. "BucketCounts") to
  953. // unconditionally include in API requests. By default, fields with
  954. // empty values are omitted from API requests. However, any non-pointer,
  955. // non-interface field appearing in ForceSendFields will be sent to the
  956. // server regardless of whether the field is empty or not. This may be
  957. // used to include empty fields in Patch requests.
  958. ForceSendFields []string `json:"-"`
  959. // NullFields is a list of field names (e.g. "BucketCounts") to include
  960. // in API requests with the JSON null value. By default, fields with
  961. // empty values are omitted from API requests. However, any field with
  962. // an empty value appearing in NullFields will be sent to the server as
  963. // null. It is an error if a field in this list has a non-empty value.
  964. // This may be used to include null fields in Patch requests.
  965. NullFields []string `json:"-"`
  966. }
  967. func (s *Distribution) MarshalJSON() ([]byte, error) {
  968. type NoMethod Distribution
  969. raw := NoMethod(*s)
  970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  971. }
  972. func (s *Distribution) UnmarshalJSON(data []byte) error {
  973. type NoMethod Distribution
  974. var s1 struct {
  975. Mean gensupport.JSONFloat64 `json:"mean"`
  976. SumOfSquaredDeviation gensupport.JSONFloat64 `json:"sumOfSquaredDeviation"`
  977. *NoMethod
  978. }
  979. s1.NoMethod = (*NoMethod)(s)
  980. if err := json.Unmarshal(data, &s1); err != nil {
  981. return err
  982. }
  983. s.Mean = float64(s1.Mean)
  984. s.SumOfSquaredDeviation = float64(s1.SumOfSquaredDeviation)
  985. return nil
  986. }
  987. // Documentation: A content string and a MIME type that describes the
  988. // content string's format.
  989. type Documentation struct {
  990. // Content: The text of the documentation, interpreted according to
  991. // mime_type. The content may not exceed 8,192 Unicode characters and
  992. // may not exceed more than 10,240 bytes when encoded in UTF-8 format,
  993. // whichever is smaller.
  994. Content string `json:"content,omitempty"`
  995. // MimeType: The format of the content field. Presently, only the value
  996. // "text/markdown" is supported. See Markdown
  997. // (https://en.wikipedia.org/wiki/Markdown) for more information.
  998. MimeType string `json:"mimeType,omitempty"`
  999. // ForceSendFields is a list of field names (e.g. "Content") to
  1000. // unconditionally include in API requests. By default, fields with
  1001. // empty values are omitted from API requests. However, any non-pointer,
  1002. // non-interface field appearing in ForceSendFields will be sent to the
  1003. // server regardless of whether the field is empty or not. This may be
  1004. // used to include empty fields in Patch requests.
  1005. ForceSendFields []string `json:"-"`
  1006. // NullFields is a list of field names (e.g. "Content") to include in
  1007. // API requests with the JSON null value. By default, fields with empty
  1008. // values are omitted from API requests. However, any field with an
  1009. // empty value appearing in NullFields will be sent to the server as
  1010. // null. It is an error if a field in this list has a non-empty value.
  1011. // This may be used to include null fields in Patch requests.
  1012. NullFields []string `json:"-"`
  1013. }
  1014. func (s *Documentation) MarshalJSON() ([]byte, error) {
  1015. type NoMethod Documentation
  1016. raw := NoMethod(*s)
  1017. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1018. }
  1019. // Empty: A generic empty message that you can re-use to avoid defining
  1020. // duplicated empty messages in your APIs. A typical example is to use
  1021. // it as the request or the response type of an API method. For
  1022. // instance:
  1023. // service Foo {
  1024. // rpc Bar(google.protobuf.Empty) returns
  1025. // (google.protobuf.Empty);
  1026. // }
  1027. // The JSON representation for Empty is empty JSON object {}.
  1028. type Empty struct {
  1029. // ServerResponse contains the HTTP response code and headers from the
  1030. // server.
  1031. googleapi.ServerResponse `json:"-"`
  1032. }
  1033. // Exemplar: Exemplars are example points that may be used to annotate
  1034. // aggregated distribution values. They are metadata that gives
  1035. // information about a particular value added to a Distribution bucket,
  1036. // such as a trace ID that was active when a value was added. They may
  1037. // contain further information, such as a example values and timestamps,
  1038. // origin, etc.
  1039. type Exemplar struct {
  1040. // Attachments: Contextual information about the example value. Examples
  1041. // are:Trace ID:
  1042. // type.googleapis.com/google.devtools.cloudtrace.v1.TraceLiteral
  1043. // string: type.googleapis.com/google.protobuf.StringValueLabels dropped
  1044. // during aggregation:
  1045. // type.googleapis.com/google.monitoring.v3.DroppedLabelsThere may be
  1046. // only a single attachment of any given message type in a single
  1047. // exemplar, and this is enforced by the system.
  1048. Attachments []googleapi.RawMessage `json:"attachments,omitempty"`
  1049. // Timestamp: The observation (sampling) time of the above value.
  1050. Timestamp string `json:"timestamp,omitempty"`
  1051. // Value: Value of the exemplar point. This value determines to which
  1052. // bucket the exemplar belongs.
  1053. Value float64 `json:"value,omitempty"`
  1054. // ForceSendFields is a list of field names (e.g. "Attachments") to
  1055. // unconditionally include in API requests. By default, fields with
  1056. // empty values are omitted from API requests. However, any non-pointer,
  1057. // non-interface field appearing in ForceSendFields will be sent to the
  1058. // server regardless of whether the field is empty or not. This may be
  1059. // used to include empty fields in Patch requests.
  1060. ForceSendFields []string `json:"-"`
  1061. // NullFields is a list of field names (e.g. "Attachments") to include
  1062. // in API requests with the JSON null value. By default, fields with
  1063. // empty values are omitted from API requests. However, any field with
  1064. // an empty value appearing in NullFields will be sent to the server as
  1065. // null. It is an error if a field in this list has a non-empty value.
  1066. // This may be used to include null fields in Patch requests.
  1067. NullFields []string `json:"-"`
  1068. }
  1069. func (s *Exemplar) MarshalJSON() ([]byte, error) {
  1070. type NoMethod Exemplar
  1071. raw := NoMethod(*s)
  1072. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1073. }
  1074. func (s *Exemplar) UnmarshalJSON(data []byte) error {
  1075. type NoMethod Exemplar
  1076. var s1 struct {
  1077. Value gensupport.JSONFloat64 `json:"value"`
  1078. *NoMethod
  1079. }
  1080. s1.NoMethod = (*NoMethod)(s)
  1081. if err := json.Unmarshal(data, &s1); err != nil {
  1082. return err
  1083. }
  1084. s.Value = float64(s1.Value)
  1085. return nil
  1086. }
  1087. // Explicit: Specifies a set of buckets with arbitrary widths.There are
  1088. // size(bounds) + 1 (= N) buckets. Bucket i has the following
  1089. // boundaries:Upper bound (0 <= i < N-1): boundsi Lower bound (1 <= i <
  1090. // N); boundsi - 1The bounds field must contain at least one element. If
  1091. // bounds has only one element, then there are no finite buckets, and
  1092. // that single element is the common boundary of the overflow and
  1093. // underflow buckets.
  1094. type Explicit struct {
  1095. // Bounds: The values must be monotonically increasing.
  1096. Bounds []float64 `json:"bounds,omitempty"`
  1097. // ForceSendFields is a list of field names (e.g. "Bounds") 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. "Bounds") 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 *Explicit) MarshalJSON() ([]byte, error) {
  1113. type NoMethod Explicit
  1114. raw := NoMethod(*s)
  1115. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1116. }
  1117. // Exponential: Specifies an exponential sequence of buckets that have a
  1118. // width that is proportional to the value of the lower bound. Each
  1119. // bucket represents a constant relative uncertainty on a specific value
  1120. // in the bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket
  1121. // i has the following boundaries:Upper bound (0 <= i < N-1): scale *
  1122. // (growth_factor ^ i). Lower bound (1 <= i < N): scale *
  1123. // (growth_factor ^ (i - 1)).
  1124. type Exponential struct {
  1125. // GrowthFactor: Must be greater than 1.
  1126. GrowthFactor float64 `json:"growthFactor,omitempty"`
  1127. // NumFiniteBuckets: Must be greater than 0.
  1128. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  1129. // Scale: Must be greater than 0.
  1130. Scale float64 `json:"scale,omitempty"`
  1131. // ForceSendFields is a list of field names (e.g. "GrowthFactor") to
  1132. // unconditionally include in API requests. By default, fields with
  1133. // empty values are omitted from API requests. However, any non-pointer,
  1134. // non-interface field appearing in ForceSendFields will be sent to the
  1135. // server regardless of whether the field is empty or not. This may be
  1136. // used to include empty fields in Patch requests.
  1137. ForceSendFields []string `json:"-"`
  1138. // NullFields is a list of field names (e.g. "GrowthFactor") to include
  1139. // in API requests with the JSON null value. By default, fields with
  1140. // empty values are omitted from API requests. However, any field with
  1141. // an empty value appearing in NullFields will be sent to the server as
  1142. // null. It is an error if a field in this list has a non-empty value.
  1143. // This may be used to include null fields in Patch requests.
  1144. NullFields []string `json:"-"`
  1145. }
  1146. func (s *Exponential) MarshalJSON() ([]byte, error) {
  1147. type NoMethod Exponential
  1148. raw := NoMethod(*s)
  1149. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1150. }
  1151. func (s *Exponential) UnmarshalJSON(data []byte) error {
  1152. type NoMethod Exponential
  1153. var s1 struct {
  1154. GrowthFactor gensupport.JSONFloat64 `json:"growthFactor"`
  1155. Scale gensupport.JSONFloat64 `json:"scale"`
  1156. *NoMethod
  1157. }
  1158. s1.NoMethod = (*NoMethod)(s)
  1159. if err := json.Unmarshal(data, &s1); err != nil {
  1160. return err
  1161. }
  1162. s.GrowthFactor = float64(s1.GrowthFactor)
  1163. s.Scale = float64(s1.Scale)
  1164. return nil
  1165. }
  1166. // Field: A single field of a message type.
  1167. type Field struct {
  1168. // Cardinality: The field cardinality.
  1169. //
  1170. // Possible values:
  1171. // "CARDINALITY_UNKNOWN" - For fields with unknown cardinality.
  1172. // "CARDINALITY_OPTIONAL" - For optional fields.
  1173. // "CARDINALITY_REQUIRED" - For required fields. Proto2 syntax only.
  1174. // "CARDINALITY_REPEATED" - For repeated fields.
  1175. Cardinality string `json:"cardinality,omitempty"`
  1176. // DefaultValue: The string value of the default value of this field.
  1177. // Proto2 syntax only.
  1178. DefaultValue string `json:"defaultValue,omitempty"`
  1179. // JsonName: The field JSON name.
  1180. JsonName string `json:"jsonName,omitempty"`
  1181. // Kind: The field type.
  1182. //
  1183. // Possible values:
  1184. // "TYPE_UNKNOWN" - Field type unknown.
  1185. // "TYPE_DOUBLE" - Field type double.
  1186. // "TYPE_FLOAT" - Field type float.
  1187. // "TYPE_INT64" - Field type int64.
  1188. // "TYPE_UINT64" - Field type uint64.
  1189. // "TYPE_INT32" - Field type int32.
  1190. // "TYPE_FIXED64" - Field type fixed64.
  1191. // "TYPE_FIXED32" - Field type fixed32.
  1192. // "TYPE_BOOL" - Field type bool.
  1193. // "TYPE_STRING" - Field type string.
  1194. // "TYPE_GROUP" - Field type group. Proto2 syntax only, and
  1195. // deprecated.
  1196. // "TYPE_MESSAGE" - Field type message.
  1197. // "TYPE_BYTES" - Field type bytes.
  1198. // "TYPE_UINT32" - Field type uint32.
  1199. // "TYPE_ENUM" - Field type enum.
  1200. // "TYPE_SFIXED32" - Field type sfixed32.
  1201. // "TYPE_SFIXED64" - Field type sfixed64.
  1202. // "TYPE_SINT32" - Field type sint32.
  1203. // "TYPE_SINT64" - Field type sint64.
  1204. Kind string `json:"kind,omitempty"`
  1205. // Name: The field name.
  1206. Name string `json:"name,omitempty"`
  1207. // Number: The field number.
  1208. Number int64 `json:"number,omitempty"`
  1209. // OneofIndex: The index of the field type in Type.oneofs, for message
  1210. // or enumeration types. The first type has index 1; zero means the type
  1211. // is not in the list.
  1212. OneofIndex int64 `json:"oneofIndex,omitempty"`
  1213. // Options: The protocol buffer options.
  1214. Options []*Option `json:"options,omitempty"`
  1215. // Packed: Whether to use alternative packed wire representation.
  1216. Packed bool `json:"packed,omitempty"`
  1217. // TypeUrl: The field type URL, without the scheme, for message or
  1218. // enumeration types. Example:
  1219. // "type.googleapis.com/google.protobuf.Timestamp".
  1220. TypeUrl string `json:"typeUrl,omitempty"`
  1221. // ForceSendFields is a list of field names (e.g. "Cardinality") to
  1222. // unconditionally include in API requests. By default, fields with
  1223. // empty values are omitted from API requests. However, any non-pointer,
  1224. // non-interface field appearing in ForceSendFields will be sent to the
  1225. // server regardless of whether the field is empty or not. This may be
  1226. // used to include empty fields in Patch requests.
  1227. ForceSendFields []string `json:"-"`
  1228. // NullFields is a list of field names (e.g. "Cardinality") to include
  1229. // in API requests with the JSON null value. By default, fields with
  1230. // empty values are omitted from API requests. However, any field with
  1231. // an empty value appearing in NullFields will be sent to the server as
  1232. // null. It is an error if a field in this list has a non-empty value.
  1233. // This may be used to include null fields in Patch requests.
  1234. NullFields []string `json:"-"`
  1235. }
  1236. func (s *Field) MarshalJSON() ([]byte, error) {
  1237. type NoMethod Field
  1238. raw := NoMethod(*s)
  1239. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1240. }
  1241. // GetNotificationChannelVerificationCodeRequest: The
  1242. // GetNotificationChannelVerificationCode request.
  1243. type GetNotificationChannelVerificationCodeRequest struct {
  1244. // ExpireTime: The desired expiration time. If specified, the API will
  1245. // guarantee that the returned code will not be valid after the
  1246. // specified timestamp; however, the API cannot guarantee that the
  1247. // returned code will be valid for at least as long as the requested
  1248. // time (the API puts an upper bound on the amount of time for which a
  1249. // code may be valid). If omitted, a default expiration will be used,
  1250. // which may be less than the max permissible expiration (so specifying
  1251. // an expiration may extend the code's lifetime over omitting an
  1252. // expiration, even though the API does impose an upper limit on the
  1253. // maximum expiration that is permitted).
  1254. ExpireTime string `json:"expireTime,omitempty"`
  1255. // ForceSendFields is a list of field names (e.g. "ExpireTime") to
  1256. // unconditionally include in API requests. By default, fields with
  1257. // empty values are omitted from API requests. However, any non-pointer,
  1258. // non-interface field appearing in ForceSendFields will be sent to the
  1259. // server regardless of whether the field is empty or not. This may be
  1260. // used to include empty fields in Patch requests.
  1261. ForceSendFields []string `json:"-"`
  1262. // NullFields is a list of field names (e.g. "ExpireTime") to include in
  1263. // API requests with the JSON null value. By default, fields with empty
  1264. // values are omitted from API requests. However, any field with an
  1265. // empty value appearing in NullFields will be sent to the server as
  1266. // null. It is an error if a field in this list has a non-empty value.
  1267. // This may be used to include null fields in Patch requests.
  1268. NullFields []string `json:"-"`
  1269. }
  1270. func (s *GetNotificationChannelVerificationCodeRequest) MarshalJSON() ([]byte, error) {
  1271. type NoMethod GetNotificationChannelVerificationCodeRequest
  1272. raw := NoMethod(*s)
  1273. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1274. }
  1275. // GetNotificationChannelVerificationCodeResponse: The
  1276. // GetNotificationChannelVerificationCode request.
  1277. type GetNotificationChannelVerificationCodeResponse struct {
  1278. // Code: The verification code, which may be used to verify other
  1279. // channels that have an equivalent identity (i.e. other channels of the
  1280. // same type with the same fingerprint such as other email channels with
  1281. // the same email address or other sms channels with the same number).
  1282. Code string `json:"code,omitempty"`
  1283. // ExpireTime: The expiration time associated with the code that was
  1284. // returned. If an expiration was provided in the request, this is the
  1285. // minimum of the requested expiration in the request and the max
  1286. // permitted expiration.
  1287. ExpireTime string `json:"expireTime,omitempty"`
  1288. // ServerResponse contains the HTTP response code and headers from the
  1289. // server.
  1290. googleapi.ServerResponse `json:"-"`
  1291. // ForceSendFields is a list of field names (e.g. "Code") to
  1292. // unconditionally include in API requests. By default, fields with
  1293. // empty values are omitted from API requests. However, any non-pointer,
  1294. // non-interface field appearing in ForceSendFields will be sent to the
  1295. // server regardless of whether the field is empty or not. This may be
  1296. // used to include empty fields in Patch requests.
  1297. ForceSendFields []string `json:"-"`
  1298. // NullFields is a list of field names (e.g. "Code") to include in API
  1299. // requests with the JSON null value. By default, fields with empty
  1300. // values are omitted from API requests. However, any field with an
  1301. // empty value appearing in NullFields will be sent to the server as
  1302. // null. It is an error if a field in this list has a non-empty value.
  1303. // This may be used to include null fields in Patch requests.
  1304. NullFields []string `json:"-"`
  1305. }
  1306. func (s *GetNotificationChannelVerificationCodeResponse) MarshalJSON() ([]byte, error) {
  1307. type NoMethod GetNotificationChannelVerificationCodeResponse
  1308. raw := NoMethod(*s)
  1309. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1310. }
  1311. // Group: The description of a dynamic collection of monitored
  1312. // resources. Each group has a filter that is matched against monitored
  1313. // resources and their associated metadata. If a group's filter matches
  1314. // an available monitored resource, then that resource is a member of
  1315. // that group. Groups can contain any number of monitored resources, and
  1316. // each monitored resource can be a member of any number of
  1317. // groups.Groups can be nested in parent-child hierarchies. The
  1318. // parentName field identifies an optional parent for each group. If a
  1319. // group has a parent, then the only monitored resources available to be
  1320. // matched by the group's filter are the resources contained in the
  1321. // parent group. In other words, a group contains the monitored
  1322. // resources that match its filter and the filters of all the group's
  1323. // ancestors. A group without a parent can contain any monitored
  1324. // resource.For example, consider an infrastructure running a set of
  1325. // instances with two user-defined tags: "environment" and "role". A
  1326. // parent group has a filter, environment="production". A child of that
  1327. // parent group has a filter, role="transcoder". The parent group
  1328. // contains all instances in the production environment, regardless of
  1329. // their roles. The child group contains instances that have the
  1330. // transcoder role and are in the production environment.The monitored
  1331. // resources contained in a group can change at any moment, depending on
  1332. // what resources exist and what filters are associated with the group
  1333. // and its ancestors.
  1334. type Group struct {
  1335. // DisplayName: A user-assigned name for this group, used only for
  1336. // display purposes.
  1337. DisplayName string `json:"displayName,omitempty"`
  1338. // Filter: The filter used to determine which monitored resources belong
  1339. // to this group.
  1340. Filter string `json:"filter,omitempty"`
  1341. // IsCluster: If true, the members of this group are considered to be a
  1342. // cluster. The system can perform additional analysis on groups that
  1343. // are clusters.
  1344. IsCluster bool `json:"isCluster,omitempty"`
  1345. // Name: Output only. The name of this group. The format is
  1346. // "projects/{project_id_or_number}/groups/{group_id}". When creating a
  1347. // group, this field is ignored and a new name is created consisting of
  1348. // the project specified in the call to CreateGroup and a unique
  1349. // {group_id} that is generated automatically.
  1350. Name string `json:"name,omitempty"`
  1351. // ParentName: The name of the group's parent, if it has one. The format
  1352. // is "projects/{project_id_or_number}/groups/{group_id}". For groups
  1353. // with no parent, parentName is the empty string, "".
  1354. ParentName string `json:"parentName,omitempty"`
  1355. // ServerResponse contains the HTTP response code and headers from the
  1356. // server.
  1357. googleapi.ServerResponse `json:"-"`
  1358. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1359. // unconditionally include in API requests. By default, fields with
  1360. // empty values are omitted from API requests. However, any non-pointer,
  1361. // non-interface field appearing in ForceSendFields will be sent to the
  1362. // server regardless of whether the field is empty or not. This may be
  1363. // used to include empty fields in Patch requests.
  1364. ForceSendFields []string `json:"-"`
  1365. // NullFields is a list of field names (e.g. "DisplayName") to include
  1366. // in API requests with the JSON null value. By default, fields with
  1367. // empty values are omitted from API requests. However, any field with
  1368. // an empty value appearing in NullFields will be sent to the server as
  1369. // null. It is an error if a field in this list has a non-empty value.
  1370. // This may be used to include null fields in Patch requests.
  1371. NullFields []string `json:"-"`
  1372. }
  1373. func (s *Group) MarshalJSON() ([]byte, error) {
  1374. type NoMethod Group
  1375. raw := NoMethod(*s)
  1376. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1377. }
  1378. // HttpCheck: Information involved in an HTTP/HTTPS uptime check
  1379. // request.
  1380. type HttpCheck struct {
  1381. // AuthInfo: The authentication information. Optional when creating an
  1382. // HTTP check; defaults to empty.
  1383. AuthInfo *BasicAuthentication `json:"authInfo,omitempty"`
  1384. // Headers: The list of headers to send as part of the uptime check
  1385. // request. If two headers have the same key and different values, they
  1386. // should be entered as a single header, with the value being a
  1387. // comma-separated list of all the desired values as described at
  1388. // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). Entering
  1389. // two separate headers with the same key in a Create call will cause
  1390. // the first to be overwritten by the second. The maximum number of
  1391. // headers allowed is 100.
  1392. Headers map[string]string `json:"headers,omitempty"`
  1393. // MaskHeaders: Boolean specifiying whether to encrypt the header
  1394. // information. Encryption should be specified for any headers related
  1395. // to authentication that you do not wish to be seen when retrieving the
  1396. // configuration. The server will be responsible for encrypting the
  1397. // headers. On Get/List calls, if mask_headers is set to True then the
  1398. // headers will be obscured with ******.
  1399. MaskHeaders bool `json:"maskHeaders,omitempty"`
  1400. // Path: The path to the page to run the check against. Will be combined
  1401. // with the host (specified within the MonitoredResource) and port to
  1402. // construct the full URL. Optional (defaults to "/").
  1403. Path string `json:"path,omitempty"`
  1404. // Port: The port to the page to run the check against. Will be combined
  1405. // with host (specified within the MonitoredResource) and path to
  1406. // construct the full URL. Optional (defaults to 80 without SSL, or 443
  1407. // with SSL).
  1408. Port int64 `json:"port,omitempty"`
  1409. // UseSsl: If true, use HTTPS instead of HTTP to run the check.
  1410. UseSsl bool `json:"useSsl,omitempty"`
  1411. // ForceSendFields is a list of field names (e.g. "AuthInfo") to
  1412. // unconditionally include in API requests. By default, fields with
  1413. // empty values are omitted from API requests. However, any non-pointer,
  1414. // non-interface field appearing in ForceSendFields will be sent to the
  1415. // server regardless of whether the field is empty or not. This may be
  1416. // used to include empty fields in Patch requests.
  1417. ForceSendFields []string `json:"-"`
  1418. // NullFields is a list of field names (e.g. "AuthInfo") to include in
  1419. // API requests with the JSON null value. By default, fields with empty
  1420. // values are omitted from API requests. However, any field with an
  1421. // empty value appearing in NullFields will be sent to the server as
  1422. // null. It is an error if a field in this list has a non-empty value.
  1423. // This may be used to include null fields in Patch requests.
  1424. NullFields []string `json:"-"`
  1425. }
  1426. func (s *HttpCheck) MarshalJSON() ([]byte, error) {
  1427. type NoMethod HttpCheck
  1428. raw := NoMethod(*s)
  1429. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1430. }
  1431. // InternalChecker: Nimbus InternalCheckers.
  1432. type InternalChecker struct {
  1433. // CheckerId: The checker ID.
  1434. CheckerId string `json:"checkerId,omitempty"`
  1435. // DisplayName: The checker's human-readable name.
  1436. DisplayName string `json:"displayName,omitempty"`
  1437. // GcpZone: The GCP zone the uptime check should egress from. Only
  1438. // respected for internal uptime checks, where internal_network is
  1439. // specified.
  1440. GcpZone string `json:"gcpZone,omitempty"`
  1441. // Network: The internal network to perform this uptime check on.
  1442. Network string `json:"network,omitempty"`
  1443. // ProjectId: The GCP project ID. Not necessarily the same as the
  1444. // project_id for the config.
  1445. ProjectId string `json:"projectId,omitempty"`
  1446. // ForceSendFields is a list of field names (e.g. "CheckerId") to
  1447. // unconditionally include in API requests. By default, fields with
  1448. // empty values are omitted from API requests. However, any non-pointer,
  1449. // non-interface field appearing in ForceSendFields will be sent to the
  1450. // server regardless of whether the field is empty or not. This may be
  1451. // used to include empty fields in Patch requests.
  1452. ForceSendFields []string `json:"-"`
  1453. // NullFields is a list of field names (e.g. "CheckerId") to include in
  1454. // API requests with the JSON null value. By default, fields with empty
  1455. // values are omitted from API requests. However, any field with an
  1456. // empty value appearing in NullFields will be sent to the server as
  1457. // null. It is an error if a field in this list has a non-empty value.
  1458. // This may be used to include null fields in Patch requests.
  1459. NullFields []string `json:"-"`
  1460. }
  1461. func (s *InternalChecker) MarshalJSON() ([]byte, error) {
  1462. type NoMethod InternalChecker
  1463. raw := NoMethod(*s)
  1464. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1465. }
  1466. // LabelDescriptor: A description of a label.
  1467. type LabelDescriptor struct {
  1468. // Description: A human-readable description for the label.
  1469. Description string `json:"description,omitempty"`
  1470. // Key: The label key.
  1471. Key string `json:"key,omitempty"`
  1472. // ValueType: The type of data that can be assigned to the label.
  1473. //
  1474. // Possible values:
  1475. // "STRING" - A variable-length string. This is the default.
  1476. // "BOOL" - Boolean; true or false.
  1477. // "INT64" - A 64-bit signed integer.
  1478. ValueType string `json:"valueType,omitempty"`
  1479. // ForceSendFields is a list of field names (e.g. "Description") to
  1480. // unconditionally include in API requests. By default, fields with
  1481. // empty values are omitted from API requests. However, any non-pointer,
  1482. // non-interface field appearing in ForceSendFields will be sent to the
  1483. // server regardless of whether the field is empty or not. This may be
  1484. // used to include empty fields in Patch requests.
  1485. ForceSendFields []string `json:"-"`
  1486. // NullFields is a list of field names (e.g. "Description") to include
  1487. // in API requests with the JSON null value. By default, fields with
  1488. // empty values are omitted from API requests. However, any field with
  1489. // an empty value appearing in NullFields will be sent to the server as
  1490. // null. It is an error if a field in this list has a non-empty value.
  1491. // This may be used to include null fields in Patch requests.
  1492. NullFields []string `json:"-"`
  1493. }
  1494. func (s *LabelDescriptor) MarshalJSON() ([]byte, error) {
  1495. type NoMethod LabelDescriptor
  1496. raw := NoMethod(*s)
  1497. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1498. }
  1499. // Linear: Specifies a linear sequence of buckets that all have the same
  1500. // width (except overflow and underflow). Each bucket represents a
  1501. // constant absolute uncertainty on the specific value in the
  1502. // bucket.There are num_finite_buckets + 2 (= N) buckets. Bucket i has
  1503. // the following boundaries:Upper bound (0 <= i < N-1): offset + (width
  1504. // * i). Lower bound (1 <= i < N): offset + (width * (i - 1)).
  1505. type Linear struct {
  1506. // NumFiniteBuckets: Must be greater than 0.
  1507. NumFiniteBuckets int64 `json:"numFiniteBuckets,omitempty"`
  1508. // Offset: Lower bound of the first bucket.
  1509. Offset float64 `json:"offset,omitempty"`
  1510. // Width: Must be greater than 0.
  1511. Width float64 `json:"width,omitempty"`
  1512. // ForceSendFields is a list of field names (e.g. "NumFiniteBuckets") to
  1513. // unconditionally include in API requests. By default, fields with
  1514. // empty values are omitted from API requests. However, any non-pointer,
  1515. // non-interface field appearing in ForceSendFields will be sent to the
  1516. // server regardless of whether the field is empty or not. This may be
  1517. // used to include empty fields in Patch requests.
  1518. ForceSendFields []string `json:"-"`
  1519. // NullFields is a list of field names (e.g. "NumFiniteBuckets") to
  1520. // include in API requests with the JSON null value. By default, fields
  1521. // with empty values are omitted from API requests. However, any field
  1522. // with an empty value appearing in NullFields will be sent to the
  1523. // server as null. It is an error if a field in this list has a
  1524. // non-empty value. This may be used to include null fields in Patch
  1525. // requests.
  1526. NullFields []string `json:"-"`
  1527. }
  1528. func (s *Linear) MarshalJSON() ([]byte, error) {
  1529. type NoMethod Linear
  1530. raw := NoMethod(*s)
  1531. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1532. }
  1533. func (s *Linear) UnmarshalJSON(data []byte) error {
  1534. type NoMethod Linear
  1535. var s1 struct {
  1536. Offset gensupport.JSONFloat64 `json:"offset"`
  1537. Width gensupport.JSONFloat64 `json:"width"`
  1538. *NoMethod
  1539. }
  1540. s1.NoMethod = (*NoMethod)(s)
  1541. if err := json.Unmarshal(data, &s1); err != nil {
  1542. return err
  1543. }
  1544. s.Offset = float64(s1.Offset)
  1545. s.Width = float64(s1.Width)
  1546. return nil
  1547. }
  1548. // ListAlertPoliciesResponse: The protocol for the ListAlertPolicies
  1549. // response.
  1550. type ListAlertPoliciesResponse struct {
  1551. // AlertPolicies: The returned alert policies.
  1552. AlertPolicies []*AlertPolicy `json:"alertPolicies,omitempty"`
  1553. // NextPageToken: If there might be more results than were returned,
  1554. // then this field is set to a non-empty value. To see the additional
  1555. // results, use that value as pageToken in the next call to this method.
  1556. NextPageToken string `json:"nextPageToken,omitempty"`
  1557. // ServerResponse contains the HTTP response code and headers from the
  1558. // server.
  1559. googleapi.ServerResponse `json:"-"`
  1560. // ForceSendFields is a list of field names (e.g. "AlertPolicies") to
  1561. // unconditionally include in API requests. By default, fields with
  1562. // empty values are omitted from API requests. However, any non-pointer,
  1563. // non-interface field appearing in ForceSendFields will be sent to the
  1564. // server regardless of whether the field is empty or not. This may be
  1565. // used to include empty fields in Patch requests.
  1566. ForceSendFields []string `json:"-"`
  1567. // NullFields is a list of field names (e.g. "AlertPolicies") to include
  1568. // in API requests with the JSON null value. By default, fields with
  1569. // empty values are omitted from API requests. However, any field with
  1570. // an empty value appearing in NullFields will be sent to the server as
  1571. // null. It is an error if a field in this list has a non-empty value.
  1572. // This may be used to include null fields in Patch requests.
  1573. NullFields []string `json:"-"`
  1574. }
  1575. func (s *ListAlertPoliciesResponse) MarshalJSON() ([]byte, error) {
  1576. type NoMethod ListAlertPoliciesResponse
  1577. raw := NoMethod(*s)
  1578. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1579. }
  1580. // ListGroupMembersResponse: The ListGroupMembers response.
  1581. type ListGroupMembersResponse struct {
  1582. // Members: A set of monitored resources in the group.
  1583. Members []*MonitoredResource `json:"members,omitempty"`
  1584. // NextPageToken: If there are more results than have been returned,
  1585. // then this field is set to a non-empty value. To see the additional
  1586. // results, use that value as pageToken in the next call to this method.
  1587. NextPageToken string `json:"nextPageToken,omitempty"`
  1588. // TotalSize: The total number of elements matching this request.
  1589. TotalSize int64 `json:"totalSize,omitempty"`
  1590. // ServerResponse contains the HTTP response code and headers from the
  1591. // server.
  1592. googleapi.ServerResponse `json:"-"`
  1593. // ForceSendFields is a list of field names (e.g. "Members") to
  1594. // unconditionally include in API requests. By default, fields with
  1595. // empty values are omitted from API requests. However, any non-pointer,
  1596. // non-interface field appearing in ForceSendFields will be sent to the
  1597. // server regardless of whether the field is empty or not. This may be
  1598. // used to include empty fields in Patch requests.
  1599. ForceSendFields []string `json:"-"`
  1600. // NullFields is a list of field names (e.g. "Members") to include in
  1601. // API requests with the JSON null value. By default, fields with empty
  1602. // values are omitted from API requests. However, any field with an
  1603. // empty value appearing in NullFields will be sent to the server as
  1604. // null. It is an error if a field in this list has a non-empty value.
  1605. // This may be used to include null fields in Patch requests.
  1606. NullFields []string `json:"-"`
  1607. }
  1608. func (s *ListGroupMembersResponse) MarshalJSON() ([]byte, error) {
  1609. type NoMethod ListGroupMembersResponse
  1610. raw := NoMethod(*s)
  1611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1612. }
  1613. // ListGroupsResponse: The ListGroups response.
  1614. type ListGroupsResponse struct {
  1615. // Group: The groups that match the specified filters.
  1616. Group []*Group `json:"group,omitempty"`
  1617. // NextPageToken: If there are more results than have been returned,
  1618. // then this field is set to a non-empty value. To see the additional
  1619. // results, use that value as pageToken in the next call to this method.
  1620. NextPageToken string `json:"nextPageToken,omitempty"`
  1621. // ServerResponse contains the HTTP response code and headers from the
  1622. // server.
  1623. googleapi.ServerResponse `json:"-"`
  1624. // ForceSendFields is a list of field names (e.g. "Group") to
  1625. // unconditionally include in API requests. By default, fields with
  1626. // empty values are omitted from API requests. However, any non-pointer,
  1627. // non-interface field appearing in ForceSendFields will be sent to the
  1628. // server regardless of whether the field is empty or not. This may be
  1629. // used to include empty fields in Patch requests.
  1630. ForceSendFields []string `json:"-"`
  1631. // NullFields is a list of field names (e.g. "Group") to include in API
  1632. // requests with the JSON null value. By default, fields with empty
  1633. // values are omitted from API requests. However, any field with an
  1634. // empty value appearing in NullFields will be sent to the server as
  1635. // null. It is an error if a field in this list has a non-empty value.
  1636. // This may be used to include null fields in Patch requests.
  1637. NullFields []string `json:"-"`
  1638. }
  1639. func (s *ListGroupsResponse) MarshalJSON() ([]byte, error) {
  1640. type NoMethod ListGroupsResponse
  1641. raw := NoMethod(*s)
  1642. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1643. }
  1644. // ListMetricDescriptorsResponse: The ListMetricDescriptors response.
  1645. type ListMetricDescriptorsResponse struct {
  1646. // MetricDescriptors: The metric descriptors that are available to the
  1647. // project and that match the value of filter, if present.
  1648. MetricDescriptors []*MetricDescriptor `json:"metricDescriptors,omitempty"`
  1649. // NextPageToken: If there are more results than have been returned,
  1650. // then this field is set to a non-empty value. To see the additional
  1651. // results, use that value as pageToken in the next call to this method.
  1652. NextPageToken string `json:"nextPageToken,omitempty"`
  1653. // ServerResponse contains the HTTP response code and headers from the
  1654. // server.
  1655. googleapi.ServerResponse `json:"-"`
  1656. // ForceSendFields is a list of field names (e.g. "MetricDescriptors")
  1657. // to unconditionally include in API requests. By default, fields with
  1658. // empty values are omitted from API requests. However, any non-pointer,
  1659. // non-interface field appearing in ForceSendFields will be sent to the
  1660. // server regardless of whether the field is empty or not. This may be
  1661. // used to include empty fields in Patch requests.
  1662. ForceSendFields []string `json:"-"`
  1663. // NullFields is a list of field names (e.g. "MetricDescriptors") to
  1664. // include in API requests with the JSON null value. By default, fields
  1665. // with empty values are omitted from API requests. However, any field
  1666. // with an empty value appearing in NullFields will be sent to the
  1667. // server as null. It is an error if a field in this list has a
  1668. // non-empty value. This may be used to include null fields in Patch
  1669. // requests.
  1670. NullFields []string `json:"-"`
  1671. }
  1672. func (s *ListMetricDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1673. type NoMethod ListMetricDescriptorsResponse
  1674. raw := NoMethod(*s)
  1675. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1676. }
  1677. // ListMonitoredResourceDescriptorsResponse: The
  1678. // ListMonitoredResourceDescriptors response.
  1679. type ListMonitoredResourceDescriptorsResponse struct {
  1680. // NextPageToken: If there are more results than have been returned,
  1681. // then this field is set to a non-empty value. To see the additional
  1682. // results, use that value as pageToken in the next call to this method.
  1683. NextPageToken string `json:"nextPageToken,omitempty"`
  1684. // ResourceDescriptors: The monitored resource descriptors that are
  1685. // available to this project and that match filter, if present.
  1686. ResourceDescriptors []*MonitoredResourceDescriptor `json:"resourceDescriptors,omitempty"`
  1687. // ServerResponse contains the HTTP response code and headers from the
  1688. // server.
  1689. googleapi.ServerResponse `json:"-"`
  1690. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1691. // unconditionally include in API requests. By default, fields with
  1692. // empty values are omitted from API requests. However, any non-pointer,
  1693. // non-interface field appearing in ForceSendFields will be sent to the
  1694. // server regardless of whether the field is empty or not. This may be
  1695. // used to include empty fields in Patch requests.
  1696. ForceSendFields []string `json:"-"`
  1697. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1698. // in API requests with the JSON null value. By default, fields with
  1699. // empty values are omitted from API requests. However, any field with
  1700. // an empty value appearing in NullFields will be sent to the server as
  1701. // null. It is an error if a field in this list has a non-empty value.
  1702. // This may be used to include null fields in Patch requests.
  1703. NullFields []string `json:"-"`
  1704. }
  1705. func (s *ListMonitoredResourceDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1706. type NoMethod ListMonitoredResourceDescriptorsResponse
  1707. raw := NoMethod(*s)
  1708. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1709. }
  1710. // ListNotificationChannelDescriptorsResponse: The
  1711. // ListNotificationChannelDescriptors response.
  1712. type ListNotificationChannelDescriptorsResponse struct {
  1713. // ChannelDescriptors: The monitored resource descriptors supported for
  1714. // the specified project, optionally filtered.
  1715. ChannelDescriptors []*NotificationChannelDescriptor `json:"channelDescriptors,omitempty"`
  1716. // NextPageToken: If not empty, indicates that there may be more results
  1717. // that match the request. Use the value in the page_token field in a
  1718. // subsequent request to fetch the next set of results. If empty, all
  1719. // results have been returned.
  1720. NextPageToken string `json:"nextPageToken,omitempty"`
  1721. // ServerResponse contains the HTTP response code and headers from the
  1722. // server.
  1723. googleapi.ServerResponse `json:"-"`
  1724. // ForceSendFields is a list of field names (e.g. "ChannelDescriptors")
  1725. // to unconditionally include in API requests. By default, fields with
  1726. // empty values are omitted from API requests. However, any non-pointer,
  1727. // non-interface field appearing in ForceSendFields will be sent to the
  1728. // server regardless of whether the field is empty or not. This may be
  1729. // used to include empty fields in Patch requests.
  1730. ForceSendFields []string `json:"-"`
  1731. // NullFields is a list of field names (e.g. "ChannelDescriptors") to
  1732. // include in API requests with the JSON null value. By default, fields
  1733. // with empty values are omitted from API requests. However, any field
  1734. // with an empty value appearing in NullFields will be sent to the
  1735. // server as null. It is an error if a field in this list has a
  1736. // non-empty value. This may be used to include null fields in Patch
  1737. // requests.
  1738. NullFields []string `json:"-"`
  1739. }
  1740. func (s *ListNotificationChannelDescriptorsResponse) MarshalJSON() ([]byte, error) {
  1741. type NoMethod ListNotificationChannelDescriptorsResponse
  1742. raw := NoMethod(*s)
  1743. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1744. }
  1745. // ListNotificationChannelsResponse: The ListNotificationChannels
  1746. // response.
  1747. type ListNotificationChannelsResponse struct {
  1748. // NextPageToken: If not empty, indicates that there may be more results
  1749. // that match the request. Use the value in the page_token field in a
  1750. // subsequent request to fetch the next set of results. If empty, all
  1751. // results have been returned.
  1752. NextPageToken string `json:"nextPageToken,omitempty"`
  1753. // NotificationChannels: The notification channels defined for the
  1754. // specified project.
  1755. NotificationChannels []*NotificationChannel `json:"notificationChannels,omitempty"`
  1756. // ServerResponse contains the HTTP response code and headers from the
  1757. // server.
  1758. googleapi.ServerResponse `json:"-"`
  1759. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1760. // unconditionally include in API requests. By default, fields with
  1761. // empty values are omitted from API requests. However, any non-pointer,
  1762. // non-interface field appearing in ForceSendFields will be sent to the
  1763. // server regardless of whether the field is empty or not. This may be
  1764. // used to include empty fields in Patch requests.
  1765. ForceSendFields []string `json:"-"`
  1766. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1767. // in API requests with the JSON null value. By default, fields with
  1768. // empty values are omitted from API requests. However, any field with
  1769. // an empty value appearing in NullFields will be sent to the server as
  1770. // null. It is an error if a field in this list has a non-empty value.
  1771. // This may be used to include null fields in Patch requests.
  1772. NullFields []string `json:"-"`
  1773. }
  1774. func (s *ListNotificationChannelsResponse) MarshalJSON() ([]byte, error) {
  1775. type NoMethod ListNotificationChannelsResponse
  1776. raw := NoMethod(*s)
  1777. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1778. }
  1779. // ListTimeSeriesResponse: The ListTimeSeries response.
  1780. type ListTimeSeriesResponse struct {
  1781. // ExecutionErrors: Query execution errors that may have caused the time
  1782. // series data returned to be incomplete.
  1783. ExecutionErrors []*Status `json:"executionErrors,omitempty"`
  1784. // NextPageToken: If there are more results than have been returned,
  1785. // then this field is set to a non-empty value. To see the additional
  1786. // results, use that value as pageToken in the next call to this method.
  1787. NextPageToken string `json:"nextPageToken,omitempty"`
  1788. // TimeSeries: One or more time series that match the filter included in
  1789. // the request.
  1790. TimeSeries []*TimeSeries `json:"timeSeries,omitempty"`
  1791. // ServerResponse contains the HTTP response code and headers from the
  1792. // server.
  1793. googleapi.ServerResponse `json:"-"`
  1794. // ForceSendFields is a list of field names (e.g. "ExecutionErrors") to
  1795. // unconditionally include in API requests. By default, fields with
  1796. // empty values are omitted from API requests. However, any non-pointer,
  1797. // non-interface field appearing in ForceSendFields will be sent to the
  1798. // server regardless of whether the field is empty or not. This may be
  1799. // used to include empty fields in Patch requests.
  1800. ForceSendFields []string `json:"-"`
  1801. // NullFields is a list of field names (e.g. "ExecutionErrors") to
  1802. // include in API requests with the JSON null value. By default, fields
  1803. // with empty values are omitted from API requests. However, any field
  1804. // with an empty value appearing in NullFields will be sent to the
  1805. // server as null. It is an error if a field in this list has a
  1806. // non-empty value. This may be used to include null fields in Patch
  1807. // requests.
  1808. NullFields []string `json:"-"`
  1809. }
  1810. func (s *ListTimeSeriesResponse) MarshalJSON() ([]byte, error) {
  1811. type NoMethod ListTimeSeriesResponse
  1812. raw := NoMethod(*s)
  1813. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1814. }
  1815. // ListUptimeCheckConfigsResponse: The protocol for the
  1816. // ListUptimeCheckConfigs response.
  1817. type ListUptimeCheckConfigsResponse struct {
  1818. // NextPageToken: This field represents the pagination token to retrieve
  1819. // the next page of results. If the value is empty, it means no further
  1820. // results for the request. To retrieve the next page of results, the
  1821. // value of the next_page_token is passed to the subsequent List method
  1822. // call (in the request message's page_token field).
  1823. NextPageToken string `json:"nextPageToken,omitempty"`
  1824. // TotalSize: The total number of uptime check configurations for the
  1825. // project, irrespective of any pagination.
  1826. TotalSize int64 `json:"totalSize,omitempty"`
  1827. // UptimeCheckConfigs: The returned uptime check configurations.
  1828. UptimeCheckConfigs []*UptimeCheckConfig `json:"uptimeCheckConfigs,omitempty"`
  1829. // ServerResponse contains the HTTP response code and headers from the
  1830. // server.
  1831. googleapi.ServerResponse `json:"-"`
  1832. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1833. // unconditionally include in API requests. By default, fields with
  1834. // empty values are omitted from API requests. However, any non-pointer,
  1835. // non-interface field appearing in ForceSendFields will be sent to the
  1836. // server regardless of whether the field is empty or not. This may be
  1837. // used to include empty fields in Patch requests.
  1838. ForceSendFields []string `json:"-"`
  1839. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1840. // in API requests with the JSON null value. By default, fields with
  1841. // empty values are omitted from API requests. However, any field with
  1842. // an empty value appearing in NullFields will be sent to the server as
  1843. // null. It is an error if a field in this list has a non-empty value.
  1844. // This may be used to include null fields in Patch requests.
  1845. NullFields []string `json:"-"`
  1846. }
  1847. func (s *ListUptimeCheckConfigsResponse) MarshalJSON() ([]byte, error) {
  1848. type NoMethod ListUptimeCheckConfigsResponse
  1849. raw := NoMethod(*s)
  1850. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1851. }
  1852. // ListUptimeCheckIpsResponse: The protocol for the ListUptimeCheckIps
  1853. // response.
  1854. type ListUptimeCheckIpsResponse struct {
  1855. // NextPageToken: This field represents the pagination token to retrieve
  1856. // the next page of results. If the value is empty, it means no further
  1857. // results for the request. To retrieve the next page of results, the
  1858. // value of the next_page_token is passed to the subsequent List method
  1859. // call (in the request message's page_token field). NOTE: this field is
  1860. // not yet implemented
  1861. NextPageToken string `json:"nextPageToken,omitempty"`
  1862. // UptimeCheckIps: The returned list of IP addresses (including region
  1863. // and location) that the checkers run from.
  1864. UptimeCheckIps []*UptimeCheckIp `json:"uptimeCheckIps,omitempty"`
  1865. // ServerResponse contains the HTTP response code and headers from the
  1866. // server.
  1867. googleapi.ServerResponse `json:"-"`
  1868. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1869. // unconditionally include in API requests. By default, fields with
  1870. // empty values are omitted from API requests. However, any non-pointer,
  1871. // non-interface field appearing in ForceSendFields will be sent to the
  1872. // server regardless of whether the field is empty or not. This may be
  1873. // used to include empty fields in Patch requests.
  1874. ForceSendFields []string `json:"-"`
  1875. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1876. // in API requests with the JSON null value. By default, fields with
  1877. // empty values are omitted from API requests. However, any field with
  1878. // an empty value appearing in NullFields will be sent to the server as
  1879. // null. It is an error if a field in this list has a non-empty value.
  1880. // This may be used to include null fields in Patch requests.
  1881. NullFields []string `json:"-"`
  1882. }
  1883. func (s *ListUptimeCheckIpsResponse) MarshalJSON() ([]byte, error) {
  1884. type NoMethod ListUptimeCheckIpsResponse
  1885. raw := NoMethod(*s)
  1886. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1887. }
  1888. // Metric: A specific metric, identified by specifying values for all of
  1889. // the labels of a MetricDescriptor.
  1890. type Metric struct {
  1891. // Labels: The set of label values that uniquely identify this metric.
  1892. // All labels listed in the MetricDescriptor must be assigned values.
  1893. Labels map[string]string `json:"labels,omitempty"`
  1894. // Type: An existing metric type, see google.api.MetricDescriptor. For
  1895. // example, custom.googleapis.com/invoice/paid/amount.
  1896. Type string `json:"type,omitempty"`
  1897. // ForceSendFields is a list of field names (e.g. "Labels") to
  1898. // unconditionally include in API requests. By default, fields with
  1899. // empty values are omitted from API requests. However, any non-pointer,
  1900. // non-interface field appearing in ForceSendFields will be sent to the
  1901. // server regardless of whether the field is empty or not. This may be
  1902. // used to include empty fields in Patch requests.
  1903. ForceSendFields []string `json:"-"`
  1904. // NullFields is a list of field names (e.g. "Labels") to include in API
  1905. // requests with the JSON null value. By default, fields with empty
  1906. // values are omitted from API requests. However, any field with an
  1907. // empty value appearing in NullFields will be sent to the server as
  1908. // null. It is an error if a field in this list has a non-empty value.
  1909. // This may be used to include null fields in Patch requests.
  1910. NullFields []string `json:"-"`
  1911. }
  1912. func (s *Metric) MarshalJSON() ([]byte, error) {
  1913. type NoMethod Metric
  1914. raw := NoMethod(*s)
  1915. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1916. }
  1917. // MetricAbsence: A condition type that checks that monitored resources
  1918. // are reporting data. The configuration defines a metric and a set of
  1919. // monitored resources. The predicate is considered in violation when a
  1920. // time series for the specified metric of a monitored resource does not
  1921. // include any data in the specified duration.
  1922. type MetricAbsence struct {
  1923. // Aggregations: Specifies the alignment of data points in individual
  1924. // time series as well as how to combine the retrieved time series
  1925. // together (such as when aggregating multiple streams on each resource
  1926. // to a single stream for each resource or when aggregating streams
  1927. // across all members of a group of resrouces). Multiple aggregations
  1928. // are applied in the order specified.This field is similar to the one
  1929. // in the MetricService.ListTimeSeries request. It is advisable to use
  1930. // the ListTimeSeries method when debugging this field.
  1931. Aggregations []*Aggregation `json:"aggregations,omitempty"`
  1932. // Duration: The amount of time that a time series must fail to report
  1933. // new data to be considered failing. Currently, only values that are a
  1934. // multiple of a minute--e.g. 60, 120, or 300 seconds--are supported. If
  1935. // an invalid value is given, an error will be returned. The
  1936. // Duration.nanos field is ignored.
  1937. Duration string `json:"duration,omitempty"`
  1938. // Filter: A filter that identifies which time series should be compared
  1939. // with the threshold.The filter is similar to the one that is specified
  1940. // in the MetricService.ListTimeSeries request (that call is useful to
  1941. // verify the time series that will be retrieved / processed) and must
  1942. // specify the metric type and optionally may contain restrictions on
  1943. // resource type, resource labels, and metric labels. This field may not
  1944. // exceed 2048 Unicode characters in length.
  1945. Filter string `json:"filter,omitempty"`
  1946. // Trigger: The number/percent of time series for which the comparison
  1947. // must hold in order for the condition to trigger. If unspecified, then
  1948. // the condition will trigger if the comparison is true for any of the
  1949. // time series that have been identified by filter and aggregations.
  1950. Trigger *Trigger `json:"trigger,omitempty"`
  1951. // ForceSendFields is a list of field names (e.g. "Aggregations") to
  1952. // unconditionally include in API requests. By default, fields with
  1953. // empty values are omitted from API requests. However, any non-pointer,
  1954. // non-interface field appearing in ForceSendFields will be sent to the
  1955. // server regardless of whether the field is empty or not. This may be
  1956. // used to include empty fields in Patch requests.
  1957. ForceSendFields []string `json:"-"`
  1958. // NullFields is a list of field names (e.g. "Aggregations") to include
  1959. // in API requests with the JSON null value. By default, fields with
  1960. // empty values are omitted from API requests. However, any field with
  1961. // an empty value appearing in NullFields will be sent to the server as
  1962. // null. It is an error if a field in this list has a non-empty value.
  1963. // This may be used to include null fields in Patch requests.
  1964. NullFields []string `json:"-"`
  1965. }
  1966. func (s *MetricAbsence) MarshalJSON() ([]byte, error) {
  1967. type NoMethod MetricAbsence
  1968. raw := NoMethod(*s)
  1969. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1970. }
  1971. // MetricDescriptor: Defines a metric type and its schema. Once a metric
  1972. // descriptor is created, deleting or altering it stops data collection
  1973. // and makes the metric type's existing data unusable.
  1974. type MetricDescriptor struct {
  1975. // Description: A detailed description of the metric, which can be used
  1976. // in documentation.
  1977. Description string `json:"description,omitempty"`
  1978. // DisplayName: A concise name for the metric, which can be displayed in
  1979. // user interfaces. Use sentence case without an ending period, for
  1980. // example "Request count". This field is optional but it is recommended
  1981. // to be set for any metrics associated with user-visible concepts, such
  1982. // as Quota.
  1983. DisplayName string `json:"displayName,omitempty"`
  1984. // Labels: The set of labels that can be used to describe a specific
  1985. // instance of this metric type. For example, the
  1986. // appengine.googleapis.com/http/server/response_latencies metric type
  1987. // has a label for the HTTP response code, response_code, so you can
  1988. // look at latencies for successful responses or just for responses that
  1989. // failed.
  1990. Labels []*LabelDescriptor `json:"labels,omitempty"`
  1991. // MetricKind: Whether the metric records instantaneous values, changes
  1992. // to a value, etc. Some combinations of metric_kind and value_type
  1993. // might not be supported.
  1994. //
  1995. // Possible values:
  1996. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  1997. // "GAUGE" - An instantaneous measurement of a value.
  1998. // "DELTA" - The change in a value during a time interval.
  1999. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  2000. // measurements in a time series should have the same start time and
  2001. // increasing end times, until an event resets the cumulative value to
  2002. // zero and sets a new start time for the following points.
  2003. MetricKind string `json:"metricKind,omitempty"`
  2004. // Name: The resource name of the metric descriptor.
  2005. Name string `json:"name,omitempty"`
  2006. // Type: The metric type, including its DNS name prefix. The type is not
  2007. // URL-encoded. All user-defined custom metric types have the DNS name
  2008. // custom.googleapis.com. Metric types should use a natural hierarchical
  2009. // grouping. For
  2010. // example:
  2011. // "custom.googleapis.com/invoice/paid/amount"
  2012. // "appengine.google
  2013. // apis.com/http/server/response_latencies"
  2014. //
  2015. Type string `json:"type,omitempty"`
  2016. // Unit: Optional. The unit in which the metric value is reported. For
  2017. // example, kBy/s means kilobytes/sec, and 1 is the dimensionless unit.
  2018. // The supported units are a subset of The Unified Code for Units of
  2019. // Measure standard (http://unitsofmeasure.org/ucum.html).<br><br> This
  2020. // field is part of the metric's documentation, but it is ignored by
  2021. // Stackdriver.
  2022. Unit string `json:"unit,omitempty"`
  2023. // ValueType: Whether the measurement is an integer, a floating-point
  2024. // number, etc. Some combinations of metric_kind and value_type might
  2025. // not be supported.
  2026. //
  2027. // Possible values:
  2028. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  2029. // "BOOL" - The value is a boolean. This value type can be used only
  2030. // if the metric kind is GAUGE.
  2031. // "INT64" - The value is a signed 64-bit integer.
  2032. // "DOUBLE" - The value is a double precision floating point number.
  2033. // "STRING" - The value is a text string. This value type can be used
  2034. // only if the metric kind is GAUGE.
  2035. // "DISTRIBUTION" - The value is a Distribution.
  2036. // "MONEY" - The value is money.
  2037. ValueType string `json:"valueType,omitempty"`
  2038. // ServerResponse contains the HTTP response code and headers from the
  2039. // server.
  2040. googleapi.ServerResponse `json:"-"`
  2041. // ForceSendFields is a list of field names (e.g. "Description") to
  2042. // unconditionally include in API requests. By default, fields with
  2043. // empty values are omitted from API requests. However, any non-pointer,
  2044. // non-interface field appearing in ForceSendFields will be sent to the
  2045. // server regardless of whether the field is empty or not. This may be
  2046. // used to include empty fields in Patch requests.
  2047. ForceSendFields []string `json:"-"`
  2048. // NullFields is a list of field names (e.g. "Description") to include
  2049. // in API requests with the JSON null value. By default, fields with
  2050. // empty values are omitted from API requests. However, any field with
  2051. // an empty value appearing in NullFields will be sent to the server as
  2052. // null. It is an error if a field in this list has a non-empty value.
  2053. // This may be used to include null fields in Patch requests.
  2054. NullFields []string `json:"-"`
  2055. }
  2056. func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
  2057. type NoMethod MetricDescriptor
  2058. raw := NoMethod(*s)
  2059. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2060. }
  2061. // MetricThreshold: A condition type that compares a collection of time
  2062. // series against a threshold.
  2063. type MetricThreshold struct {
  2064. // Aggregations: Specifies the alignment of data points in individual
  2065. // time series as well as how to combine the retrieved time series
  2066. // together (such as when aggregating multiple streams on each resource
  2067. // to a single stream for each resource or when aggregating streams
  2068. // across all members of a group of resrouces). Multiple aggregations
  2069. // are applied in the order specified.This field is similar to the one
  2070. // in the MetricService.ListTimeSeries request. It is advisable to use
  2071. // the ListTimeSeries method when debugging this field.
  2072. Aggregations []*Aggregation `json:"aggregations,omitempty"`
  2073. // Comparison: The comparison to apply between the time series
  2074. // (indicated by filter and aggregation) and the threshold (indicated by
  2075. // threshold_value). The comparison is applied on each time series, with
  2076. // the time series on the left-hand side and the threshold on the
  2077. // right-hand side.Only COMPARISON_LT and COMPARISON_GT are supported
  2078. // currently.
  2079. //
  2080. // Possible values:
  2081. // "COMPARISON_UNSPECIFIED" - No ordering relationship is specified.
  2082. // "COMPARISON_GT" - The left argument is greater than the right
  2083. // argument.
  2084. // "COMPARISON_GE" - The left argument is greater than or equal to the
  2085. // right argument.
  2086. // "COMPARISON_LT" - The left argument is less than the right
  2087. // argument.
  2088. // "COMPARISON_LE" - The left argument is less than or equal to the
  2089. // right argument.
  2090. // "COMPARISON_EQ" - The left argument is equal to the right argument.
  2091. // "COMPARISON_NE" - The left argument is not equal to the right
  2092. // argument.
  2093. Comparison string `json:"comparison,omitempty"`
  2094. // DenominatorAggregations: Specifies the alignment of data points in
  2095. // individual time series selected by denominatorFilter as well as how
  2096. // to combine the retrieved time series together (such as when
  2097. // aggregating multiple streams on each resource to a single stream for
  2098. // each resource or when aggregating streams across all members of a
  2099. // group of resources).When computing ratios, the aggregations and
  2100. // denominator_aggregations fields must use the same alignment period
  2101. // and produce time series that have the same periodicity and
  2102. // labels.This field is similar to the one in the
  2103. // MetricService.ListTimeSeries request. It is advisable to use the
  2104. // ListTimeSeries method when debugging this field.
  2105. DenominatorAggregations []*Aggregation `json:"denominatorAggregations,omitempty"`
  2106. // DenominatorFilter: A filter that identifies a time series that should
  2107. // be used as the denominator of a ratio that will be compared with the
  2108. // threshold. If a denominator_filter is specified, the time series
  2109. // specified by the filter field will be used as the numerator.The
  2110. // filter is similar to the one that is specified in the
  2111. // MetricService.ListTimeSeries request (that call is useful to verify
  2112. // the time series that will be retrieved / processed) and must specify
  2113. // the metric type and optionally may contain restrictions on resource
  2114. // type, resource labels, and metric labels. This field may not exceed
  2115. // 2048 Unicode characters in length.
  2116. DenominatorFilter string `json:"denominatorFilter,omitempty"`
  2117. // Duration: The amount of time that a time series must violate the
  2118. // threshold to be considered failing. Currently, only values that are a
  2119. // multiple of a minute--e.g., 0, 60, 120, or 300 seconds--are
  2120. // supported. If an invalid value is given, an error will be returned.
  2121. // When choosing a duration, it is useful to keep in mind the frequency
  2122. // of the underlying time series data (which may also be affected by any
  2123. // alignments specified in the aggregations field); a good duration is
  2124. // long enough so that a single outlier does not generate spurious
  2125. // alerts, but short enough that unhealthy states are detected and
  2126. // alerted on quickly.
  2127. Duration string `json:"duration,omitempty"`
  2128. // Filter: A filter that identifies which time series should be compared
  2129. // with the threshold.The filter is similar to the one that is specified
  2130. // in the MetricService.ListTimeSeries request (that call is useful to
  2131. // verify the time series that will be retrieved / processed) and must
  2132. // specify the metric type and optionally may contain restrictions on
  2133. // resource type, resource labels, and metric labels. This field may not
  2134. // exceed 2048 Unicode characters in length.
  2135. Filter string `json:"filter,omitempty"`
  2136. // ThresholdValue: A value against which to compare the time series.
  2137. ThresholdValue float64 `json:"thresholdValue,omitempty"`
  2138. // Trigger: The number/percent of time series for which the comparison
  2139. // must hold in order for the condition to trigger. If unspecified, then
  2140. // the condition will trigger if the comparison is true for any of the
  2141. // time series that have been identified by filter and aggregations, or
  2142. // by the ratio, if denominator_filter and denominator_aggregations are
  2143. // specified.
  2144. Trigger *Trigger `json:"trigger,omitempty"`
  2145. // ForceSendFields is a list of field names (e.g. "Aggregations") to
  2146. // unconditionally include in API requests. By default, fields with
  2147. // empty values are omitted from API requests. However, any non-pointer,
  2148. // non-interface field appearing in ForceSendFields will be sent to the
  2149. // server regardless of whether the field is empty or not. This may be
  2150. // used to include empty fields in Patch requests.
  2151. ForceSendFields []string `json:"-"`
  2152. // NullFields is a list of field names (e.g. "Aggregations") to include
  2153. // in API requests with the JSON null value. By default, fields with
  2154. // empty values are omitted from API requests. However, any field with
  2155. // an empty value appearing in NullFields will be sent to the server as
  2156. // null. It is an error if a field in this list has a non-empty value.
  2157. // This may be used to include null fields in Patch requests.
  2158. NullFields []string `json:"-"`
  2159. }
  2160. func (s *MetricThreshold) MarshalJSON() ([]byte, error) {
  2161. type NoMethod MetricThreshold
  2162. raw := NoMethod(*s)
  2163. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2164. }
  2165. func (s *MetricThreshold) UnmarshalJSON(data []byte) error {
  2166. type NoMethod MetricThreshold
  2167. var s1 struct {
  2168. ThresholdValue gensupport.JSONFloat64 `json:"thresholdValue"`
  2169. *NoMethod
  2170. }
  2171. s1.NoMethod = (*NoMethod)(s)
  2172. if err := json.Unmarshal(data, &s1); err != nil {
  2173. return err
  2174. }
  2175. s.ThresholdValue = float64(s1.ThresholdValue)
  2176. return nil
  2177. }
  2178. // MonitoredResource: An object representing a resource that can be used
  2179. // for monitoring, logging, billing, or other purposes. Examples include
  2180. // virtual machine instances, databases, and storage devices such as
  2181. // disks. The type field identifies a MonitoredResourceDescriptor object
  2182. // that describes the resource's schema. Information in the labels field
  2183. // identifies the actual resource and its attributes according to the
  2184. // schema. For example, a particular Compute Engine VM instance could be
  2185. // represented by the following object, because the
  2186. // MonitoredResourceDescriptor for "gce_instance" has labels
  2187. // "instance_id" and "zone":
  2188. // { "type": "gce_instance",
  2189. // "labels": { "instance_id": "12345678901234",
  2190. // "zone": "us-central1-a" }}
  2191. //
  2192. type MonitoredResource struct {
  2193. // Labels: Required. Values for all of the labels listed in the
  2194. // associated monitored resource descriptor. For example, Compute Engine
  2195. // VM instances use the labels "project_id", "instance_id", and "zone".
  2196. Labels map[string]string `json:"labels,omitempty"`
  2197. // Type: Required. The monitored resource type. This field must match
  2198. // the type field of a MonitoredResourceDescriptor object. For example,
  2199. // the type of a Compute Engine VM instance is gce_instance.
  2200. Type string `json:"type,omitempty"`
  2201. // ForceSendFields is a list of field names (e.g. "Labels") to
  2202. // unconditionally include in API requests. By default, fields with
  2203. // empty values are omitted from API requests. However, any non-pointer,
  2204. // non-interface field appearing in ForceSendFields will be sent to the
  2205. // server regardless of whether the field is empty or not. This may be
  2206. // used to include empty fields in Patch requests.
  2207. ForceSendFields []string `json:"-"`
  2208. // NullFields is a list of field names (e.g. "Labels") to include in API
  2209. // requests with the JSON null value. By default, fields with empty
  2210. // values are omitted from API requests. However, any field with an
  2211. // empty value appearing in NullFields will be sent to the server as
  2212. // null. It is an error if a field in this list has a non-empty value.
  2213. // This may be used to include null fields in Patch requests.
  2214. NullFields []string `json:"-"`
  2215. }
  2216. func (s *MonitoredResource) MarshalJSON() ([]byte, error) {
  2217. type NoMethod MonitoredResource
  2218. raw := NoMethod(*s)
  2219. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2220. }
  2221. // MonitoredResourceDescriptor: An object that describes the schema of a
  2222. // MonitoredResource object using a type name and a set of labels. For
  2223. // example, the monitored resource descriptor for Google Compute Engine
  2224. // VM instances has a type of "gce_instance" and specifies the use of
  2225. // the labels "instance_id" and "zone" to identify particular VM
  2226. // instances.Different APIs can support different monitored resource
  2227. // types. APIs generally provide a list method that returns the
  2228. // monitored resource descriptors used by the API.
  2229. type MonitoredResourceDescriptor struct {
  2230. // Description: Optional. A detailed description of the monitored
  2231. // resource type that might be used in documentation.
  2232. Description string `json:"description,omitempty"`
  2233. // DisplayName: Optional. A concise name for the monitored resource type
  2234. // that might be displayed in user interfaces. It should be a Title
  2235. // Cased Noun Phrase, without any article or other determiners. For
  2236. // example, "Google Cloud SQL Database".
  2237. DisplayName string `json:"displayName,omitempty"`
  2238. // Labels: Required. A set of labels used to describe instances of this
  2239. // monitored resource type. For example, an individual Google Cloud SQL
  2240. // database is identified by values for the labels "database_id" and
  2241. // "zone".
  2242. Labels []*LabelDescriptor `json:"labels,omitempty"`
  2243. // Name: Optional. The resource name of the monitored resource
  2244. // descriptor:
  2245. // "projects/{project_id}/monitoredResourceDescriptors/{type}" where
  2246. // {type} is the value of the type field in this object and {project_id}
  2247. // is a project ID that provides API-specific context for accessing the
  2248. // type. APIs that do not use project information can use the resource
  2249. // name format "monitoredResourceDescriptors/{type}".
  2250. Name string `json:"name,omitempty"`
  2251. // Type: Required. The monitored resource type. For example, the type
  2252. // "cloudsql_database" represents databases in Google Cloud SQL. The
  2253. // maximum length of this value is 256 characters.
  2254. Type string `json:"type,omitempty"`
  2255. // ServerResponse contains the HTTP response code and headers from the
  2256. // server.
  2257. googleapi.ServerResponse `json:"-"`
  2258. // ForceSendFields is a list of field names (e.g. "Description") to
  2259. // unconditionally include in API requests. By default, fields with
  2260. // empty values are omitted from API requests. However, any non-pointer,
  2261. // non-interface field appearing in ForceSendFields will be sent to the
  2262. // server regardless of whether the field is empty or not. This may be
  2263. // used to include empty fields in Patch requests.
  2264. ForceSendFields []string `json:"-"`
  2265. // NullFields is a list of field names (e.g. "Description") to include
  2266. // in API requests with the JSON null value. By default, fields with
  2267. // empty values are omitted from API requests. However, any field with
  2268. // an empty value appearing in NullFields will be sent to the server as
  2269. // null. It is an error if a field in this list has a non-empty value.
  2270. // This may be used to include null fields in Patch requests.
  2271. NullFields []string `json:"-"`
  2272. }
  2273. func (s *MonitoredResourceDescriptor) MarshalJSON() ([]byte, error) {
  2274. type NoMethod MonitoredResourceDescriptor
  2275. raw := NoMethod(*s)
  2276. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2277. }
  2278. // MonitoredResourceMetadata: Auxiliary metadata for a MonitoredResource
  2279. // object. MonitoredResource objects contain the minimum set of
  2280. // information to uniquely identify a monitored resource instance. There
  2281. // is some other useful auxiliary metadata. Google Stackdriver
  2282. // Monitoring & Logging uses an ingestion pipeline to extract metadata
  2283. // for cloud resources of all types , and stores the metadata in this
  2284. // message.
  2285. type MonitoredResourceMetadata struct {
  2286. // SystemLabels: Output only. Values for predefined system metadata
  2287. // labels. System labels are a kind of metadata extracted by Google
  2288. // Stackdriver. Stackdriver determines what system labels are useful and
  2289. // how to obtain their values. Some examples: "machine_image", "vpc",
  2290. // "subnet_id", "security_group", "name", etc. System label values can
  2291. // be only strings, Boolean values, or a list of strings. For example:
  2292. // { "name": "my-test-instance",
  2293. // "security_group": ["a", "b", "c"],
  2294. // "spot_instance": false }
  2295. //
  2296. SystemLabels googleapi.RawMessage `json:"systemLabels,omitempty"`
  2297. // UserLabels: Output only. A map of user-defined metadata labels.
  2298. UserLabels map[string]string `json:"userLabels,omitempty"`
  2299. // ForceSendFields is a list of field names (e.g. "SystemLabels") to
  2300. // unconditionally include in API requests. By default, fields with
  2301. // empty values are omitted from API requests. However, any non-pointer,
  2302. // non-interface field appearing in ForceSendFields will be sent to the
  2303. // server regardless of whether the field is empty or not. This may be
  2304. // used to include empty fields in Patch requests.
  2305. ForceSendFields []string `json:"-"`
  2306. // NullFields is a list of field names (e.g. "SystemLabels") to include
  2307. // in API requests with the JSON null value. By default, fields with
  2308. // empty values are omitted from API requests. However, any field with
  2309. // an empty value appearing in NullFields will be sent to the server as
  2310. // null. It is an error if a field in this list has a non-empty value.
  2311. // This may be used to include null fields in Patch requests.
  2312. NullFields []string `json:"-"`
  2313. }
  2314. func (s *MonitoredResourceMetadata) MarshalJSON() ([]byte, error) {
  2315. type NoMethod MonitoredResourceMetadata
  2316. raw := NoMethod(*s)
  2317. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2318. }
  2319. // MutationRecord: Describes a change made to a configuration.
  2320. type MutationRecord struct {
  2321. // MutateTime: When the change occurred.
  2322. MutateTime string `json:"mutateTime,omitempty"`
  2323. // MutatedBy: The email address of the user making the change.
  2324. MutatedBy string `json:"mutatedBy,omitempty"`
  2325. // ForceSendFields is a list of field names (e.g. "MutateTime") to
  2326. // unconditionally include in API requests. By default, fields with
  2327. // empty values are omitted from API requests. However, any non-pointer,
  2328. // non-interface field appearing in ForceSendFields will be sent to the
  2329. // server regardless of whether the field is empty or not. This may be
  2330. // used to include empty fields in Patch requests.
  2331. ForceSendFields []string `json:"-"`
  2332. // NullFields is a list of field names (e.g. "MutateTime") to include in
  2333. // API requests with the JSON null value. By default, fields with empty
  2334. // values are omitted from API requests. However, any field with an
  2335. // empty value appearing in NullFields will be sent to the server as
  2336. // null. It is an error if a field in this list has a non-empty value.
  2337. // This may be used to include null fields in Patch requests.
  2338. NullFields []string `json:"-"`
  2339. }
  2340. func (s *MutationRecord) MarshalJSON() ([]byte, error) {
  2341. type NoMethod MutationRecord
  2342. raw := NoMethod(*s)
  2343. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2344. }
  2345. // NotificationChannel: A NotificationChannel is a medium through which
  2346. // an alert is delivered when a policy violation is detected. Examples
  2347. // of channels include email, SMS, and third-party messaging
  2348. // applications. Fields containing sensitive information like
  2349. // authentication tokens or contact info are only partially populated on
  2350. // retrieval.
  2351. type NotificationChannel struct {
  2352. // Description: An optional human-readable description of this
  2353. // notification channel. This description may provide additional
  2354. // details, beyond the display name, for the channel. This may not
  2355. // exceeed 1024 Unicode characters.
  2356. Description string `json:"description,omitempty"`
  2357. // DisplayName: An optional human-readable name for this notification
  2358. // channel. It is recommended that you specify a non-empty and unique
  2359. // name in order to make it easier to identify the channels in your
  2360. // project, though this is not enforced. The display name is limited to
  2361. // 512 Unicode characters.
  2362. DisplayName string `json:"displayName,omitempty"`
  2363. // Enabled: Whether notifications are forwarded to the described
  2364. // channel. This makes it possible to disable delivery of notifications
  2365. // to a particular channel without removing the channel from all
  2366. // alerting policies that reference the channel. This is a more
  2367. // convenient approach when the change is temporary and you want to
  2368. // receive notifications from the same set of alerting policies on the
  2369. // channel at some point in the future.
  2370. Enabled bool `json:"enabled,omitempty"`
  2371. // Labels: Configuration fields that define the channel and its
  2372. // behavior. The permissible and required labels are specified in the
  2373. // NotificationChannelDescriptor.labels of the
  2374. // NotificationChannelDescriptor corresponding to the type field.
  2375. Labels map[string]string `json:"labels,omitempty"`
  2376. // Name: The full REST resource name for this channel. The syntax
  2377. // is:
  2378. // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
  2379. // The [CHANNEL_ID] is automatically assigned by the server on creation.
  2380. Name string `json:"name,omitempty"`
  2381. // Type: The type of the notification channel. This field matches the
  2382. // value of the NotificationChannelDescriptor.type field.
  2383. Type string `json:"type,omitempty"`
  2384. // UserLabels: User-supplied key/value data that does not need to
  2385. // conform to the corresponding NotificationChannelDescriptor's schema,
  2386. // unlike the labels field. This field is intended to be used for
  2387. // organizing and identifying the NotificationChannel objects.The field
  2388. // can contain up to 64 entries. Each key and value is limited to 63
  2389. // Unicode characters or 128 bytes, whichever is smaller. Labels and
  2390. // values can contain only lowercase letters, numerals, underscores, and
  2391. // dashes. Keys must begin with a letter.
  2392. UserLabels map[string]string `json:"userLabels,omitempty"`
  2393. // VerificationStatus: Indicates whether this channel has been verified
  2394. // or not. On a ListNotificationChannels or GetNotificationChannel
  2395. // operation, this field is expected to be populated.If the value is
  2396. // UNVERIFIED, then it indicates that the channel is non-functioning (it
  2397. // both requires verification and lacks verification); otherwise, it is
  2398. // assumed that the channel works.If the channel is neither VERIFIED nor
  2399. // UNVERIFIED, it implies that the channel is of a type that does not
  2400. // require verification or that this specific channel has been exempted
  2401. // from verification because it was created prior to verification being
  2402. // required for channels of this type.This field cannot be modified
  2403. // using a standard UpdateNotificationChannel operation. To change the
  2404. // value of this field, you must call VerifyNotificationChannel.
  2405. //
  2406. // Possible values:
  2407. // "VERIFICATION_STATUS_UNSPECIFIED" - Sentinel value used to indicate
  2408. // that the state is unknown, omitted, or is not applicable (as in the
  2409. // case of channels that neither support nor require verification in
  2410. // order to function).
  2411. // "UNVERIFIED" - The channel has yet to be verified and requires
  2412. // verification to function. Note that this state also applies to the
  2413. // case where the verification process has been initiated by sending a
  2414. // verification code but where the verification code has not been
  2415. // submitted to complete the process.
  2416. // "VERIFIED" - It has been proven that notifications can be received
  2417. // on this notification channel and that someone on the project has
  2418. // access to messages that are delivered to that channel.
  2419. VerificationStatus string `json:"verificationStatus,omitempty"`
  2420. // ServerResponse contains the HTTP response code and headers from the
  2421. // server.
  2422. googleapi.ServerResponse `json:"-"`
  2423. // ForceSendFields is a list of field names (e.g. "Description") to
  2424. // unconditionally include in API requests. By default, fields with
  2425. // empty values are omitted from API requests. However, any non-pointer,
  2426. // non-interface field appearing in ForceSendFields will be sent to the
  2427. // server regardless of whether the field is empty or not. This may be
  2428. // used to include empty fields in Patch requests.
  2429. ForceSendFields []string `json:"-"`
  2430. // NullFields is a list of field names (e.g. "Description") to include
  2431. // in API requests with the JSON null value. By default, fields with
  2432. // empty values are omitted from API requests. However, any field with
  2433. // an empty value appearing in NullFields will be sent to the server as
  2434. // null. It is an error if a field in this list has a non-empty value.
  2435. // This may be used to include null fields in Patch requests.
  2436. NullFields []string `json:"-"`
  2437. }
  2438. func (s *NotificationChannel) MarshalJSON() ([]byte, error) {
  2439. type NoMethod NotificationChannel
  2440. raw := NoMethod(*s)
  2441. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2442. }
  2443. // NotificationChannelDescriptor: A description of a notification
  2444. // channel. The descriptor includes the properties of the channel and
  2445. // the set of labels or fields that must be specified to configure
  2446. // channels of a given type.
  2447. type NotificationChannelDescriptor struct {
  2448. // Description: A human-readable description of the notification channel
  2449. // type. The description may include a description of the properties of
  2450. // the channel and pointers to external documentation.
  2451. Description string `json:"description,omitempty"`
  2452. // DisplayName: A human-readable name for the notification channel type.
  2453. // This form of the name is suitable for a user interface.
  2454. DisplayName string `json:"displayName,omitempty"`
  2455. // Labels: The set of labels that must be defined to identify a
  2456. // particular channel of the corresponding type. Each label includes a
  2457. // description for how that field should be populated.
  2458. Labels []*LabelDescriptor `json:"labels,omitempty"`
  2459. // Name: The full REST resource name for this descriptor. The syntax
  2460. // is:
  2461. // projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE]
  2462. // In the above, [TYPE] is the value of the type field.
  2463. Name string `json:"name,omitempty"`
  2464. // SupportedTiers: The tiers that support this notification channel; the
  2465. // project service tier must be one of the supported_tiers.
  2466. //
  2467. // Possible values:
  2468. // "SERVICE_TIER_UNSPECIFIED" - An invalid sentinel value, used to
  2469. // indicate that a tier has not been provided explicitly.
  2470. // "SERVICE_TIER_BASIC" - The Stackdriver Basic tier, a free tier of
  2471. // service that provides basic features, a moderate allotment of logs,
  2472. // and access to built-in metrics. A number of features are not
  2473. // available in this tier. For more details, see the service tiers
  2474. // documentation (https://cloud.google.com/monitoring/accounts/tiers).
  2475. // "SERVICE_TIER_PREMIUM" - The Stackdriver Premium tier, a higher,
  2476. // more expensive tier of service that provides access to all
  2477. // Stackdriver features, lets you use Stackdriver with AWS accounts, and
  2478. // has a larger allotments for logs and metrics. For more details, see
  2479. // the service tiers documentation
  2480. // (https://cloud.google.com/monitoring/accounts/tiers).
  2481. SupportedTiers []string `json:"supportedTiers,omitempty"`
  2482. // Type: The type of notification channel, such as "email", "sms", etc.
  2483. // Notification channel types are globally unique.
  2484. Type string `json:"type,omitempty"`
  2485. // ServerResponse contains the HTTP response code and headers from the
  2486. // server.
  2487. googleapi.ServerResponse `json:"-"`
  2488. // ForceSendFields is a list of field names (e.g. "Description") to
  2489. // unconditionally include in API requests. By default, fields with
  2490. // empty values are omitted from API requests. However, any non-pointer,
  2491. // non-interface field appearing in ForceSendFields will be sent to the
  2492. // server regardless of whether the field is empty or not. This may be
  2493. // used to include empty fields in Patch requests.
  2494. ForceSendFields []string `json:"-"`
  2495. // NullFields is a list of field names (e.g. "Description") to include
  2496. // in API requests with the JSON null value. By default, fields with
  2497. // empty values are omitted from API requests. However, any field with
  2498. // an empty value appearing in NullFields will be sent to the server as
  2499. // null. It is an error if a field in this list has a non-empty value.
  2500. // This may be used to include null fields in Patch requests.
  2501. NullFields []string `json:"-"`
  2502. }
  2503. func (s *NotificationChannelDescriptor) MarshalJSON() ([]byte, error) {
  2504. type NoMethod NotificationChannelDescriptor
  2505. raw := NoMethod(*s)
  2506. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2507. }
  2508. // Option: A protocol buffer option, which can be attached to a message,
  2509. // field, enumeration, etc.
  2510. type Option struct {
  2511. // Name: The option's name. For protobuf built-in options (options
  2512. // defined in descriptor.proto), this is the short name. For example,
  2513. // "map_entry". For custom options, it should be the fully-qualified
  2514. // name. For example, "google.api.http".
  2515. Name string `json:"name,omitempty"`
  2516. // Value: The option's value packed in an Any message. If the value is a
  2517. // primitive, the corresponding wrapper type defined in
  2518. // google/protobuf/wrappers.proto should be used. If the value is an
  2519. // enum, it should be stored as an int32 value using the
  2520. // google.protobuf.Int32Value type.
  2521. Value googleapi.RawMessage `json:"value,omitempty"`
  2522. // ForceSendFields is a list of field names (e.g. "Name") to
  2523. // unconditionally include in API requests. By default, fields with
  2524. // empty values are omitted from API requests. However, any non-pointer,
  2525. // non-interface field appearing in ForceSendFields will be sent to the
  2526. // server regardless of whether the field is empty or not. This may be
  2527. // used to include empty fields in Patch requests.
  2528. ForceSendFields []string `json:"-"`
  2529. // NullFields is a list of field names (e.g. "Name") to include in API
  2530. // requests with the JSON null value. By default, fields with empty
  2531. // values are omitted from API requests. However, any field with an
  2532. // empty value appearing in NullFields will be sent to the server as
  2533. // null. It is an error if a field in this list has a non-empty value.
  2534. // This may be used to include null fields in Patch requests.
  2535. NullFields []string `json:"-"`
  2536. }
  2537. func (s *Option) MarshalJSON() ([]byte, error) {
  2538. type NoMethod Option
  2539. raw := NoMethod(*s)
  2540. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2541. }
  2542. // Point: A single data point in a time series.
  2543. type Point struct {
  2544. // Interval: The time interval to which the data point applies. For
  2545. // GAUGE metrics, only the end time of the interval is used. For DELTA
  2546. // metrics, the start and end time should specify a non-zero interval,
  2547. // with subsequent points specifying contiguous and non-overlapping
  2548. // intervals. For CUMULATIVE metrics, the start and end time should
  2549. // specify a non-zero interval, with subsequent points specifying the
  2550. // same start time and increasing end times, until an event resets the
  2551. // cumulative value to zero and sets a new start time for the following
  2552. // points.
  2553. Interval *TimeInterval `json:"interval,omitempty"`
  2554. // Value: The value of the data point.
  2555. Value *TypedValue `json:"value,omitempty"`
  2556. // ForceSendFields is a list of field names (e.g. "Interval") to
  2557. // unconditionally include in API requests. By default, fields with
  2558. // empty values are omitted from API requests. However, any non-pointer,
  2559. // non-interface field appearing in ForceSendFields will be sent to the
  2560. // server regardless of whether the field is empty or not. This may be
  2561. // used to include empty fields in Patch requests.
  2562. ForceSendFields []string `json:"-"`
  2563. // NullFields is a list of field names (e.g. "Interval") to include in
  2564. // API requests with the JSON null value. By default, fields with empty
  2565. // values are omitted from API requests. However, any field with an
  2566. // empty value appearing in NullFields will be sent to the server as
  2567. // null. It is an error if a field in this list has a non-empty value.
  2568. // This may be used to include null fields in Patch requests.
  2569. NullFields []string `json:"-"`
  2570. }
  2571. func (s *Point) MarshalJSON() ([]byte, error) {
  2572. type NoMethod Point
  2573. raw := NoMethod(*s)
  2574. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2575. }
  2576. // Range: The range of the population values.
  2577. type Range struct {
  2578. // Max: The maximum of the population values.
  2579. Max float64 `json:"max,omitempty"`
  2580. // Min: The minimum of the population values.
  2581. Min float64 `json:"min,omitempty"`
  2582. // ForceSendFields is a list of field names (e.g. "Max") to
  2583. // unconditionally include in API requests. By default, fields with
  2584. // empty values are omitted from API requests. However, any non-pointer,
  2585. // non-interface field appearing in ForceSendFields will be sent to the
  2586. // server regardless of whether the field is empty or not. This may be
  2587. // used to include empty fields in Patch requests.
  2588. ForceSendFields []string `json:"-"`
  2589. // NullFields is a list of field names (e.g. "Max") to include in API
  2590. // requests with the JSON null value. By default, fields with empty
  2591. // values are omitted from API requests. However, any field with an
  2592. // empty value appearing in NullFields will be sent to the server as
  2593. // null. It is an error if a field in this list has a non-empty value.
  2594. // This may be used to include null fields in Patch requests.
  2595. NullFields []string `json:"-"`
  2596. }
  2597. func (s *Range) MarshalJSON() ([]byte, error) {
  2598. type NoMethod Range
  2599. raw := NoMethod(*s)
  2600. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2601. }
  2602. func (s *Range) UnmarshalJSON(data []byte) error {
  2603. type NoMethod Range
  2604. var s1 struct {
  2605. Max gensupport.JSONFloat64 `json:"max"`
  2606. Min gensupport.JSONFloat64 `json:"min"`
  2607. *NoMethod
  2608. }
  2609. s1.NoMethod = (*NoMethod)(s)
  2610. if err := json.Unmarshal(data, &s1); err != nil {
  2611. return err
  2612. }
  2613. s.Max = float64(s1.Max)
  2614. s.Min = float64(s1.Min)
  2615. return nil
  2616. }
  2617. // ResourceGroup: The resource submessage for group checks. It can be
  2618. // used instead of a monitored resource, when multiple resources are
  2619. // being monitored.
  2620. type ResourceGroup struct {
  2621. // GroupId: The group of resources being monitored. Should be only the
  2622. // group_id, not projects/<project_id>/groups/<group_id>.
  2623. GroupId string `json:"groupId,omitempty"`
  2624. // ResourceType: The resource type of the group members.
  2625. //
  2626. // Possible values:
  2627. // "RESOURCE_TYPE_UNSPECIFIED" - Default value (not valid).
  2628. // "INSTANCE" - A group of instances from Google Cloud Platform (GCP)
  2629. // or Amazon Web Services (AWS).
  2630. // "AWS_ELB_LOAD_BALANCER" - A group of Amazon ELB load balancers.
  2631. ResourceType string `json:"resourceType,omitempty"`
  2632. // ForceSendFields is a list of field names (e.g. "GroupId") to
  2633. // unconditionally include in API requests. By default, fields with
  2634. // empty values are omitted from API requests. However, any non-pointer,
  2635. // non-interface field appearing in ForceSendFields will be sent to the
  2636. // server regardless of whether the field is empty or not. This may be
  2637. // used to include empty fields in Patch requests.
  2638. ForceSendFields []string `json:"-"`
  2639. // NullFields is a list of field names (e.g. "GroupId") to include in
  2640. // API requests with the JSON null value. By default, fields with empty
  2641. // values are omitted from API requests. However, any field with an
  2642. // empty value appearing in NullFields will be sent to the server as
  2643. // null. It is an error if a field in this list has a non-empty value.
  2644. // This may be used to include null fields in Patch requests.
  2645. NullFields []string `json:"-"`
  2646. }
  2647. func (s *ResourceGroup) MarshalJSON() ([]byte, error) {
  2648. type NoMethod ResourceGroup
  2649. raw := NoMethod(*s)
  2650. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2651. }
  2652. // SendNotificationChannelVerificationCodeRequest: The
  2653. // SendNotificationChannelVerificationCode request.
  2654. type SendNotificationChannelVerificationCodeRequest struct {
  2655. }
  2656. // SourceContext: SourceContext represents information about the source
  2657. // of a protobuf element, like the file in which it is defined.
  2658. type SourceContext struct {
  2659. // FileName: The path-qualified name of the .proto file that contained
  2660. // the associated protobuf element. For example:
  2661. // "google/protobuf/source_context.proto".
  2662. FileName string `json:"fileName,omitempty"`
  2663. // ForceSendFields is a list of field names (e.g. "FileName") to
  2664. // unconditionally include in API requests. By default, fields with
  2665. // empty values are omitted from API requests. However, any non-pointer,
  2666. // non-interface field appearing in ForceSendFields will be sent to the
  2667. // server regardless of whether the field is empty or not. This may be
  2668. // used to include empty fields in Patch requests.
  2669. ForceSendFields []string `json:"-"`
  2670. // NullFields is a list of field names (e.g. "FileName") to include in
  2671. // API requests with the JSON null value. By default, fields with empty
  2672. // values are omitted from API requests. However, any field with an
  2673. // empty value appearing in NullFields will be sent to the server as
  2674. // null. It is an error if a field in this list has a non-empty value.
  2675. // This may be used to include null fields in Patch requests.
  2676. NullFields []string `json:"-"`
  2677. }
  2678. func (s *SourceContext) MarshalJSON() ([]byte, error) {
  2679. type NoMethod SourceContext
  2680. raw := NoMethod(*s)
  2681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2682. }
  2683. // Status: The Status type defines a logical error model that is
  2684. // suitable for different programming environments, including REST APIs
  2685. // and RPC APIs. It is used by gRPC (https://github.com/grpc). The error
  2686. // model is designed to be:
  2687. // Simple to use and understand for most users
  2688. // Flexible enough to meet unexpected needsOverviewThe Status message
  2689. // contains three pieces of data: error code, error message, and error
  2690. // details. The error code should be an enum value of google.rpc.Code,
  2691. // but it may accept additional error codes if needed. The error message
  2692. // should be a developer-facing English message that helps developers
  2693. // understand and resolve the error. If a localized user-facing error
  2694. // message is needed, put the localized message in the error details or
  2695. // localize it in the client. The optional error details may contain
  2696. // arbitrary information about the error. There is a predefined set of
  2697. // error detail types in the package google.rpc that can be used for
  2698. // common error conditions.Language mappingThe Status message is the
  2699. // logical representation of the error model, but it is not necessarily
  2700. // the actual wire format. When the Status message is exposed in
  2701. // different client libraries and different wire protocols, it can be
  2702. // mapped differently. For example, it will likely be mapped to some
  2703. // exceptions in Java, but more likely mapped to some error codes in
  2704. // C.Other usesThe error model and the Status message can be used in a
  2705. // variety of environments, either with or without APIs, to provide a
  2706. // consistent developer experience across different environments.Example
  2707. // uses of this error model include:
  2708. // Partial errors. If a service needs to return partial errors to the
  2709. // client, it may embed the Status in the normal response to indicate
  2710. // the partial errors.
  2711. // Workflow errors. A typical workflow has multiple steps. Each step may
  2712. // have a Status message for error reporting.
  2713. // Batch operations. If a client uses batch request and batch response,
  2714. // the Status message should be used directly inside batch response, one
  2715. // for each error sub-response.
  2716. // Asynchronous operations. If an API call embeds asynchronous operation
  2717. // results in its response, the status of those operations should be
  2718. // represented directly using the Status message.
  2719. // Logging. If some API errors are stored in logs, the message Status
  2720. // could be used directly after any stripping needed for
  2721. // security/privacy reasons.
  2722. type Status struct {
  2723. // Code: The status code, which should be an enum value of
  2724. // google.rpc.Code.
  2725. Code int64 `json:"code,omitempty"`
  2726. // Details: A list of messages that carry the error details. There is a
  2727. // common set of message types for APIs to use.
  2728. Details []googleapi.RawMessage `json:"details,omitempty"`
  2729. // Message: A developer-facing error message, which should be in
  2730. // English. Any user-facing error message should be localized and sent
  2731. // in the google.rpc.Status.details field, or localized by the client.
  2732. Message string `json:"message,omitempty"`
  2733. // ForceSendFields is a list of field names (e.g. "Code") to
  2734. // unconditionally include in API requests. By default, fields with
  2735. // empty values are omitted from API requests. However, any non-pointer,
  2736. // non-interface field appearing in ForceSendFields will be sent to the
  2737. // server regardless of whether the field is empty or not. This may be
  2738. // used to include empty fields in Patch requests.
  2739. ForceSendFields []string `json:"-"`
  2740. // NullFields is a list of field names (e.g. "Code") to include in API
  2741. // requests with the JSON null value. By default, fields with empty
  2742. // values are omitted from API requests. However, any field with an
  2743. // empty value appearing in NullFields will be sent to the server as
  2744. // null. It is an error if a field in this list has a non-empty value.
  2745. // This may be used to include null fields in Patch requests.
  2746. NullFields []string `json:"-"`
  2747. }
  2748. func (s *Status) MarshalJSON() ([]byte, error) {
  2749. type NoMethod Status
  2750. raw := NoMethod(*s)
  2751. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2752. }
  2753. // TcpCheck: Information required for a TCP uptime check request.
  2754. type TcpCheck struct {
  2755. // Port: The port to the page to run the check against. Will be combined
  2756. // with host (specified within the MonitoredResource) to construct the
  2757. // full URL. Required.
  2758. Port int64 `json:"port,omitempty"`
  2759. // ForceSendFields is a list of field names (e.g. "Port") to
  2760. // unconditionally include in API requests. By default, fields with
  2761. // empty values are omitted from API requests. However, any non-pointer,
  2762. // non-interface field appearing in ForceSendFields will be sent to the
  2763. // server regardless of whether the field is empty or not. This may be
  2764. // used to include empty fields in Patch requests.
  2765. ForceSendFields []string `json:"-"`
  2766. // NullFields is a list of field names (e.g. "Port") to include in API
  2767. // requests with the JSON null value. By default, fields with empty
  2768. // values are omitted from API requests. However, any field with an
  2769. // empty value appearing in NullFields will be sent to the server as
  2770. // null. It is an error if a field in this list has a non-empty value.
  2771. // This may be used to include null fields in Patch requests.
  2772. NullFields []string `json:"-"`
  2773. }
  2774. func (s *TcpCheck) MarshalJSON() ([]byte, error) {
  2775. type NoMethod TcpCheck
  2776. raw := NoMethod(*s)
  2777. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2778. }
  2779. // TimeInterval: A time interval extending just after a start time
  2780. // through an end time. If the start time is the same as the end time,
  2781. // then the interval represents a single point in time.
  2782. type TimeInterval struct {
  2783. // EndTime: Required. The end of the time interval.
  2784. EndTime string `json:"endTime,omitempty"`
  2785. // StartTime: Optional. The beginning of the time interval. The default
  2786. // value for the start time is the end time. The start time must not be
  2787. // later than the end time.
  2788. StartTime string `json:"startTime,omitempty"`
  2789. // ForceSendFields is a list of field names (e.g. "EndTime") to
  2790. // unconditionally include in API requests. By default, fields with
  2791. // empty values are omitted from API requests. However, any non-pointer,
  2792. // non-interface field appearing in ForceSendFields will be sent to the
  2793. // server regardless of whether the field is empty or not. This may be
  2794. // used to include empty fields in Patch requests.
  2795. ForceSendFields []string `json:"-"`
  2796. // NullFields is a list of field names (e.g. "EndTime") to include in
  2797. // API requests with the JSON null value. By default, fields with empty
  2798. // values are omitted from API requests. However, any field with an
  2799. // empty value appearing in NullFields will be sent to the server as
  2800. // null. It is an error if a field in this list has a non-empty value.
  2801. // This may be used to include null fields in Patch requests.
  2802. NullFields []string `json:"-"`
  2803. }
  2804. func (s *TimeInterval) MarshalJSON() ([]byte, error) {
  2805. type NoMethod TimeInterval
  2806. raw := NoMethod(*s)
  2807. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2808. }
  2809. // TimeSeries: A collection of data points that describes the
  2810. // time-varying values of a metric. A time series is identified by a
  2811. // combination of a fully-specified monitored resource and a
  2812. // fully-specified metric. This type is used for both listing and
  2813. // creating time series.
  2814. type TimeSeries struct {
  2815. // Metadata: Output only. The associated monitored resource metadata.
  2816. // When reading a a timeseries, this field will include metadata labels
  2817. // that are explicitly named in the reduction. When creating a
  2818. // timeseries, this field is ignored.
  2819. Metadata *MonitoredResourceMetadata `json:"metadata,omitempty"`
  2820. // Metric: The associated metric. A fully-specified metric used to
  2821. // identify the time series.
  2822. Metric *Metric `json:"metric,omitempty"`
  2823. // MetricKind: The metric kind of the time series. When listing time
  2824. // series, this metric kind might be different from the metric kind of
  2825. // the associated metric if this time series is an alignment or
  2826. // reduction of other time series.When creating a time series, this
  2827. // field is optional. If present, it must be the same as the metric kind
  2828. // of the associated metric. If the associated metric's descriptor must
  2829. // be auto-created, then this field specifies the metric kind of the new
  2830. // descriptor and must be either GAUGE (the default) or CUMULATIVE.
  2831. //
  2832. // Possible values:
  2833. // "METRIC_KIND_UNSPECIFIED" - Do not use this default value.
  2834. // "GAUGE" - An instantaneous measurement of a value.
  2835. // "DELTA" - The change in a value during a time interval.
  2836. // "CUMULATIVE" - A value accumulated over a time interval. Cumulative
  2837. // measurements in a time series should have the same start time and
  2838. // increasing end times, until an event resets the cumulative value to
  2839. // zero and sets a new start time for the following points.
  2840. MetricKind string `json:"metricKind,omitempty"`
  2841. // Points: The data points of this time series. When listing time
  2842. // series, points are returned in reverse time order.When creating a
  2843. // time series, this field must contain exactly one point and the
  2844. // point's type must be the same as the value type of the associated
  2845. // metric. If the associated metric's descriptor must be auto-created,
  2846. // then the value type of the descriptor is determined by the point's
  2847. // type, which must be BOOL, INT64, DOUBLE, or DISTRIBUTION.
  2848. Points []*Point `json:"points,omitempty"`
  2849. // Resource: The associated monitored resource. Custom metrics can use
  2850. // only certain monitored resource types in their time series data.
  2851. Resource *MonitoredResource `json:"resource,omitempty"`
  2852. // ValueType: The value type of the time series. When listing time
  2853. // series, this value type might be different from the value type of the
  2854. // associated metric if this time series is an alignment or reduction of
  2855. // other time series.When creating a time series, this field is
  2856. // optional. If present, it must be the same as the type of the data in
  2857. // the points field.
  2858. //
  2859. // Possible values:
  2860. // "VALUE_TYPE_UNSPECIFIED" - Do not use this default value.
  2861. // "BOOL" - The value is a boolean. This value type can be used only
  2862. // if the metric kind is GAUGE.
  2863. // "INT64" - The value is a signed 64-bit integer.
  2864. // "DOUBLE" - The value is a double precision floating point number.
  2865. // "STRING" - The value is a text string. This value type can be used
  2866. // only if the metric kind is GAUGE.
  2867. // "DISTRIBUTION" - The value is a Distribution.
  2868. // "MONEY" - The value is money.
  2869. ValueType string `json:"valueType,omitempty"`
  2870. // ForceSendFields is a list of field names (e.g. "Metadata") to
  2871. // unconditionally include in API requests. By default, fields with
  2872. // empty values are omitted from API requests. However, any non-pointer,
  2873. // non-interface field appearing in ForceSendFields will be sent to the
  2874. // server regardless of whether the field is empty or not. This may be
  2875. // used to include empty fields in Patch requests.
  2876. ForceSendFields []string `json:"-"`
  2877. // NullFields is a list of field names (e.g. "Metadata") to include in
  2878. // API requests with the JSON null value. By default, fields with empty
  2879. // values are omitted from API requests. However, any field with an
  2880. // empty value appearing in NullFields will be sent to the server as
  2881. // null. It is an error if a field in this list has a non-empty value.
  2882. // This may be used to include null fields in Patch requests.
  2883. NullFields []string `json:"-"`
  2884. }
  2885. func (s *TimeSeries) MarshalJSON() ([]byte, error) {
  2886. type NoMethod TimeSeries
  2887. raw := NoMethod(*s)
  2888. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2889. }
  2890. // Trigger: Specifies how many time series must fail a predicate to
  2891. // trigger a condition. If not specified, then a {count: 1} trigger is
  2892. // used.
  2893. type Trigger struct {
  2894. // Count: The absolute number of time series that must fail the
  2895. // predicate for the condition to be triggered.
  2896. Count int64 `json:"count,omitempty"`
  2897. // Percent: The percentage of time series that must fail the predicate
  2898. // for the condition to be triggered.
  2899. Percent float64 `json:"percent,omitempty"`
  2900. // ForceSendFields is a list of field names (e.g. "Count") to
  2901. // unconditionally include in API requests. By default, fields with
  2902. // empty values are omitted from API requests. However, any non-pointer,
  2903. // non-interface field appearing in ForceSendFields will be sent to the
  2904. // server regardless of whether the field is empty or not. This may be
  2905. // used to include empty fields in Patch requests.
  2906. ForceSendFields []string `json:"-"`
  2907. // NullFields is a list of field names (e.g. "Count") to include in API
  2908. // requests with the JSON null value. By default, fields with empty
  2909. // values are omitted from API requests. However, any field with an
  2910. // empty value appearing in NullFields will be sent to the server as
  2911. // null. It is an error if a field in this list has a non-empty value.
  2912. // This may be used to include null fields in Patch requests.
  2913. NullFields []string `json:"-"`
  2914. }
  2915. func (s *Trigger) MarshalJSON() ([]byte, error) {
  2916. type NoMethod Trigger
  2917. raw := NoMethod(*s)
  2918. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2919. }
  2920. func (s *Trigger) UnmarshalJSON(data []byte) error {
  2921. type NoMethod Trigger
  2922. var s1 struct {
  2923. Percent gensupport.JSONFloat64 `json:"percent"`
  2924. *NoMethod
  2925. }
  2926. s1.NoMethod = (*NoMethod)(s)
  2927. if err := json.Unmarshal(data, &s1); err != nil {
  2928. return err
  2929. }
  2930. s.Percent = float64(s1.Percent)
  2931. return nil
  2932. }
  2933. // Type: A protocol buffer message type.
  2934. type Type struct {
  2935. // Fields: The list of fields.
  2936. Fields []*Field `json:"fields,omitempty"`
  2937. // Name: The fully qualified message name.
  2938. Name string `json:"name,omitempty"`
  2939. // Oneofs: The list of types appearing in oneof definitions in this
  2940. // type.
  2941. Oneofs []string `json:"oneofs,omitempty"`
  2942. // Options: The protocol buffer options.
  2943. Options []*Option `json:"options,omitempty"`
  2944. // SourceContext: The source context.
  2945. SourceContext *SourceContext `json:"sourceContext,omitempty"`
  2946. // Syntax: The source syntax.
  2947. //
  2948. // Possible values:
  2949. // "SYNTAX_PROTO2" - Syntax proto2.
  2950. // "SYNTAX_PROTO3" - Syntax proto3.
  2951. Syntax string `json:"syntax,omitempty"`
  2952. // ForceSendFields is a list of field names (e.g. "Fields") to
  2953. // unconditionally include in API requests. By default, fields with
  2954. // empty values are omitted from API requests. However, any non-pointer,
  2955. // non-interface field appearing in ForceSendFields will be sent to the
  2956. // server regardless of whether the field is empty or not. This may be
  2957. // used to include empty fields in Patch requests.
  2958. ForceSendFields []string `json:"-"`
  2959. // NullFields is a list of field names (e.g. "Fields") to include in API
  2960. // requests with the JSON null value. By default, fields with empty
  2961. // values are omitted from API requests. However, any field with an
  2962. // empty value appearing in NullFields will be sent to the server as
  2963. // null. It is an error if a field in this list has a non-empty value.
  2964. // This may be used to include null fields in Patch requests.
  2965. NullFields []string `json:"-"`
  2966. }
  2967. func (s *Type) MarshalJSON() ([]byte, error) {
  2968. type NoMethod Type
  2969. raw := NoMethod(*s)
  2970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2971. }
  2972. // TypedValue: A single strongly-typed value.
  2973. type TypedValue struct {
  2974. // BoolValue: A Boolean value: true or false.
  2975. BoolValue *bool `json:"boolValue,omitempty"`
  2976. // DistributionValue: A distribution value.
  2977. DistributionValue *Distribution `json:"distributionValue,omitempty"`
  2978. // DoubleValue: A 64-bit double-precision floating-point number. Its
  2979. // magnitude is approximately &plusmn;10<sup>&plusmn;300</sup> and it
  2980. // has 16 significant digits of precision.
  2981. DoubleValue *float64 `json:"doubleValue,omitempty"`
  2982. // Int64Value: A 64-bit integer. Its range is approximately
  2983. // &plusmn;9.2x10<sup>18</sup>.
  2984. Int64Value *int64 `json:"int64Value,omitempty,string"`
  2985. // StringValue: A variable-length string value.
  2986. StringValue *string `json:"stringValue,omitempty"`
  2987. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  2988. // unconditionally include in API requests. By default, fields with
  2989. // empty values are omitted from API requests. However, any non-pointer,
  2990. // non-interface field appearing in ForceSendFields will be sent to the
  2991. // server regardless of whether the field is empty or not. This may be
  2992. // used to include empty fields in Patch requests.
  2993. ForceSendFields []string `json:"-"`
  2994. // NullFields is a list of field names (e.g. "BoolValue") to include in
  2995. // API requests with the JSON null value. By default, fields with empty
  2996. // values are omitted from API requests. However, any field with an
  2997. // empty value appearing in NullFields will be sent to the server as
  2998. // null. It is an error if a field in this list has a non-empty value.
  2999. // This may be used to include null fields in Patch requests.
  3000. NullFields []string `json:"-"`
  3001. }
  3002. func (s *TypedValue) MarshalJSON() ([]byte, error) {
  3003. type NoMethod TypedValue
  3004. raw := NoMethod(*s)
  3005. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3006. }
  3007. func (s *TypedValue) UnmarshalJSON(data []byte) error {
  3008. type NoMethod TypedValue
  3009. var s1 struct {
  3010. DoubleValue *gensupport.JSONFloat64 `json:"doubleValue"`
  3011. *NoMethod
  3012. }
  3013. s1.NoMethod = (*NoMethod)(s)
  3014. if err := json.Unmarshal(data, &s1); err != nil {
  3015. return err
  3016. }
  3017. if s1.DoubleValue != nil {
  3018. s.DoubleValue = (*float64)(s1.DoubleValue)
  3019. }
  3020. return nil
  3021. }
  3022. // UptimeCheckConfig: This message configures which resources and
  3023. // services to monitor for availability.
  3024. type UptimeCheckConfig struct {
  3025. // ContentMatchers: The expected content on the page the check is run
  3026. // against. Currently, only the first entry in the list is supported,
  3027. // and other entries will be ignored. The server will look for an exact
  3028. // match of the string in the page response's content. This field is
  3029. // optional and should only be specified if a content match is required.
  3030. ContentMatchers []*ContentMatcher `json:"contentMatchers,omitempty"`
  3031. // DisplayName: A human-friendly name for the uptime check
  3032. // configuration. The display name should be unique within a Stackdriver
  3033. // Account in order to make it easier to identify; however, uniqueness
  3034. // is not enforced. Required.
  3035. DisplayName string `json:"displayName,omitempty"`
  3036. // HttpCheck: Contains information needed to make an HTTP or HTTPS
  3037. // check.
  3038. HttpCheck *HttpCheck `json:"httpCheck,omitempty"`
  3039. // InternalCheckers: The internal checkers that this check will egress
  3040. // from. If is_internal is true and this list is empty, the check will
  3041. // egress from all InternalCheckers configured for the project that owns
  3042. // this CheckConfig.
  3043. InternalCheckers []*InternalChecker `json:"internalCheckers,omitempty"`
  3044. // IsInternal: Denotes whether this is a check that egresses from
  3045. // InternalCheckers.
  3046. IsInternal bool `json:"isInternal,omitempty"`
  3047. // MonitoredResource: The monitored resource
  3048. // (https://cloud.google.com/monitoring/api/resources) associated with
  3049. // the configuration. The following monitored resource types are
  3050. // supported for uptime checks: uptime_url gce_instance gae_app
  3051. // aws_ec2_instance aws_elb_load_balancer
  3052. MonitoredResource *MonitoredResource `json:"monitoredResource,omitempty"`
  3053. // Name: A unique resource name for this UptimeCheckConfig. The format
  3054. // is:projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].This
  3055. // field should be omitted when creating the uptime check configuration;
  3056. // on create, the resource name is assigned by the server and included
  3057. // in the response.
  3058. Name string `json:"name,omitempty"`
  3059. // Period: How often, in seconds, the uptime check is performed.
  3060. // Currently, the only supported values are 60s (1 minute), 300s (5
  3061. // minutes), 600s (10 minutes), and 900s (15 minutes). Optional,
  3062. // defaults to 300s.
  3063. Period string `json:"period,omitempty"`
  3064. // ResourceGroup: The group resource associated with the configuration.
  3065. ResourceGroup *ResourceGroup `json:"resourceGroup,omitempty"`
  3066. // SelectedRegions: The list of regions from which the check will be
  3067. // run. If this field is specified, enough regions to include a minimum
  3068. // of 3 locations must be provided, or an error message is returned. Not
  3069. // specifying this field will result in uptime checks running from all
  3070. // regions.
  3071. //
  3072. // Possible values:
  3073. // "REGION_UNSPECIFIED" - Default value if no region is specified.
  3074. // Will result in uptime checks running from all regions.
  3075. // "USA" - Allows checks to run from locations within the United
  3076. // States of America.
  3077. // "EUROPE" - Allows checks to run from locations within the continent
  3078. // of Europe.
  3079. // "SOUTH_AMERICA" - Allows checks to run from locations within the
  3080. // continent of South America.
  3081. // "ASIA_PACIFIC" - Allows checks to run from locations within the
  3082. // Asia Pacific area (ex: Singapore).
  3083. SelectedRegions []string `json:"selectedRegions,omitempty"`
  3084. // TcpCheck: Contains information needed to make a TCP check.
  3085. TcpCheck *TcpCheck `json:"tcpCheck,omitempty"`
  3086. // Timeout: The maximum amount of time to wait for the request to
  3087. // complete (must be between 1 and 60 seconds). Required.
  3088. Timeout string `json:"timeout,omitempty"`
  3089. // ServerResponse contains the HTTP response code and headers from the
  3090. // server.
  3091. googleapi.ServerResponse `json:"-"`
  3092. // ForceSendFields is a list of field names (e.g. "ContentMatchers") to
  3093. // unconditionally include in API requests. By default, fields with
  3094. // empty values are omitted from API requests. However, any non-pointer,
  3095. // non-interface field appearing in ForceSendFields will be sent to the
  3096. // server regardless of whether the field is empty or not. This may be
  3097. // used to include empty fields in Patch requests.
  3098. ForceSendFields []string `json:"-"`
  3099. // NullFields is a list of field names (e.g. "ContentMatchers") to
  3100. // include in API requests with the JSON null value. By default, fields
  3101. // with empty values are omitted from API requests. However, any field
  3102. // with an empty value appearing in NullFields will be sent to the
  3103. // server as null. It is an error if a field in this list has a
  3104. // non-empty value. This may be used to include null fields in Patch
  3105. // requests.
  3106. NullFields []string `json:"-"`
  3107. }
  3108. func (s *UptimeCheckConfig) MarshalJSON() ([]byte, error) {
  3109. type NoMethod UptimeCheckConfig
  3110. raw := NoMethod(*s)
  3111. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3112. }
  3113. // UptimeCheckIp: Contains the region, location, and list of IP
  3114. // addresses where checkers in the location run from.
  3115. type UptimeCheckIp struct {
  3116. // IpAddress: The IP address from which the uptime check originates.
  3117. // This is a full IP address (not an IP address range). Most IP
  3118. // addresses, as of this publication, are in IPv4 format; however, one
  3119. // should not rely on the IP addresses being in IPv4 format indefinitely
  3120. // and should support interpreting this field in either IPv4 or IPv6
  3121. // format.
  3122. IpAddress string `json:"ipAddress,omitempty"`
  3123. // Location: A more specific location within the region that typically
  3124. // encodes a particular city/town/metro (and its containing
  3125. // state/province or country) within the broader umbrella region
  3126. // category.
  3127. Location string `json:"location,omitempty"`
  3128. // Region: A broad region category in which the IP address is located.
  3129. //
  3130. // Possible values:
  3131. // "REGION_UNSPECIFIED" - Default value if no region is specified.
  3132. // Will result in uptime checks running from all regions.
  3133. // "USA" - Allows checks to run from locations within the United
  3134. // States of America.
  3135. // "EUROPE" - Allows checks to run from locations within the continent
  3136. // of Europe.
  3137. // "SOUTH_AMERICA" - Allows checks to run from locations within the
  3138. // continent of South America.
  3139. // "ASIA_PACIFIC" - Allows checks to run from locations within the
  3140. // Asia Pacific area (ex: Singapore).
  3141. Region string `json:"region,omitempty"`
  3142. // ForceSendFields is a list of field names (e.g. "IpAddress") 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. "IpAddress") 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 *UptimeCheckIp) MarshalJSON() ([]byte, error) {
  3158. type NoMethod UptimeCheckIp
  3159. raw := NoMethod(*s)
  3160. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3161. }
  3162. // VerifyNotificationChannelRequest: The VerifyNotificationChannel
  3163. // request.
  3164. type VerifyNotificationChannelRequest struct {
  3165. // Code: The verification code that was delivered to the channel as a
  3166. // result of invoking the SendNotificationChannelVerificationCode API
  3167. // method or that was retrieved from a verified channel via
  3168. // GetNotificationChannelVerificationCode. For example, one might have
  3169. // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only
  3170. // guaranteed that the code is valid UTF-8; one should not make any
  3171. // assumptions regarding the structure or format of the code).
  3172. Code string `json:"code,omitempty"`
  3173. // ForceSendFields is a list of field names (e.g. "Code") to
  3174. // unconditionally include in API requests. By default, fields with
  3175. // empty values are omitted from API requests. However, any non-pointer,
  3176. // non-interface field appearing in ForceSendFields will be sent to the
  3177. // server regardless of whether the field is empty or not. This may be
  3178. // used to include empty fields in Patch requests.
  3179. ForceSendFields []string `json:"-"`
  3180. // NullFields is a list of field names (e.g. "Code") to include in API
  3181. // requests with the JSON null value. By default, fields with empty
  3182. // values are omitted from API requests. However, any field with an
  3183. // empty value appearing in NullFields will be sent to the server as
  3184. // null. It is an error if a field in this list has a non-empty value.
  3185. // This may be used to include null fields in Patch requests.
  3186. NullFields []string `json:"-"`
  3187. }
  3188. func (s *VerifyNotificationChannelRequest) MarshalJSON() ([]byte, error) {
  3189. type NoMethod VerifyNotificationChannelRequest
  3190. raw := NoMethod(*s)
  3191. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3192. }
  3193. // method id "monitoring.projects.alertPolicies.create":
  3194. type ProjectsAlertPoliciesCreateCall struct {
  3195. s *Service
  3196. name string
  3197. alertpolicy *AlertPolicy
  3198. urlParams_ gensupport.URLParams
  3199. ctx_ context.Context
  3200. header_ http.Header
  3201. }
  3202. // Create: Creates a new alerting policy.
  3203. func (r *ProjectsAlertPoliciesService) Create(name string, alertpolicy *AlertPolicy) *ProjectsAlertPoliciesCreateCall {
  3204. c := &ProjectsAlertPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3205. c.name = name
  3206. c.alertpolicy = alertpolicy
  3207. return c
  3208. }
  3209. // Fields allows partial responses to be retrieved. See
  3210. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3211. // for more information.
  3212. func (c *ProjectsAlertPoliciesCreateCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesCreateCall {
  3213. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3214. return c
  3215. }
  3216. // Context sets the context to be used in this call's Do method. Any
  3217. // pending HTTP request will be aborted if the provided context is
  3218. // canceled.
  3219. func (c *ProjectsAlertPoliciesCreateCall) Context(ctx context.Context) *ProjectsAlertPoliciesCreateCall {
  3220. c.ctx_ = ctx
  3221. return c
  3222. }
  3223. // Header returns an http.Header that can be modified by the caller to
  3224. // add HTTP headers to the request.
  3225. func (c *ProjectsAlertPoliciesCreateCall) Header() http.Header {
  3226. if c.header_ == nil {
  3227. c.header_ = make(http.Header)
  3228. }
  3229. return c.header_
  3230. }
  3231. func (c *ProjectsAlertPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
  3232. reqHeaders := make(http.Header)
  3233. for k, v := range c.header_ {
  3234. reqHeaders[k] = v
  3235. }
  3236. reqHeaders.Set("User-Agent", c.s.userAgent())
  3237. var body io.Reader = nil
  3238. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alertpolicy)
  3239. if err != nil {
  3240. return nil, err
  3241. }
  3242. reqHeaders.Set("Content-Type", "application/json")
  3243. c.urlParams_.Set("alt", alt)
  3244. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/alertPolicies")
  3245. urls += "?" + c.urlParams_.Encode()
  3246. req, _ := http.NewRequest("POST", urls, body)
  3247. req.Header = reqHeaders
  3248. googleapi.Expand(req.URL, map[string]string{
  3249. "name": c.name,
  3250. })
  3251. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3252. }
  3253. // Do executes the "monitoring.projects.alertPolicies.create" call.
  3254. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  3255. // status code is an error. Response headers are in either
  3256. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  3257. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3258. // to check whether the returned error was because
  3259. // http.StatusNotModified was returned.
  3260. func (c *ProjectsAlertPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  3261. gensupport.SetOptions(c.urlParams_, opts...)
  3262. res, err := c.doRequest("json")
  3263. if res != nil && res.StatusCode == http.StatusNotModified {
  3264. if res.Body != nil {
  3265. res.Body.Close()
  3266. }
  3267. return nil, &googleapi.Error{
  3268. Code: res.StatusCode,
  3269. Header: res.Header,
  3270. }
  3271. }
  3272. if err != nil {
  3273. return nil, err
  3274. }
  3275. defer googleapi.CloseBody(res)
  3276. if err := googleapi.CheckResponse(res); err != nil {
  3277. return nil, err
  3278. }
  3279. ret := &AlertPolicy{
  3280. ServerResponse: googleapi.ServerResponse{
  3281. Header: res.Header,
  3282. HTTPStatusCode: res.StatusCode,
  3283. },
  3284. }
  3285. target := &ret
  3286. if err := gensupport.DecodeResponse(target, res); err != nil {
  3287. return nil, err
  3288. }
  3289. return ret, nil
  3290. // {
  3291. // "description": "Creates a new alerting policy.",
  3292. // "flatPath": "v3/projects/{projectsId}/alertPolicies",
  3293. // "httpMethod": "POST",
  3294. // "id": "monitoring.projects.alertPolicies.create",
  3295. // "parameterOrder": [
  3296. // "name"
  3297. // ],
  3298. // "parameters": {
  3299. // "name": {
  3300. // "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.",
  3301. // "location": "path",
  3302. // "pattern": "^projects/[^/]+$",
  3303. // "required": true,
  3304. // "type": "string"
  3305. // }
  3306. // },
  3307. // "path": "v3/{+name}/alertPolicies",
  3308. // "request": {
  3309. // "$ref": "AlertPolicy"
  3310. // },
  3311. // "response": {
  3312. // "$ref": "AlertPolicy"
  3313. // },
  3314. // "scopes": [
  3315. // "https://www.googleapis.com/auth/cloud-platform",
  3316. // "https://www.googleapis.com/auth/monitoring"
  3317. // ]
  3318. // }
  3319. }
  3320. // method id "monitoring.projects.alertPolicies.delete":
  3321. type ProjectsAlertPoliciesDeleteCall struct {
  3322. s *Service
  3323. name string
  3324. urlParams_ gensupport.URLParams
  3325. ctx_ context.Context
  3326. header_ http.Header
  3327. }
  3328. // Delete: Deletes an alerting policy.
  3329. func (r *ProjectsAlertPoliciesService) Delete(name string) *ProjectsAlertPoliciesDeleteCall {
  3330. c := &ProjectsAlertPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3331. c.name = name
  3332. return c
  3333. }
  3334. // Fields allows partial responses to be retrieved. See
  3335. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3336. // for more information.
  3337. func (c *ProjectsAlertPoliciesDeleteCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesDeleteCall {
  3338. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3339. return c
  3340. }
  3341. // Context sets the context to be used in this call's Do method. Any
  3342. // pending HTTP request will be aborted if the provided context is
  3343. // canceled.
  3344. func (c *ProjectsAlertPoliciesDeleteCall) Context(ctx context.Context) *ProjectsAlertPoliciesDeleteCall {
  3345. c.ctx_ = ctx
  3346. return c
  3347. }
  3348. // Header returns an http.Header that can be modified by the caller to
  3349. // add HTTP headers to the request.
  3350. func (c *ProjectsAlertPoliciesDeleteCall) Header() http.Header {
  3351. if c.header_ == nil {
  3352. c.header_ = make(http.Header)
  3353. }
  3354. return c.header_
  3355. }
  3356. func (c *ProjectsAlertPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3357. reqHeaders := make(http.Header)
  3358. for k, v := range c.header_ {
  3359. reqHeaders[k] = v
  3360. }
  3361. reqHeaders.Set("User-Agent", c.s.userAgent())
  3362. var body io.Reader = nil
  3363. c.urlParams_.Set("alt", alt)
  3364. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  3365. urls += "?" + c.urlParams_.Encode()
  3366. req, _ := http.NewRequest("DELETE", urls, body)
  3367. req.Header = reqHeaders
  3368. googleapi.Expand(req.URL, map[string]string{
  3369. "name": c.name,
  3370. })
  3371. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3372. }
  3373. // Do executes the "monitoring.projects.alertPolicies.delete" call.
  3374. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3375. // code is an error. Response headers are in either
  3376. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3377. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3378. // check whether the returned error was because http.StatusNotModified
  3379. // was returned.
  3380. func (c *ProjectsAlertPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3381. gensupport.SetOptions(c.urlParams_, opts...)
  3382. res, err := c.doRequest("json")
  3383. if res != nil && res.StatusCode == http.StatusNotModified {
  3384. if res.Body != nil {
  3385. res.Body.Close()
  3386. }
  3387. return nil, &googleapi.Error{
  3388. Code: res.StatusCode,
  3389. Header: res.Header,
  3390. }
  3391. }
  3392. if err != nil {
  3393. return nil, err
  3394. }
  3395. defer googleapi.CloseBody(res)
  3396. if err := googleapi.CheckResponse(res); err != nil {
  3397. return nil, err
  3398. }
  3399. ret := &Empty{
  3400. ServerResponse: googleapi.ServerResponse{
  3401. Header: res.Header,
  3402. HTTPStatusCode: res.StatusCode,
  3403. },
  3404. }
  3405. target := &ret
  3406. if err := gensupport.DecodeResponse(target, res); err != nil {
  3407. return nil, err
  3408. }
  3409. return ret, nil
  3410. // {
  3411. // "description": "Deletes an alerting policy.",
  3412. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  3413. // "httpMethod": "DELETE",
  3414. // "id": "monitoring.projects.alertPolicies.delete",
  3415. // "parameterOrder": [
  3416. // "name"
  3417. // ],
  3418. // "parameters": {
  3419. // "name": {
  3420. // "description": "The alerting policy to delete. The format is:\nprojects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]\nFor more information, see AlertPolicy.",
  3421. // "location": "path",
  3422. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  3423. // "required": true,
  3424. // "type": "string"
  3425. // }
  3426. // },
  3427. // "path": "v3/{+name}",
  3428. // "response": {
  3429. // "$ref": "Empty"
  3430. // },
  3431. // "scopes": [
  3432. // "https://www.googleapis.com/auth/cloud-platform",
  3433. // "https://www.googleapis.com/auth/monitoring"
  3434. // ]
  3435. // }
  3436. }
  3437. // method id "monitoring.projects.alertPolicies.get":
  3438. type ProjectsAlertPoliciesGetCall struct {
  3439. s *Service
  3440. name string
  3441. urlParams_ gensupport.URLParams
  3442. ifNoneMatch_ string
  3443. ctx_ context.Context
  3444. header_ http.Header
  3445. }
  3446. // Get: Gets a single alerting policy.
  3447. func (r *ProjectsAlertPoliciesService) Get(name string) *ProjectsAlertPoliciesGetCall {
  3448. c := &ProjectsAlertPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3449. c.name = name
  3450. return c
  3451. }
  3452. // Fields allows partial responses to be retrieved. See
  3453. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3454. // for more information.
  3455. func (c *ProjectsAlertPoliciesGetCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesGetCall {
  3456. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3457. return c
  3458. }
  3459. // IfNoneMatch sets the optional parameter which makes the operation
  3460. // fail if the object's ETag matches the given value. This is useful for
  3461. // getting updates only after the object has changed since the last
  3462. // request. Use googleapi.IsNotModified to check whether the response
  3463. // error from Do is the result of In-None-Match.
  3464. func (c *ProjectsAlertPoliciesGetCall) IfNoneMatch(entityTag string) *ProjectsAlertPoliciesGetCall {
  3465. c.ifNoneMatch_ = entityTag
  3466. return c
  3467. }
  3468. // Context sets the context to be used in this call's Do method. Any
  3469. // pending HTTP request will be aborted if the provided context is
  3470. // canceled.
  3471. func (c *ProjectsAlertPoliciesGetCall) Context(ctx context.Context) *ProjectsAlertPoliciesGetCall {
  3472. c.ctx_ = ctx
  3473. return c
  3474. }
  3475. // Header returns an http.Header that can be modified by the caller to
  3476. // add HTTP headers to the request.
  3477. func (c *ProjectsAlertPoliciesGetCall) Header() http.Header {
  3478. if c.header_ == nil {
  3479. c.header_ = make(http.Header)
  3480. }
  3481. return c.header_
  3482. }
  3483. func (c *ProjectsAlertPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
  3484. reqHeaders := make(http.Header)
  3485. for k, v := range c.header_ {
  3486. reqHeaders[k] = v
  3487. }
  3488. reqHeaders.Set("User-Agent", c.s.userAgent())
  3489. if c.ifNoneMatch_ != "" {
  3490. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3491. }
  3492. var body io.Reader = nil
  3493. c.urlParams_.Set("alt", alt)
  3494. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  3495. urls += "?" + c.urlParams_.Encode()
  3496. req, _ := http.NewRequest("GET", urls, body)
  3497. req.Header = reqHeaders
  3498. googleapi.Expand(req.URL, map[string]string{
  3499. "name": c.name,
  3500. })
  3501. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3502. }
  3503. // Do executes the "monitoring.projects.alertPolicies.get" call.
  3504. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  3505. // status code is an error. Response headers are in either
  3506. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  3507. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3508. // to check whether the returned error was because
  3509. // http.StatusNotModified was returned.
  3510. func (c *ProjectsAlertPoliciesGetCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  3511. gensupport.SetOptions(c.urlParams_, opts...)
  3512. res, err := c.doRequest("json")
  3513. if res != nil && res.StatusCode == http.StatusNotModified {
  3514. if res.Body != nil {
  3515. res.Body.Close()
  3516. }
  3517. return nil, &googleapi.Error{
  3518. Code: res.StatusCode,
  3519. Header: res.Header,
  3520. }
  3521. }
  3522. if err != nil {
  3523. return nil, err
  3524. }
  3525. defer googleapi.CloseBody(res)
  3526. if err := googleapi.CheckResponse(res); err != nil {
  3527. return nil, err
  3528. }
  3529. ret := &AlertPolicy{
  3530. ServerResponse: googleapi.ServerResponse{
  3531. Header: res.Header,
  3532. HTTPStatusCode: res.StatusCode,
  3533. },
  3534. }
  3535. target := &ret
  3536. if err := gensupport.DecodeResponse(target, res); err != nil {
  3537. return nil, err
  3538. }
  3539. return ret, nil
  3540. // {
  3541. // "description": "Gets a single alerting policy.",
  3542. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  3543. // "httpMethod": "GET",
  3544. // "id": "monitoring.projects.alertPolicies.get",
  3545. // "parameterOrder": [
  3546. // "name"
  3547. // ],
  3548. // "parameters": {
  3549. // "name": {
  3550. // "description": "The alerting policy to retrieve. The format is\nprojects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]\n",
  3551. // "location": "path",
  3552. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  3553. // "required": true,
  3554. // "type": "string"
  3555. // }
  3556. // },
  3557. // "path": "v3/{+name}",
  3558. // "response": {
  3559. // "$ref": "AlertPolicy"
  3560. // },
  3561. // "scopes": [
  3562. // "https://www.googleapis.com/auth/cloud-platform",
  3563. // "https://www.googleapis.com/auth/monitoring",
  3564. // "https://www.googleapis.com/auth/monitoring.read"
  3565. // ]
  3566. // }
  3567. }
  3568. // method id "monitoring.projects.alertPolicies.list":
  3569. type ProjectsAlertPoliciesListCall struct {
  3570. s *Service
  3571. name string
  3572. urlParams_ gensupport.URLParams
  3573. ifNoneMatch_ string
  3574. ctx_ context.Context
  3575. header_ http.Header
  3576. }
  3577. // List: Lists the existing alerting policies for the project.
  3578. func (r *ProjectsAlertPoliciesService) List(name string) *ProjectsAlertPoliciesListCall {
  3579. c := &ProjectsAlertPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3580. c.name = name
  3581. return c
  3582. }
  3583. // Filter sets the optional parameter "filter": If provided, this field
  3584. // specifies the criteria that must be met by alert policies to be
  3585. // included in the response.For more details, see sorting and filtering.
  3586. func (c *ProjectsAlertPoliciesListCall) Filter(filter string) *ProjectsAlertPoliciesListCall {
  3587. c.urlParams_.Set("filter", filter)
  3588. return c
  3589. }
  3590. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  3591. // of fields by which to sort the result. Supports the same set of field
  3592. // references as the filter field. Entries can be prefixed with a minus
  3593. // sign to sort by the field in descending order.For more details, see
  3594. // sorting and filtering.
  3595. func (c *ProjectsAlertPoliciesListCall) OrderBy(orderBy string) *ProjectsAlertPoliciesListCall {
  3596. c.urlParams_.Set("orderBy", orderBy)
  3597. return c
  3598. }
  3599. // PageSize sets the optional parameter "pageSize": The maximum number
  3600. // of results to return in a single response.
  3601. func (c *ProjectsAlertPoliciesListCall) PageSize(pageSize int64) *ProjectsAlertPoliciesListCall {
  3602. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3603. return c
  3604. }
  3605. // PageToken sets the optional parameter "pageToken": If this field is
  3606. // not empty then it must contain the nextPageToken value returned by a
  3607. // previous call to this method. Using this field causes the method to
  3608. // return more results from the previous method call.
  3609. func (c *ProjectsAlertPoliciesListCall) PageToken(pageToken string) *ProjectsAlertPoliciesListCall {
  3610. c.urlParams_.Set("pageToken", pageToken)
  3611. return c
  3612. }
  3613. // Fields allows partial responses to be retrieved. See
  3614. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3615. // for more information.
  3616. func (c *ProjectsAlertPoliciesListCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesListCall {
  3617. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3618. return c
  3619. }
  3620. // IfNoneMatch sets the optional parameter which makes the operation
  3621. // fail if the object's ETag matches the given value. This is useful for
  3622. // getting updates only after the object has changed since the last
  3623. // request. Use googleapi.IsNotModified to check whether the response
  3624. // error from Do is the result of In-None-Match.
  3625. func (c *ProjectsAlertPoliciesListCall) IfNoneMatch(entityTag string) *ProjectsAlertPoliciesListCall {
  3626. c.ifNoneMatch_ = entityTag
  3627. return c
  3628. }
  3629. // Context sets the context to be used in this call's Do method. Any
  3630. // pending HTTP request will be aborted if the provided context is
  3631. // canceled.
  3632. func (c *ProjectsAlertPoliciesListCall) Context(ctx context.Context) *ProjectsAlertPoliciesListCall {
  3633. c.ctx_ = ctx
  3634. return c
  3635. }
  3636. // Header returns an http.Header that can be modified by the caller to
  3637. // add HTTP headers to the request.
  3638. func (c *ProjectsAlertPoliciesListCall) Header() http.Header {
  3639. if c.header_ == nil {
  3640. c.header_ = make(http.Header)
  3641. }
  3642. return c.header_
  3643. }
  3644. func (c *ProjectsAlertPoliciesListCall) doRequest(alt string) (*http.Response, error) {
  3645. reqHeaders := make(http.Header)
  3646. for k, v := range c.header_ {
  3647. reqHeaders[k] = v
  3648. }
  3649. reqHeaders.Set("User-Agent", c.s.userAgent())
  3650. if c.ifNoneMatch_ != "" {
  3651. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3652. }
  3653. var body io.Reader = nil
  3654. c.urlParams_.Set("alt", alt)
  3655. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/alertPolicies")
  3656. urls += "?" + c.urlParams_.Encode()
  3657. req, _ := http.NewRequest("GET", urls, body)
  3658. req.Header = reqHeaders
  3659. googleapi.Expand(req.URL, map[string]string{
  3660. "name": c.name,
  3661. })
  3662. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3663. }
  3664. // Do executes the "monitoring.projects.alertPolicies.list" call.
  3665. // Exactly one of *ListAlertPoliciesResponse or error will be non-nil.
  3666. // Any non-2xx status code is an error. Response headers are in either
  3667. // *ListAlertPoliciesResponse.ServerResponse.Header or (if a response
  3668. // was returned at all) in error.(*googleapi.Error).Header. Use
  3669. // googleapi.IsNotModified to check whether the returned error was
  3670. // because http.StatusNotModified was returned.
  3671. func (c *ProjectsAlertPoliciesListCall) Do(opts ...googleapi.CallOption) (*ListAlertPoliciesResponse, error) {
  3672. gensupport.SetOptions(c.urlParams_, opts...)
  3673. res, err := c.doRequest("json")
  3674. if res != nil && res.StatusCode == http.StatusNotModified {
  3675. if res.Body != nil {
  3676. res.Body.Close()
  3677. }
  3678. return nil, &googleapi.Error{
  3679. Code: res.StatusCode,
  3680. Header: res.Header,
  3681. }
  3682. }
  3683. if err != nil {
  3684. return nil, err
  3685. }
  3686. defer googleapi.CloseBody(res)
  3687. if err := googleapi.CheckResponse(res); err != nil {
  3688. return nil, err
  3689. }
  3690. ret := &ListAlertPoliciesResponse{
  3691. ServerResponse: googleapi.ServerResponse{
  3692. Header: res.Header,
  3693. HTTPStatusCode: res.StatusCode,
  3694. },
  3695. }
  3696. target := &ret
  3697. if err := gensupport.DecodeResponse(target, res); err != nil {
  3698. return nil, err
  3699. }
  3700. return ret, nil
  3701. // {
  3702. // "description": "Lists the existing alerting policies for the project.",
  3703. // "flatPath": "v3/projects/{projectsId}/alertPolicies",
  3704. // "httpMethod": "GET",
  3705. // "id": "monitoring.projects.alertPolicies.list",
  3706. // "parameterOrder": [
  3707. // "name"
  3708. // ],
  3709. // "parameters": {
  3710. // "filter": {
  3711. // "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.",
  3712. // "location": "query",
  3713. // "type": "string"
  3714. // },
  3715. // "name": {
  3716. // "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.",
  3717. // "location": "path",
  3718. // "pattern": "^projects/[^/]+$",
  3719. // "required": true,
  3720. // "type": "string"
  3721. // },
  3722. // "orderBy": {
  3723. // "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.",
  3724. // "location": "query",
  3725. // "type": "string"
  3726. // },
  3727. // "pageSize": {
  3728. // "description": "The maximum number of results to return in a single response.",
  3729. // "format": "int32",
  3730. // "location": "query",
  3731. // "type": "integer"
  3732. // },
  3733. // "pageToken": {
  3734. // "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.",
  3735. // "location": "query",
  3736. // "type": "string"
  3737. // }
  3738. // },
  3739. // "path": "v3/{+name}/alertPolicies",
  3740. // "response": {
  3741. // "$ref": "ListAlertPoliciesResponse"
  3742. // },
  3743. // "scopes": [
  3744. // "https://www.googleapis.com/auth/cloud-platform",
  3745. // "https://www.googleapis.com/auth/monitoring",
  3746. // "https://www.googleapis.com/auth/monitoring.read"
  3747. // ]
  3748. // }
  3749. }
  3750. // Pages invokes f for each page of results.
  3751. // A non-nil error returned from f will halt the iteration.
  3752. // The provided context supersedes any context provided to the Context method.
  3753. func (c *ProjectsAlertPoliciesListCall) Pages(ctx context.Context, f func(*ListAlertPoliciesResponse) error) error {
  3754. c.ctx_ = ctx
  3755. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3756. for {
  3757. x, err := c.Do()
  3758. if err != nil {
  3759. return err
  3760. }
  3761. if err := f(x); err != nil {
  3762. return err
  3763. }
  3764. if x.NextPageToken == "" {
  3765. return nil
  3766. }
  3767. c.PageToken(x.NextPageToken)
  3768. }
  3769. }
  3770. // method id "monitoring.projects.alertPolicies.patch":
  3771. type ProjectsAlertPoliciesPatchCall struct {
  3772. s *Service
  3773. name string
  3774. alertpolicy *AlertPolicy
  3775. urlParams_ gensupport.URLParams
  3776. ctx_ context.Context
  3777. header_ http.Header
  3778. }
  3779. // Patch: Updates an alerting policy. You can either replace the entire
  3780. // policy with a new one or replace only certain fields in the current
  3781. // alerting policy by specifying the fields to be updated via
  3782. // updateMask. Returns the updated alerting policy.
  3783. func (r *ProjectsAlertPoliciesService) Patch(name string, alertpolicy *AlertPolicy) *ProjectsAlertPoliciesPatchCall {
  3784. c := &ProjectsAlertPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3785. c.name = name
  3786. c.alertpolicy = alertpolicy
  3787. return c
  3788. }
  3789. // UpdateMask sets the optional parameter "updateMask": A list of
  3790. // alerting policy field names. If this field is not empty, each listed
  3791. // field in the existing alerting policy is set to the value of the
  3792. // corresponding field in the supplied policy (alert_policy), or to the
  3793. // field's default value if the field is not in the supplied alerting
  3794. // policy. Fields not listed retain their previous value.Examples of
  3795. // valid field masks include display_name, documentation,
  3796. // documentation.content, documentation.mime_type, user_labels,
  3797. // user_label.nameofkey, enabled, conditions, combiner, etc.If this
  3798. // field is empty, then the supplied alerting policy replaces the
  3799. // existing policy. It is the same as deleting the existing policy and
  3800. // adding the supplied policy, except for the following:
  3801. // The new policy will have the same [ALERT_POLICY_ID] as the former
  3802. // policy. This gives you continuity with the former policy in your
  3803. // notifications and incidents.
  3804. // Conditions in the new policy will keep their former [CONDITION_ID] if
  3805. // the supplied condition includes the name field with that
  3806. // [CONDITION_ID]. If the supplied condition omits the name field, then
  3807. // a new [CONDITION_ID] is created.
  3808. func (c *ProjectsAlertPoliciesPatchCall) UpdateMask(updateMask string) *ProjectsAlertPoliciesPatchCall {
  3809. c.urlParams_.Set("updateMask", updateMask)
  3810. return c
  3811. }
  3812. // Fields allows partial responses to be retrieved. See
  3813. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3814. // for more information.
  3815. func (c *ProjectsAlertPoliciesPatchCall) Fields(s ...googleapi.Field) *ProjectsAlertPoliciesPatchCall {
  3816. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3817. return c
  3818. }
  3819. // Context sets the context to be used in this call's Do method. Any
  3820. // pending HTTP request will be aborted if the provided context is
  3821. // canceled.
  3822. func (c *ProjectsAlertPoliciesPatchCall) Context(ctx context.Context) *ProjectsAlertPoliciesPatchCall {
  3823. c.ctx_ = ctx
  3824. return c
  3825. }
  3826. // Header returns an http.Header that can be modified by the caller to
  3827. // add HTTP headers to the request.
  3828. func (c *ProjectsAlertPoliciesPatchCall) Header() http.Header {
  3829. if c.header_ == nil {
  3830. c.header_ = make(http.Header)
  3831. }
  3832. return c.header_
  3833. }
  3834. func (c *ProjectsAlertPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
  3835. reqHeaders := make(http.Header)
  3836. for k, v := range c.header_ {
  3837. reqHeaders[k] = v
  3838. }
  3839. reqHeaders.Set("User-Agent", c.s.userAgent())
  3840. var body io.Reader = nil
  3841. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alertpolicy)
  3842. if err != nil {
  3843. return nil, err
  3844. }
  3845. reqHeaders.Set("Content-Type", "application/json")
  3846. c.urlParams_.Set("alt", alt)
  3847. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  3848. urls += "?" + c.urlParams_.Encode()
  3849. req, _ := http.NewRequest("PATCH", urls, body)
  3850. req.Header = reqHeaders
  3851. googleapi.Expand(req.URL, map[string]string{
  3852. "name": c.name,
  3853. })
  3854. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3855. }
  3856. // Do executes the "monitoring.projects.alertPolicies.patch" call.
  3857. // Exactly one of *AlertPolicy or error will be non-nil. Any non-2xx
  3858. // status code is an error. Response headers are in either
  3859. // *AlertPolicy.ServerResponse.Header or (if a response was returned at
  3860. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3861. // to check whether the returned error was because
  3862. // http.StatusNotModified was returned.
  3863. func (c *ProjectsAlertPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*AlertPolicy, error) {
  3864. gensupport.SetOptions(c.urlParams_, opts...)
  3865. res, err := c.doRequest("json")
  3866. if res != nil && res.StatusCode == http.StatusNotModified {
  3867. if res.Body != nil {
  3868. res.Body.Close()
  3869. }
  3870. return nil, &googleapi.Error{
  3871. Code: res.StatusCode,
  3872. Header: res.Header,
  3873. }
  3874. }
  3875. if err != nil {
  3876. return nil, err
  3877. }
  3878. defer googleapi.CloseBody(res)
  3879. if err := googleapi.CheckResponse(res); err != nil {
  3880. return nil, err
  3881. }
  3882. ret := &AlertPolicy{
  3883. ServerResponse: googleapi.ServerResponse{
  3884. Header: res.Header,
  3885. HTTPStatusCode: res.StatusCode,
  3886. },
  3887. }
  3888. target := &ret
  3889. if err := gensupport.DecodeResponse(target, res); err != nil {
  3890. return nil, err
  3891. }
  3892. return ret, nil
  3893. // {
  3894. // "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.",
  3895. // "flatPath": "v3/projects/{projectsId}/alertPolicies/{alertPoliciesId}",
  3896. // "httpMethod": "PATCH",
  3897. // "id": "monitoring.projects.alertPolicies.patch",
  3898. // "parameterOrder": [
  3899. // "name"
  3900. // ],
  3901. // "parameters": {
  3902. // "name": {
  3903. // "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.",
  3904. // "location": "path",
  3905. // "pattern": "^projects/[^/]+/alertPolicies/[^/]+$",
  3906. // "required": true,
  3907. // "type": "string"
  3908. // },
  3909. // "updateMask": {
  3910. // "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.",
  3911. // "format": "google-fieldmask",
  3912. // "location": "query",
  3913. // "type": "string"
  3914. // }
  3915. // },
  3916. // "path": "v3/{+name}",
  3917. // "request": {
  3918. // "$ref": "AlertPolicy"
  3919. // },
  3920. // "response": {
  3921. // "$ref": "AlertPolicy"
  3922. // },
  3923. // "scopes": [
  3924. // "https://www.googleapis.com/auth/cloud-platform",
  3925. // "https://www.googleapis.com/auth/monitoring"
  3926. // ]
  3927. // }
  3928. }
  3929. // method id "monitoring.projects.collectdTimeSeries.create":
  3930. type ProjectsCollectdTimeSeriesCreateCall struct {
  3931. s *Service
  3932. name string
  3933. createcollectdtimeseriesrequest *CreateCollectdTimeSeriesRequest
  3934. urlParams_ gensupport.URLParams
  3935. ctx_ context.Context
  3936. header_ http.Header
  3937. }
  3938. // Create: Stackdriver Monitoring Agent only: Creates a new time
  3939. // series.<aside class="caution">This method is only for use by the
  3940. // Stackdriver Monitoring Agent. Use projects.timeSeries.create
  3941. // instead.</aside>
  3942. func (r *ProjectsCollectdTimeSeriesService) Create(name string, createcollectdtimeseriesrequest *CreateCollectdTimeSeriesRequest) *ProjectsCollectdTimeSeriesCreateCall {
  3943. c := &ProjectsCollectdTimeSeriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3944. c.name = name
  3945. c.createcollectdtimeseriesrequest = createcollectdtimeseriesrequest
  3946. return c
  3947. }
  3948. // Fields allows partial responses to be retrieved. See
  3949. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3950. // for more information.
  3951. func (c *ProjectsCollectdTimeSeriesCreateCall) Fields(s ...googleapi.Field) *ProjectsCollectdTimeSeriesCreateCall {
  3952. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3953. return c
  3954. }
  3955. // Context sets the context to be used in this call's Do method. Any
  3956. // pending HTTP request will be aborted if the provided context is
  3957. // canceled.
  3958. func (c *ProjectsCollectdTimeSeriesCreateCall) Context(ctx context.Context) *ProjectsCollectdTimeSeriesCreateCall {
  3959. c.ctx_ = ctx
  3960. return c
  3961. }
  3962. // Header returns an http.Header that can be modified by the caller to
  3963. // add HTTP headers to the request.
  3964. func (c *ProjectsCollectdTimeSeriesCreateCall) Header() http.Header {
  3965. if c.header_ == nil {
  3966. c.header_ = make(http.Header)
  3967. }
  3968. return c.header_
  3969. }
  3970. func (c *ProjectsCollectdTimeSeriesCreateCall) doRequest(alt string) (*http.Response, error) {
  3971. reqHeaders := make(http.Header)
  3972. for k, v := range c.header_ {
  3973. reqHeaders[k] = v
  3974. }
  3975. reqHeaders.Set("User-Agent", c.s.userAgent())
  3976. var body io.Reader = nil
  3977. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createcollectdtimeseriesrequest)
  3978. if err != nil {
  3979. return nil, err
  3980. }
  3981. reqHeaders.Set("Content-Type", "application/json")
  3982. c.urlParams_.Set("alt", alt)
  3983. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/collectdTimeSeries")
  3984. urls += "?" + c.urlParams_.Encode()
  3985. req, _ := http.NewRequest("POST", urls, body)
  3986. req.Header = reqHeaders
  3987. googleapi.Expand(req.URL, map[string]string{
  3988. "name": c.name,
  3989. })
  3990. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3991. }
  3992. // Do executes the "monitoring.projects.collectdTimeSeries.create" call.
  3993. // Exactly one of *CreateCollectdTimeSeriesResponse or error will be
  3994. // non-nil. Any non-2xx status code is an error. Response headers are in
  3995. // either *CreateCollectdTimeSeriesResponse.ServerResponse.Header or (if
  3996. // a response was returned at all) in error.(*googleapi.Error).Header.
  3997. // Use googleapi.IsNotModified to check whether the returned error was
  3998. // because http.StatusNotModified was returned.
  3999. func (c *ProjectsCollectdTimeSeriesCreateCall) Do(opts ...googleapi.CallOption) (*CreateCollectdTimeSeriesResponse, error) {
  4000. gensupport.SetOptions(c.urlParams_, opts...)
  4001. res, err := c.doRequest("json")
  4002. if res != nil && res.StatusCode == http.StatusNotModified {
  4003. if res.Body != nil {
  4004. res.Body.Close()
  4005. }
  4006. return nil, &googleapi.Error{
  4007. Code: res.StatusCode,
  4008. Header: res.Header,
  4009. }
  4010. }
  4011. if err != nil {
  4012. return nil, err
  4013. }
  4014. defer googleapi.CloseBody(res)
  4015. if err := googleapi.CheckResponse(res); err != nil {
  4016. return nil, err
  4017. }
  4018. ret := &CreateCollectdTimeSeriesResponse{
  4019. ServerResponse: googleapi.ServerResponse{
  4020. Header: res.Header,
  4021. HTTPStatusCode: res.StatusCode,
  4022. },
  4023. }
  4024. target := &ret
  4025. if err := gensupport.DecodeResponse(target, res); err != nil {
  4026. return nil, err
  4027. }
  4028. return ret, nil
  4029. // {
  4030. // "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",
  4031. // "flatPath": "v3/projects/{projectsId}/collectdTimeSeries",
  4032. // "httpMethod": "POST",
  4033. // "id": "monitoring.projects.collectdTimeSeries.create",
  4034. // "parameterOrder": [
  4035. // "name"
  4036. // ],
  4037. // "parameters": {
  4038. // "name": {
  4039. // "description": "The project in which to create the time series. The format is \"projects/PROJECT_ID_OR_NUMBER\".",
  4040. // "location": "path",
  4041. // "pattern": "^projects/[^/]+$",
  4042. // "required": true,
  4043. // "type": "string"
  4044. // }
  4045. // },
  4046. // "path": "v3/{+name}/collectdTimeSeries",
  4047. // "request": {
  4048. // "$ref": "CreateCollectdTimeSeriesRequest"
  4049. // },
  4050. // "response": {
  4051. // "$ref": "CreateCollectdTimeSeriesResponse"
  4052. // },
  4053. // "scopes": [
  4054. // "https://www.googleapis.com/auth/cloud-platform",
  4055. // "https://www.googleapis.com/auth/monitoring",
  4056. // "https://www.googleapis.com/auth/monitoring.write"
  4057. // ]
  4058. // }
  4059. }
  4060. // method id "monitoring.projects.groups.create":
  4061. type ProjectsGroupsCreateCall struct {
  4062. s *Service
  4063. name string
  4064. group *Group
  4065. urlParams_ gensupport.URLParams
  4066. ctx_ context.Context
  4067. header_ http.Header
  4068. }
  4069. // Create: Creates a new group.
  4070. func (r *ProjectsGroupsService) Create(name string, group *Group) *ProjectsGroupsCreateCall {
  4071. c := &ProjectsGroupsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4072. c.name = name
  4073. c.group = group
  4074. return c
  4075. }
  4076. // ValidateOnly sets the optional parameter "validateOnly": If true,
  4077. // validate this request but do not create the group.
  4078. func (c *ProjectsGroupsCreateCall) ValidateOnly(validateOnly bool) *ProjectsGroupsCreateCall {
  4079. c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
  4080. return c
  4081. }
  4082. // Fields allows partial responses to be retrieved. See
  4083. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4084. // for more information.
  4085. func (c *ProjectsGroupsCreateCall) Fields(s ...googleapi.Field) *ProjectsGroupsCreateCall {
  4086. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4087. return c
  4088. }
  4089. // Context sets the context to be used in this call's Do method. Any
  4090. // pending HTTP request will be aborted if the provided context is
  4091. // canceled.
  4092. func (c *ProjectsGroupsCreateCall) Context(ctx context.Context) *ProjectsGroupsCreateCall {
  4093. c.ctx_ = ctx
  4094. return c
  4095. }
  4096. // Header returns an http.Header that can be modified by the caller to
  4097. // add HTTP headers to the request.
  4098. func (c *ProjectsGroupsCreateCall) Header() http.Header {
  4099. if c.header_ == nil {
  4100. c.header_ = make(http.Header)
  4101. }
  4102. return c.header_
  4103. }
  4104. func (c *ProjectsGroupsCreateCall) doRequest(alt string) (*http.Response, error) {
  4105. reqHeaders := make(http.Header)
  4106. for k, v := range c.header_ {
  4107. reqHeaders[k] = v
  4108. }
  4109. reqHeaders.Set("User-Agent", c.s.userAgent())
  4110. var body io.Reader = nil
  4111. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  4112. if err != nil {
  4113. return nil, err
  4114. }
  4115. reqHeaders.Set("Content-Type", "application/json")
  4116. c.urlParams_.Set("alt", alt)
  4117. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/groups")
  4118. urls += "?" + c.urlParams_.Encode()
  4119. req, _ := http.NewRequest("POST", urls, body)
  4120. req.Header = reqHeaders
  4121. googleapi.Expand(req.URL, map[string]string{
  4122. "name": c.name,
  4123. })
  4124. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4125. }
  4126. // Do executes the "monitoring.projects.groups.create" call.
  4127. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4128. // code is an error. Response headers are in either
  4129. // *Group.ServerResponse.Header or (if a response was returned at all)
  4130. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4131. // check whether the returned error was because http.StatusNotModified
  4132. // was returned.
  4133. func (c *ProjectsGroupsCreateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4134. gensupport.SetOptions(c.urlParams_, opts...)
  4135. res, err := c.doRequest("json")
  4136. if res != nil && res.StatusCode == http.StatusNotModified {
  4137. if res.Body != nil {
  4138. res.Body.Close()
  4139. }
  4140. return nil, &googleapi.Error{
  4141. Code: res.StatusCode,
  4142. Header: res.Header,
  4143. }
  4144. }
  4145. if err != nil {
  4146. return nil, err
  4147. }
  4148. defer googleapi.CloseBody(res)
  4149. if err := googleapi.CheckResponse(res); err != nil {
  4150. return nil, err
  4151. }
  4152. ret := &Group{
  4153. ServerResponse: googleapi.ServerResponse{
  4154. Header: res.Header,
  4155. HTTPStatusCode: res.StatusCode,
  4156. },
  4157. }
  4158. target := &ret
  4159. if err := gensupport.DecodeResponse(target, res); err != nil {
  4160. return nil, err
  4161. }
  4162. return ret, nil
  4163. // {
  4164. // "description": "Creates a new group.",
  4165. // "flatPath": "v3/projects/{projectsId}/groups",
  4166. // "httpMethod": "POST",
  4167. // "id": "monitoring.projects.groups.create",
  4168. // "parameterOrder": [
  4169. // "name"
  4170. // ],
  4171. // "parameters": {
  4172. // "name": {
  4173. // "description": "The project in which to create the group. The format is \"projects/{project_id_or_number}\".",
  4174. // "location": "path",
  4175. // "pattern": "^projects/[^/]+$",
  4176. // "required": true,
  4177. // "type": "string"
  4178. // },
  4179. // "validateOnly": {
  4180. // "description": "If true, validate this request but do not create the group.",
  4181. // "location": "query",
  4182. // "type": "boolean"
  4183. // }
  4184. // },
  4185. // "path": "v3/{+name}/groups",
  4186. // "request": {
  4187. // "$ref": "Group"
  4188. // },
  4189. // "response": {
  4190. // "$ref": "Group"
  4191. // },
  4192. // "scopes": [
  4193. // "https://www.googleapis.com/auth/cloud-platform",
  4194. // "https://www.googleapis.com/auth/monitoring"
  4195. // ]
  4196. // }
  4197. }
  4198. // method id "monitoring.projects.groups.delete":
  4199. type ProjectsGroupsDeleteCall struct {
  4200. s *Service
  4201. name string
  4202. urlParams_ gensupport.URLParams
  4203. ctx_ context.Context
  4204. header_ http.Header
  4205. }
  4206. // Delete: Deletes an existing group.
  4207. func (r *ProjectsGroupsService) Delete(name string) *ProjectsGroupsDeleteCall {
  4208. c := &ProjectsGroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4209. c.name = name
  4210. return c
  4211. }
  4212. // Fields allows partial responses to be retrieved. See
  4213. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4214. // for more information.
  4215. func (c *ProjectsGroupsDeleteCall) Fields(s ...googleapi.Field) *ProjectsGroupsDeleteCall {
  4216. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4217. return c
  4218. }
  4219. // Context sets the context to be used in this call's Do method. Any
  4220. // pending HTTP request will be aborted if the provided context is
  4221. // canceled.
  4222. func (c *ProjectsGroupsDeleteCall) Context(ctx context.Context) *ProjectsGroupsDeleteCall {
  4223. c.ctx_ = ctx
  4224. return c
  4225. }
  4226. // Header returns an http.Header that can be modified by the caller to
  4227. // add HTTP headers to the request.
  4228. func (c *ProjectsGroupsDeleteCall) Header() http.Header {
  4229. if c.header_ == nil {
  4230. c.header_ = make(http.Header)
  4231. }
  4232. return c.header_
  4233. }
  4234. func (c *ProjectsGroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4235. reqHeaders := make(http.Header)
  4236. for k, v := range c.header_ {
  4237. reqHeaders[k] = v
  4238. }
  4239. reqHeaders.Set("User-Agent", c.s.userAgent())
  4240. var body io.Reader = nil
  4241. c.urlParams_.Set("alt", alt)
  4242. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4243. urls += "?" + c.urlParams_.Encode()
  4244. req, _ := http.NewRequest("DELETE", urls, body)
  4245. req.Header = reqHeaders
  4246. googleapi.Expand(req.URL, map[string]string{
  4247. "name": c.name,
  4248. })
  4249. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4250. }
  4251. // Do executes the "monitoring.projects.groups.delete" call.
  4252. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4253. // code is an error. Response headers are in either
  4254. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4255. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4256. // check whether the returned error was because http.StatusNotModified
  4257. // was returned.
  4258. func (c *ProjectsGroupsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4259. gensupport.SetOptions(c.urlParams_, opts...)
  4260. res, err := c.doRequest("json")
  4261. if res != nil && res.StatusCode == http.StatusNotModified {
  4262. if res.Body != nil {
  4263. res.Body.Close()
  4264. }
  4265. return nil, &googleapi.Error{
  4266. Code: res.StatusCode,
  4267. Header: res.Header,
  4268. }
  4269. }
  4270. if err != nil {
  4271. return nil, err
  4272. }
  4273. defer googleapi.CloseBody(res)
  4274. if err := googleapi.CheckResponse(res); err != nil {
  4275. return nil, err
  4276. }
  4277. ret := &Empty{
  4278. ServerResponse: googleapi.ServerResponse{
  4279. Header: res.Header,
  4280. HTTPStatusCode: res.StatusCode,
  4281. },
  4282. }
  4283. target := &ret
  4284. if err := gensupport.DecodeResponse(target, res); err != nil {
  4285. return nil, err
  4286. }
  4287. return ret, nil
  4288. // {
  4289. // "description": "Deletes an existing group.",
  4290. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  4291. // "httpMethod": "DELETE",
  4292. // "id": "monitoring.projects.groups.delete",
  4293. // "parameterOrder": [
  4294. // "name"
  4295. // ],
  4296. // "parameters": {
  4297. // "name": {
  4298. // "description": "The group to delete. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  4299. // "location": "path",
  4300. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4301. // "required": true,
  4302. // "type": "string"
  4303. // }
  4304. // },
  4305. // "path": "v3/{+name}",
  4306. // "response": {
  4307. // "$ref": "Empty"
  4308. // },
  4309. // "scopes": [
  4310. // "https://www.googleapis.com/auth/cloud-platform",
  4311. // "https://www.googleapis.com/auth/monitoring"
  4312. // ]
  4313. // }
  4314. }
  4315. // method id "monitoring.projects.groups.get":
  4316. type ProjectsGroupsGetCall struct {
  4317. s *Service
  4318. name string
  4319. urlParams_ gensupport.URLParams
  4320. ifNoneMatch_ string
  4321. ctx_ context.Context
  4322. header_ http.Header
  4323. }
  4324. // Get: Gets a single group.
  4325. func (r *ProjectsGroupsService) Get(name string) *ProjectsGroupsGetCall {
  4326. c := &ProjectsGroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4327. c.name = name
  4328. return c
  4329. }
  4330. // Fields allows partial responses to be retrieved. See
  4331. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4332. // for more information.
  4333. func (c *ProjectsGroupsGetCall) Fields(s ...googleapi.Field) *ProjectsGroupsGetCall {
  4334. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4335. return c
  4336. }
  4337. // IfNoneMatch sets the optional parameter which makes the operation
  4338. // fail if the object's ETag matches the given value. This is useful for
  4339. // getting updates only after the object has changed since the last
  4340. // request. Use googleapi.IsNotModified to check whether the response
  4341. // error from Do is the result of In-None-Match.
  4342. func (c *ProjectsGroupsGetCall) IfNoneMatch(entityTag string) *ProjectsGroupsGetCall {
  4343. c.ifNoneMatch_ = entityTag
  4344. return c
  4345. }
  4346. // Context sets the context to be used in this call's Do method. Any
  4347. // pending HTTP request will be aborted if the provided context is
  4348. // canceled.
  4349. func (c *ProjectsGroupsGetCall) Context(ctx context.Context) *ProjectsGroupsGetCall {
  4350. c.ctx_ = ctx
  4351. return c
  4352. }
  4353. // Header returns an http.Header that can be modified by the caller to
  4354. // add HTTP headers to the request.
  4355. func (c *ProjectsGroupsGetCall) Header() http.Header {
  4356. if c.header_ == nil {
  4357. c.header_ = make(http.Header)
  4358. }
  4359. return c.header_
  4360. }
  4361. func (c *ProjectsGroupsGetCall) doRequest(alt string) (*http.Response, error) {
  4362. reqHeaders := make(http.Header)
  4363. for k, v := range c.header_ {
  4364. reqHeaders[k] = v
  4365. }
  4366. reqHeaders.Set("User-Agent", c.s.userAgent())
  4367. if c.ifNoneMatch_ != "" {
  4368. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4369. }
  4370. var body io.Reader = nil
  4371. c.urlParams_.Set("alt", alt)
  4372. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4373. urls += "?" + c.urlParams_.Encode()
  4374. req, _ := http.NewRequest("GET", urls, body)
  4375. req.Header = reqHeaders
  4376. googleapi.Expand(req.URL, map[string]string{
  4377. "name": c.name,
  4378. })
  4379. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4380. }
  4381. // Do executes the "monitoring.projects.groups.get" call.
  4382. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4383. // code is an error. Response headers are in either
  4384. // *Group.ServerResponse.Header or (if a response was returned at all)
  4385. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4386. // check whether the returned error was because http.StatusNotModified
  4387. // was returned.
  4388. func (c *ProjectsGroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4389. gensupport.SetOptions(c.urlParams_, opts...)
  4390. res, err := c.doRequest("json")
  4391. if res != nil && res.StatusCode == http.StatusNotModified {
  4392. if res.Body != nil {
  4393. res.Body.Close()
  4394. }
  4395. return nil, &googleapi.Error{
  4396. Code: res.StatusCode,
  4397. Header: res.Header,
  4398. }
  4399. }
  4400. if err != nil {
  4401. return nil, err
  4402. }
  4403. defer googleapi.CloseBody(res)
  4404. if err := googleapi.CheckResponse(res); err != nil {
  4405. return nil, err
  4406. }
  4407. ret := &Group{
  4408. ServerResponse: googleapi.ServerResponse{
  4409. Header: res.Header,
  4410. HTTPStatusCode: res.StatusCode,
  4411. },
  4412. }
  4413. target := &ret
  4414. if err := gensupport.DecodeResponse(target, res); err != nil {
  4415. return nil, err
  4416. }
  4417. return ret, nil
  4418. // {
  4419. // "description": "Gets a single group.",
  4420. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  4421. // "httpMethod": "GET",
  4422. // "id": "monitoring.projects.groups.get",
  4423. // "parameterOrder": [
  4424. // "name"
  4425. // ],
  4426. // "parameters": {
  4427. // "name": {
  4428. // "description": "The group to retrieve. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  4429. // "location": "path",
  4430. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4431. // "required": true,
  4432. // "type": "string"
  4433. // }
  4434. // },
  4435. // "path": "v3/{+name}",
  4436. // "response": {
  4437. // "$ref": "Group"
  4438. // },
  4439. // "scopes": [
  4440. // "https://www.googleapis.com/auth/cloud-platform",
  4441. // "https://www.googleapis.com/auth/monitoring",
  4442. // "https://www.googleapis.com/auth/monitoring.read"
  4443. // ]
  4444. // }
  4445. }
  4446. // method id "monitoring.projects.groups.list":
  4447. type ProjectsGroupsListCall struct {
  4448. s *Service
  4449. name string
  4450. urlParams_ gensupport.URLParams
  4451. ifNoneMatch_ string
  4452. ctx_ context.Context
  4453. header_ http.Header
  4454. }
  4455. // List: Lists the existing groups.
  4456. func (r *ProjectsGroupsService) List(name string) *ProjectsGroupsListCall {
  4457. c := &ProjectsGroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4458. c.name = name
  4459. return c
  4460. }
  4461. // AncestorsOfGroup sets the optional parameter "ancestorsOfGroup": A
  4462. // group name: "projects/{project_id_or_number}/groups/{group_id}".
  4463. // Returns groups that are ancestors of the specified group. The groups
  4464. // are returned in order, starting with the immediate parent and ending
  4465. // with the most distant ancestor. If the specified group has no
  4466. // immediate parent, the results are empty.
  4467. func (c *ProjectsGroupsListCall) AncestorsOfGroup(ancestorsOfGroup string) *ProjectsGroupsListCall {
  4468. c.urlParams_.Set("ancestorsOfGroup", ancestorsOfGroup)
  4469. return c
  4470. }
  4471. // ChildrenOfGroup sets the optional parameter "childrenOfGroup": A
  4472. // group name: "projects/{project_id_or_number}/groups/{group_id}".
  4473. // Returns groups whose parentName field contains the group name. If no
  4474. // groups have this parent, the results are empty.
  4475. func (c *ProjectsGroupsListCall) ChildrenOfGroup(childrenOfGroup string) *ProjectsGroupsListCall {
  4476. c.urlParams_.Set("childrenOfGroup", childrenOfGroup)
  4477. return c
  4478. }
  4479. // DescendantsOfGroup sets the optional parameter "descendantsOfGroup":
  4480. // A group name: "projects/{project_id_or_number}/groups/{group_id}".
  4481. // Returns the descendants of the specified group. This is a superset of
  4482. // the results returned by the childrenOfGroup filter, and includes
  4483. // children-of-children, and so forth.
  4484. func (c *ProjectsGroupsListCall) DescendantsOfGroup(descendantsOfGroup string) *ProjectsGroupsListCall {
  4485. c.urlParams_.Set("descendantsOfGroup", descendantsOfGroup)
  4486. return c
  4487. }
  4488. // PageSize sets the optional parameter "pageSize": A positive number
  4489. // that is the maximum number of results to return.
  4490. func (c *ProjectsGroupsListCall) PageSize(pageSize int64) *ProjectsGroupsListCall {
  4491. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4492. return c
  4493. }
  4494. // PageToken sets the optional parameter "pageToken": If this field is
  4495. // not empty then it must contain the nextPageToken value returned by a
  4496. // previous call to this method. Using this field causes the method to
  4497. // return additional results from the previous method call.
  4498. func (c *ProjectsGroupsListCall) PageToken(pageToken string) *ProjectsGroupsListCall {
  4499. c.urlParams_.Set("pageToken", pageToken)
  4500. return c
  4501. }
  4502. // Fields allows partial responses to be retrieved. See
  4503. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4504. // for more information.
  4505. func (c *ProjectsGroupsListCall) Fields(s ...googleapi.Field) *ProjectsGroupsListCall {
  4506. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4507. return c
  4508. }
  4509. // IfNoneMatch sets the optional parameter which makes the operation
  4510. // fail if the object's ETag matches the given value. This is useful for
  4511. // getting updates only after the object has changed since the last
  4512. // request. Use googleapi.IsNotModified to check whether the response
  4513. // error from Do is the result of In-None-Match.
  4514. func (c *ProjectsGroupsListCall) IfNoneMatch(entityTag string) *ProjectsGroupsListCall {
  4515. c.ifNoneMatch_ = entityTag
  4516. return c
  4517. }
  4518. // Context sets the context to be used in this call's Do method. Any
  4519. // pending HTTP request will be aborted if the provided context is
  4520. // canceled.
  4521. func (c *ProjectsGroupsListCall) Context(ctx context.Context) *ProjectsGroupsListCall {
  4522. c.ctx_ = ctx
  4523. return c
  4524. }
  4525. // Header returns an http.Header that can be modified by the caller to
  4526. // add HTTP headers to the request.
  4527. func (c *ProjectsGroupsListCall) Header() http.Header {
  4528. if c.header_ == nil {
  4529. c.header_ = make(http.Header)
  4530. }
  4531. return c.header_
  4532. }
  4533. func (c *ProjectsGroupsListCall) doRequest(alt string) (*http.Response, error) {
  4534. reqHeaders := make(http.Header)
  4535. for k, v := range c.header_ {
  4536. reqHeaders[k] = v
  4537. }
  4538. reqHeaders.Set("User-Agent", c.s.userAgent())
  4539. if c.ifNoneMatch_ != "" {
  4540. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4541. }
  4542. var body io.Reader = nil
  4543. c.urlParams_.Set("alt", alt)
  4544. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/groups")
  4545. urls += "?" + c.urlParams_.Encode()
  4546. req, _ := http.NewRequest("GET", urls, body)
  4547. req.Header = reqHeaders
  4548. googleapi.Expand(req.URL, map[string]string{
  4549. "name": c.name,
  4550. })
  4551. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4552. }
  4553. // Do executes the "monitoring.projects.groups.list" call.
  4554. // Exactly one of *ListGroupsResponse or error will be non-nil. Any
  4555. // non-2xx status code is an error. Response headers are in either
  4556. // *ListGroupsResponse.ServerResponse.Header or (if a response was
  4557. // returned at all) in error.(*googleapi.Error).Header. Use
  4558. // googleapi.IsNotModified to check whether the returned error was
  4559. // because http.StatusNotModified was returned.
  4560. func (c *ProjectsGroupsListCall) Do(opts ...googleapi.CallOption) (*ListGroupsResponse, error) {
  4561. gensupport.SetOptions(c.urlParams_, opts...)
  4562. res, err := c.doRequest("json")
  4563. if res != nil && res.StatusCode == http.StatusNotModified {
  4564. if res.Body != nil {
  4565. res.Body.Close()
  4566. }
  4567. return nil, &googleapi.Error{
  4568. Code: res.StatusCode,
  4569. Header: res.Header,
  4570. }
  4571. }
  4572. if err != nil {
  4573. return nil, err
  4574. }
  4575. defer googleapi.CloseBody(res)
  4576. if err := googleapi.CheckResponse(res); err != nil {
  4577. return nil, err
  4578. }
  4579. ret := &ListGroupsResponse{
  4580. ServerResponse: googleapi.ServerResponse{
  4581. Header: res.Header,
  4582. HTTPStatusCode: res.StatusCode,
  4583. },
  4584. }
  4585. target := &ret
  4586. if err := gensupport.DecodeResponse(target, res); err != nil {
  4587. return nil, err
  4588. }
  4589. return ret, nil
  4590. // {
  4591. // "description": "Lists the existing groups.",
  4592. // "flatPath": "v3/projects/{projectsId}/groups",
  4593. // "httpMethod": "GET",
  4594. // "id": "monitoring.projects.groups.list",
  4595. // "parameterOrder": [
  4596. // "name"
  4597. // ],
  4598. // "parameters": {
  4599. // "ancestorsOfGroup": {
  4600. // "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.",
  4601. // "location": "query",
  4602. // "type": "string"
  4603. // },
  4604. // "childrenOfGroup": {
  4605. // "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.",
  4606. // "location": "query",
  4607. // "type": "string"
  4608. // },
  4609. // "descendantsOfGroup": {
  4610. // "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.",
  4611. // "location": "query",
  4612. // "type": "string"
  4613. // },
  4614. // "name": {
  4615. // "description": "The project whose groups are to be listed. The format is \"projects/{project_id_or_number}\".",
  4616. // "location": "path",
  4617. // "pattern": "^projects/[^/]+$",
  4618. // "required": true,
  4619. // "type": "string"
  4620. // },
  4621. // "pageSize": {
  4622. // "description": "A positive number that is the maximum number of results to return.",
  4623. // "format": "int32",
  4624. // "location": "query",
  4625. // "type": "integer"
  4626. // },
  4627. // "pageToken": {
  4628. // "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.",
  4629. // "location": "query",
  4630. // "type": "string"
  4631. // }
  4632. // },
  4633. // "path": "v3/{+name}/groups",
  4634. // "response": {
  4635. // "$ref": "ListGroupsResponse"
  4636. // },
  4637. // "scopes": [
  4638. // "https://www.googleapis.com/auth/cloud-platform",
  4639. // "https://www.googleapis.com/auth/monitoring",
  4640. // "https://www.googleapis.com/auth/monitoring.read"
  4641. // ]
  4642. // }
  4643. }
  4644. // Pages invokes f for each page of results.
  4645. // A non-nil error returned from f will halt the iteration.
  4646. // The provided context supersedes any context provided to the Context method.
  4647. func (c *ProjectsGroupsListCall) Pages(ctx context.Context, f func(*ListGroupsResponse) error) error {
  4648. c.ctx_ = ctx
  4649. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4650. for {
  4651. x, err := c.Do()
  4652. if err != nil {
  4653. return err
  4654. }
  4655. if err := f(x); err != nil {
  4656. return err
  4657. }
  4658. if x.NextPageToken == "" {
  4659. return nil
  4660. }
  4661. c.PageToken(x.NextPageToken)
  4662. }
  4663. }
  4664. // method id "monitoring.projects.groups.update":
  4665. type ProjectsGroupsUpdateCall struct {
  4666. s *Service
  4667. name string
  4668. group *Group
  4669. urlParams_ gensupport.URLParams
  4670. ctx_ context.Context
  4671. header_ http.Header
  4672. }
  4673. // Update: Updates an existing group. You can change any group
  4674. // attributes except name.
  4675. func (r *ProjectsGroupsService) Update(name string, group *Group) *ProjectsGroupsUpdateCall {
  4676. c := &ProjectsGroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4677. c.name = name
  4678. c.group = group
  4679. return c
  4680. }
  4681. // ValidateOnly sets the optional parameter "validateOnly": If true,
  4682. // validate this request but do not update the existing group.
  4683. func (c *ProjectsGroupsUpdateCall) ValidateOnly(validateOnly bool) *ProjectsGroupsUpdateCall {
  4684. c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
  4685. return c
  4686. }
  4687. // Fields allows partial responses to be retrieved. See
  4688. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4689. // for more information.
  4690. func (c *ProjectsGroupsUpdateCall) Fields(s ...googleapi.Field) *ProjectsGroupsUpdateCall {
  4691. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4692. return c
  4693. }
  4694. // Context sets the context to be used in this call's Do method. Any
  4695. // pending HTTP request will be aborted if the provided context is
  4696. // canceled.
  4697. func (c *ProjectsGroupsUpdateCall) Context(ctx context.Context) *ProjectsGroupsUpdateCall {
  4698. c.ctx_ = ctx
  4699. return c
  4700. }
  4701. // Header returns an http.Header that can be modified by the caller to
  4702. // add HTTP headers to the request.
  4703. func (c *ProjectsGroupsUpdateCall) Header() http.Header {
  4704. if c.header_ == nil {
  4705. c.header_ = make(http.Header)
  4706. }
  4707. return c.header_
  4708. }
  4709. func (c *ProjectsGroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4710. reqHeaders := make(http.Header)
  4711. for k, v := range c.header_ {
  4712. reqHeaders[k] = v
  4713. }
  4714. reqHeaders.Set("User-Agent", c.s.userAgent())
  4715. var body io.Reader = nil
  4716. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  4717. if err != nil {
  4718. return nil, err
  4719. }
  4720. reqHeaders.Set("Content-Type", "application/json")
  4721. c.urlParams_.Set("alt", alt)
  4722. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  4723. urls += "?" + c.urlParams_.Encode()
  4724. req, _ := http.NewRequest("PUT", urls, body)
  4725. req.Header = reqHeaders
  4726. googleapi.Expand(req.URL, map[string]string{
  4727. "name": c.name,
  4728. })
  4729. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4730. }
  4731. // Do executes the "monitoring.projects.groups.update" call.
  4732. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  4733. // code is an error. Response headers are in either
  4734. // *Group.ServerResponse.Header or (if a response was returned at all)
  4735. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4736. // check whether the returned error was because http.StatusNotModified
  4737. // was returned.
  4738. func (c *ProjectsGroupsUpdateCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  4739. gensupport.SetOptions(c.urlParams_, opts...)
  4740. res, err := c.doRequest("json")
  4741. if res != nil && res.StatusCode == http.StatusNotModified {
  4742. if res.Body != nil {
  4743. res.Body.Close()
  4744. }
  4745. return nil, &googleapi.Error{
  4746. Code: res.StatusCode,
  4747. Header: res.Header,
  4748. }
  4749. }
  4750. if err != nil {
  4751. return nil, err
  4752. }
  4753. defer googleapi.CloseBody(res)
  4754. if err := googleapi.CheckResponse(res); err != nil {
  4755. return nil, err
  4756. }
  4757. ret := &Group{
  4758. ServerResponse: googleapi.ServerResponse{
  4759. Header: res.Header,
  4760. HTTPStatusCode: res.StatusCode,
  4761. },
  4762. }
  4763. target := &ret
  4764. if err := gensupport.DecodeResponse(target, res); err != nil {
  4765. return nil, err
  4766. }
  4767. return ret, nil
  4768. // {
  4769. // "description": "Updates an existing group. You can change any group attributes except name.",
  4770. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}",
  4771. // "httpMethod": "PUT",
  4772. // "id": "monitoring.projects.groups.update",
  4773. // "parameterOrder": [
  4774. // "name"
  4775. // ],
  4776. // "parameters": {
  4777. // "name": {
  4778. // "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.",
  4779. // "location": "path",
  4780. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4781. // "required": true,
  4782. // "type": "string"
  4783. // },
  4784. // "validateOnly": {
  4785. // "description": "If true, validate this request but do not update the existing group.",
  4786. // "location": "query",
  4787. // "type": "boolean"
  4788. // }
  4789. // },
  4790. // "path": "v3/{+name}",
  4791. // "request": {
  4792. // "$ref": "Group"
  4793. // },
  4794. // "response": {
  4795. // "$ref": "Group"
  4796. // },
  4797. // "scopes": [
  4798. // "https://www.googleapis.com/auth/cloud-platform",
  4799. // "https://www.googleapis.com/auth/monitoring"
  4800. // ]
  4801. // }
  4802. }
  4803. // method id "monitoring.projects.groups.members.list":
  4804. type ProjectsGroupsMembersListCall struct {
  4805. s *Service
  4806. name string
  4807. urlParams_ gensupport.URLParams
  4808. ifNoneMatch_ string
  4809. ctx_ context.Context
  4810. header_ http.Header
  4811. }
  4812. // List: Lists the monitored resources that are members of a group.
  4813. func (r *ProjectsGroupsMembersService) List(name string) *ProjectsGroupsMembersListCall {
  4814. c := &ProjectsGroupsMembersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4815. c.name = name
  4816. return c
  4817. }
  4818. // Filter sets the optional parameter "filter": An optional list filter
  4819. // describing the members to be returned. The filter may reference the
  4820. // type, labels, and metadata of monitored resources that comprise the
  4821. // group. For example, to return only resources representing Compute
  4822. // Engine VM instances, use this filter:
  4823. // resource.type = "gce_instance"
  4824. func (c *ProjectsGroupsMembersListCall) Filter(filter string) *ProjectsGroupsMembersListCall {
  4825. c.urlParams_.Set("filter", filter)
  4826. return c
  4827. }
  4828. // IntervalEndTime sets the optional parameter "interval.endTime":
  4829. // Required. The end of the time interval.
  4830. func (c *ProjectsGroupsMembersListCall) IntervalEndTime(intervalEndTime string) *ProjectsGroupsMembersListCall {
  4831. c.urlParams_.Set("interval.endTime", intervalEndTime)
  4832. return c
  4833. }
  4834. // IntervalStartTime sets the optional parameter "interval.startTime":
  4835. // The beginning of the time interval. The default value for the start
  4836. // time is the end time. The start time must not be later than the end
  4837. // time.
  4838. func (c *ProjectsGroupsMembersListCall) IntervalStartTime(intervalStartTime string) *ProjectsGroupsMembersListCall {
  4839. c.urlParams_.Set("interval.startTime", intervalStartTime)
  4840. return c
  4841. }
  4842. // PageSize sets the optional parameter "pageSize": A positive number
  4843. // that is the maximum number of results to return.
  4844. func (c *ProjectsGroupsMembersListCall) PageSize(pageSize int64) *ProjectsGroupsMembersListCall {
  4845. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4846. return c
  4847. }
  4848. // PageToken sets the optional parameter "pageToken": If this field is
  4849. // not empty then it must contain the nextPageToken value returned by a
  4850. // previous call to this method. Using this field causes the method to
  4851. // return additional results from the previous method call.
  4852. func (c *ProjectsGroupsMembersListCall) PageToken(pageToken string) *ProjectsGroupsMembersListCall {
  4853. c.urlParams_.Set("pageToken", pageToken)
  4854. return c
  4855. }
  4856. // Fields allows partial responses to be retrieved. See
  4857. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4858. // for more information.
  4859. func (c *ProjectsGroupsMembersListCall) Fields(s ...googleapi.Field) *ProjectsGroupsMembersListCall {
  4860. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4861. return c
  4862. }
  4863. // IfNoneMatch sets the optional parameter which makes the operation
  4864. // fail if the object's ETag matches the given value. This is useful for
  4865. // getting updates only after the object has changed since the last
  4866. // request. Use googleapi.IsNotModified to check whether the response
  4867. // error from Do is the result of In-None-Match.
  4868. func (c *ProjectsGroupsMembersListCall) IfNoneMatch(entityTag string) *ProjectsGroupsMembersListCall {
  4869. c.ifNoneMatch_ = entityTag
  4870. return c
  4871. }
  4872. // Context sets the context to be used in this call's Do method. Any
  4873. // pending HTTP request will be aborted if the provided context is
  4874. // canceled.
  4875. func (c *ProjectsGroupsMembersListCall) Context(ctx context.Context) *ProjectsGroupsMembersListCall {
  4876. c.ctx_ = ctx
  4877. return c
  4878. }
  4879. // Header returns an http.Header that can be modified by the caller to
  4880. // add HTTP headers to the request.
  4881. func (c *ProjectsGroupsMembersListCall) Header() http.Header {
  4882. if c.header_ == nil {
  4883. c.header_ = make(http.Header)
  4884. }
  4885. return c.header_
  4886. }
  4887. func (c *ProjectsGroupsMembersListCall) doRequest(alt string) (*http.Response, error) {
  4888. reqHeaders := make(http.Header)
  4889. for k, v := range c.header_ {
  4890. reqHeaders[k] = v
  4891. }
  4892. reqHeaders.Set("User-Agent", c.s.userAgent())
  4893. if c.ifNoneMatch_ != "" {
  4894. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4895. }
  4896. var body io.Reader = nil
  4897. c.urlParams_.Set("alt", alt)
  4898. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/members")
  4899. urls += "?" + c.urlParams_.Encode()
  4900. req, _ := http.NewRequest("GET", urls, body)
  4901. req.Header = reqHeaders
  4902. googleapi.Expand(req.URL, map[string]string{
  4903. "name": c.name,
  4904. })
  4905. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4906. }
  4907. // Do executes the "monitoring.projects.groups.members.list" call.
  4908. // Exactly one of *ListGroupMembersResponse or error will be non-nil.
  4909. // Any non-2xx status code is an error. Response headers are in either
  4910. // *ListGroupMembersResponse.ServerResponse.Header or (if a response was
  4911. // returned at all) in error.(*googleapi.Error).Header. Use
  4912. // googleapi.IsNotModified to check whether the returned error was
  4913. // because http.StatusNotModified was returned.
  4914. func (c *ProjectsGroupsMembersListCall) Do(opts ...googleapi.CallOption) (*ListGroupMembersResponse, error) {
  4915. gensupport.SetOptions(c.urlParams_, opts...)
  4916. res, err := c.doRequest("json")
  4917. if res != nil && res.StatusCode == http.StatusNotModified {
  4918. if res.Body != nil {
  4919. res.Body.Close()
  4920. }
  4921. return nil, &googleapi.Error{
  4922. Code: res.StatusCode,
  4923. Header: res.Header,
  4924. }
  4925. }
  4926. if err != nil {
  4927. return nil, err
  4928. }
  4929. defer googleapi.CloseBody(res)
  4930. if err := googleapi.CheckResponse(res); err != nil {
  4931. return nil, err
  4932. }
  4933. ret := &ListGroupMembersResponse{
  4934. ServerResponse: googleapi.ServerResponse{
  4935. Header: res.Header,
  4936. HTTPStatusCode: res.StatusCode,
  4937. },
  4938. }
  4939. target := &ret
  4940. if err := gensupport.DecodeResponse(target, res); err != nil {
  4941. return nil, err
  4942. }
  4943. return ret, nil
  4944. // {
  4945. // "description": "Lists the monitored resources that are members of a group.",
  4946. // "flatPath": "v3/projects/{projectsId}/groups/{groupsId}/members",
  4947. // "httpMethod": "GET",
  4948. // "id": "monitoring.projects.groups.members.list",
  4949. // "parameterOrder": [
  4950. // "name"
  4951. // ],
  4952. // "parameters": {
  4953. // "filter": {
  4954. // "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",
  4955. // "location": "query",
  4956. // "type": "string"
  4957. // },
  4958. // "interval.endTime": {
  4959. // "description": "Required. The end of the time interval.",
  4960. // "format": "google-datetime",
  4961. // "location": "query",
  4962. // "type": "string"
  4963. // },
  4964. // "interval.startTime": {
  4965. // "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.",
  4966. // "format": "google-datetime",
  4967. // "location": "query",
  4968. // "type": "string"
  4969. // },
  4970. // "name": {
  4971. // "description": "The group whose members are listed. The format is \"projects/{project_id_or_number}/groups/{group_id}\".",
  4972. // "location": "path",
  4973. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  4974. // "required": true,
  4975. // "type": "string"
  4976. // },
  4977. // "pageSize": {
  4978. // "description": "A positive number that is the maximum number of results to return.",
  4979. // "format": "int32",
  4980. // "location": "query",
  4981. // "type": "integer"
  4982. // },
  4983. // "pageToken": {
  4984. // "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.",
  4985. // "location": "query",
  4986. // "type": "string"
  4987. // }
  4988. // },
  4989. // "path": "v3/{+name}/members",
  4990. // "response": {
  4991. // "$ref": "ListGroupMembersResponse"
  4992. // },
  4993. // "scopes": [
  4994. // "https://www.googleapis.com/auth/cloud-platform",
  4995. // "https://www.googleapis.com/auth/monitoring",
  4996. // "https://www.googleapis.com/auth/monitoring.read"
  4997. // ]
  4998. // }
  4999. }
  5000. // Pages invokes f for each page of results.
  5001. // A non-nil error returned from f will halt the iteration.
  5002. // The provided context supersedes any context provided to the Context method.
  5003. func (c *ProjectsGroupsMembersListCall) Pages(ctx context.Context, f func(*ListGroupMembersResponse) error) error {
  5004. c.ctx_ = ctx
  5005. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5006. for {
  5007. x, err := c.Do()
  5008. if err != nil {
  5009. return err
  5010. }
  5011. if err := f(x); err != nil {
  5012. return err
  5013. }
  5014. if x.NextPageToken == "" {
  5015. return nil
  5016. }
  5017. c.PageToken(x.NextPageToken)
  5018. }
  5019. }
  5020. // method id "monitoring.projects.metricDescriptors.create":
  5021. type ProjectsMetricDescriptorsCreateCall struct {
  5022. s *Service
  5023. name string
  5024. metricdescriptor *MetricDescriptor
  5025. urlParams_ gensupport.URLParams
  5026. ctx_ context.Context
  5027. header_ http.Header
  5028. }
  5029. // Create: Creates a new metric descriptor. User-created metric
  5030. // descriptors define custom metrics.
  5031. func (r *ProjectsMetricDescriptorsService) Create(name string, metricdescriptor *MetricDescriptor) *ProjectsMetricDescriptorsCreateCall {
  5032. c := &ProjectsMetricDescriptorsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5033. c.name = name
  5034. c.metricdescriptor = metricdescriptor
  5035. return c
  5036. }
  5037. // Fields allows partial responses to be retrieved. See
  5038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5039. // for more information.
  5040. func (c *ProjectsMetricDescriptorsCreateCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsCreateCall {
  5041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5042. return c
  5043. }
  5044. // Context sets the context to be used in this call's Do method. Any
  5045. // pending HTTP request will be aborted if the provided context is
  5046. // canceled.
  5047. func (c *ProjectsMetricDescriptorsCreateCall) Context(ctx context.Context) *ProjectsMetricDescriptorsCreateCall {
  5048. c.ctx_ = ctx
  5049. return c
  5050. }
  5051. // Header returns an http.Header that can be modified by the caller to
  5052. // add HTTP headers to the request.
  5053. func (c *ProjectsMetricDescriptorsCreateCall) Header() http.Header {
  5054. if c.header_ == nil {
  5055. c.header_ = make(http.Header)
  5056. }
  5057. return c.header_
  5058. }
  5059. func (c *ProjectsMetricDescriptorsCreateCall) doRequest(alt string) (*http.Response, error) {
  5060. reqHeaders := make(http.Header)
  5061. for k, v := range c.header_ {
  5062. reqHeaders[k] = v
  5063. }
  5064. reqHeaders.Set("User-Agent", c.s.userAgent())
  5065. var body io.Reader = nil
  5066. body, err := googleapi.WithoutDataWrapper.JSONReader(c.metricdescriptor)
  5067. if err != nil {
  5068. return nil, err
  5069. }
  5070. reqHeaders.Set("Content-Type", "application/json")
  5071. c.urlParams_.Set("alt", alt)
  5072. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/metricDescriptors")
  5073. urls += "?" + c.urlParams_.Encode()
  5074. req, _ := http.NewRequest("POST", urls, body)
  5075. req.Header = reqHeaders
  5076. googleapi.Expand(req.URL, map[string]string{
  5077. "name": c.name,
  5078. })
  5079. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5080. }
  5081. // Do executes the "monitoring.projects.metricDescriptors.create" call.
  5082. // Exactly one of *MetricDescriptor or error will be non-nil. Any
  5083. // non-2xx status code is an error. Response headers are in either
  5084. // *MetricDescriptor.ServerResponse.Header or (if a response was
  5085. // returned at all) in error.(*googleapi.Error).Header. Use
  5086. // googleapi.IsNotModified to check whether the returned error was
  5087. // because http.StatusNotModified was returned.
  5088. func (c *ProjectsMetricDescriptorsCreateCall) Do(opts ...googleapi.CallOption) (*MetricDescriptor, error) {
  5089. gensupport.SetOptions(c.urlParams_, opts...)
  5090. res, err := c.doRequest("json")
  5091. if res != nil && res.StatusCode == http.StatusNotModified {
  5092. if res.Body != nil {
  5093. res.Body.Close()
  5094. }
  5095. return nil, &googleapi.Error{
  5096. Code: res.StatusCode,
  5097. Header: res.Header,
  5098. }
  5099. }
  5100. if err != nil {
  5101. return nil, err
  5102. }
  5103. defer googleapi.CloseBody(res)
  5104. if err := googleapi.CheckResponse(res); err != nil {
  5105. return nil, err
  5106. }
  5107. ret := &MetricDescriptor{
  5108. ServerResponse: googleapi.ServerResponse{
  5109. Header: res.Header,
  5110. HTTPStatusCode: res.StatusCode,
  5111. },
  5112. }
  5113. target := &ret
  5114. if err := gensupport.DecodeResponse(target, res); err != nil {
  5115. return nil, err
  5116. }
  5117. return ret, nil
  5118. // {
  5119. // "description": "Creates a new metric descriptor. User-created metric descriptors define custom metrics.",
  5120. // "flatPath": "v3/projects/{projectsId}/metricDescriptors",
  5121. // "httpMethod": "POST",
  5122. // "id": "monitoring.projects.metricDescriptors.create",
  5123. // "parameterOrder": [
  5124. // "name"
  5125. // ],
  5126. // "parameters": {
  5127. // "name": {
  5128. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  5129. // "location": "path",
  5130. // "pattern": "^projects/[^/]+$",
  5131. // "required": true,
  5132. // "type": "string"
  5133. // }
  5134. // },
  5135. // "path": "v3/{+name}/metricDescriptors",
  5136. // "request": {
  5137. // "$ref": "MetricDescriptor"
  5138. // },
  5139. // "response": {
  5140. // "$ref": "MetricDescriptor"
  5141. // },
  5142. // "scopes": [
  5143. // "https://www.googleapis.com/auth/cloud-platform",
  5144. // "https://www.googleapis.com/auth/monitoring",
  5145. // "https://www.googleapis.com/auth/monitoring.write"
  5146. // ]
  5147. // }
  5148. }
  5149. // method id "monitoring.projects.metricDescriptors.delete":
  5150. type ProjectsMetricDescriptorsDeleteCall struct {
  5151. s *Service
  5152. name string
  5153. urlParams_ gensupport.URLParams
  5154. ctx_ context.Context
  5155. header_ http.Header
  5156. }
  5157. // Delete: Deletes a metric descriptor. Only user-created custom metrics
  5158. // can be deleted.
  5159. func (r *ProjectsMetricDescriptorsService) Delete(name string) *ProjectsMetricDescriptorsDeleteCall {
  5160. c := &ProjectsMetricDescriptorsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5161. c.name = name
  5162. return c
  5163. }
  5164. // Fields allows partial responses to be retrieved. See
  5165. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5166. // for more information.
  5167. func (c *ProjectsMetricDescriptorsDeleteCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsDeleteCall {
  5168. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5169. return c
  5170. }
  5171. // Context sets the context to be used in this call's Do method. Any
  5172. // pending HTTP request will be aborted if the provided context is
  5173. // canceled.
  5174. func (c *ProjectsMetricDescriptorsDeleteCall) Context(ctx context.Context) *ProjectsMetricDescriptorsDeleteCall {
  5175. c.ctx_ = ctx
  5176. return c
  5177. }
  5178. // Header returns an http.Header that can be modified by the caller to
  5179. // add HTTP headers to the request.
  5180. func (c *ProjectsMetricDescriptorsDeleteCall) Header() http.Header {
  5181. if c.header_ == nil {
  5182. c.header_ = make(http.Header)
  5183. }
  5184. return c.header_
  5185. }
  5186. func (c *ProjectsMetricDescriptorsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5187. reqHeaders := make(http.Header)
  5188. for k, v := range c.header_ {
  5189. reqHeaders[k] = v
  5190. }
  5191. reqHeaders.Set("User-Agent", c.s.userAgent())
  5192. var body io.Reader = nil
  5193. c.urlParams_.Set("alt", alt)
  5194. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5195. urls += "?" + c.urlParams_.Encode()
  5196. req, _ := http.NewRequest("DELETE", urls, body)
  5197. req.Header = reqHeaders
  5198. googleapi.Expand(req.URL, map[string]string{
  5199. "name": c.name,
  5200. })
  5201. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5202. }
  5203. // Do executes the "monitoring.projects.metricDescriptors.delete" call.
  5204. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5205. // code is an error. Response headers are in either
  5206. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5207. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5208. // check whether the returned error was because http.StatusNotModified
  5209. // was returned.
  5210. func (c *ProjectsMetricDescriptorsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5211. gensupport.SetOptions(c.urlParams_, opts...)
  5212. res, err := c.doRequest("json")
  5213. if res != nil && res.StatusCode == http.StatusNotModified {
  5214. if res.Body != nil {
  5215. res.Body.Close()
  5216. }
  5217. return nil, &googleapi.Error{
  5218. Code: res.StatusCode,
  5219. Header: res.Header,
  5220. }
  5221. }
  5222. if err != nil {
  5223. return nil, err
  5224. }
  5225. defer googleapi.CloseBody(res)
  5226. if err := googleapi.CheckResponse(res); err != nil {
  5227. return nil, err
  5228. }
  5229. ret := &Empty{
  5230. ServerResponse: googleapi.ServerResponse{
  5231. Header: res.Header,
  5232. HTTPStatusCode: res.StatusCode,
  5233. },
  5234. }
  5235. target := &ret
  5236. if err := gensupport.DecodeResponse(target, res); err != nil {
  5237. return nil, err
  5238. }
  5239. return ret, nil
  5240. // {
  5241. // "description": "Deletes a metric descriptor. Only user-created custom metrics can be deleted.",
  5242. // "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}",
  5243. // "httpMethod": "DELETE",
  5244. // "id": "monitoring.projects.metricDescriptors.delete",
  5245. // "parameterOrder": [
  5246. // "name"
  5247. // ],
  5248. // "parameters": {
  5249. // "name": {
  5250. // "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\".",
  5251. // "location": "path",
  5252. // "pattern": "^projects/[^/]+/metricDescriptors/.+$",
  5253. // "required": true,
  5254. // "type": "string"
  5255. // }
  5256. // },
  5257. // "path": "v3/{+name}",
  5258. // "response": {
  5259. // "$ref": "Empty"
  5260. // },
  5261. // "scopes": [
  5262. // "https://www.googleapis.com/auth/cloud-platform",
  5263. // "https://www.googleapis.com/auth/monitoring"
  5264. // ]
  5265. // }
  5266. }
  5267. // method id "monitoring.projects.metricDescriptors.get":
  5268. type ProjectsMetricDescriptorsGetCall struct {
  5269. s *Service
  5270. name string
  5271. urlParams_ gensupport.URLParams
  5272. ifNoneMatch_ string
  5273. ctx_ context.Context
  5274. header_ http.Header
  5275. }
  5276. // Get: Gets a single metric descriptor. This method does not require a
  5277. // Stackdriver account.
  5278. func (r *ProjectsMetricDescriptorsService) Get(name string) *ProjectsMetricDescriptorsGetCall {
  5279. c := &ProjectsMetricDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5280. c.name = name
  5281. return c
  5282. }
  5283. // Fields allows partial responses to be retrieved. See
  5284. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5285. // for more information.
  5286. func (c *ProjectsMetricDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsGetCall {
  5287. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5288. return c
  5289. }
  5290. // IfNoneMatch sets the optional parameter which makes the operation
  5291. // fail if the object's ETag matches the given value. This is useful for
  5292. // getting updates only after the object has changed since the last
  5293. // request. Use googleapi.IsNotModified to check whether the response
  5294. // error from Do is the result of In-None-Match.
  5295. func (c *ProjectsMetricDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsMetricDescriptorsGetCall {
  5296. c.ifNoneMatch_ = entityTag
  5297. return c
  5298. }
  5299. // Context sets the context to be used in this call's Do method. Any
  5300. // pending HTTP request will be aborted if the provided context is
  5301. // canceled.
  5302. func (c *ProjectsMetricDescriptorsGetCall) Context(ctx context.Context) *ProjectsMetricDescriptorsGetCall {
  5303. c.ctx_ = ctx
  5304. return c
  5305. }
  5306. // Header returns an http.Header that can be modified by the caller to
  5307. // add HTTP headers to the request.
  5308. func (c *ProjectsMetricDescriptorsGetCall) Header() http.Header {
  5309. if c.header_ == nil {
  5310. c.header_ = make(http.Header)
  5311. }
  5312. return c.header_
  5313. }
  5314. func (c *ProjectsMetricDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  5315. reqHeaders := make(http.Header)
  5316. for k, v := range c.header_ {
  5317. reqHeaders[k] = v
  5318. }
  5319. reqHeaders.Set("User-Agent", c.s.userAgent())
  5320. if c.ifNoneMatch_ != "" {
  5321. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5322. }
  5323. var body io.Reader = nil
  5324. c.urlParams_.Set("alt", alt)
  5325. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5326. urls += "?" + c.urlParams_.Encode()
  5327. req, _ := http.NewRequest("GET", urls, body)
  5328. req.Header = reqHeaders
  5329. googleapi.Expand(req.URL, map[string]string{
  5330. "name": c.name,
  5331. })
  5332. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5333. }
  5334. // Do executes the "monitoring.projects.metricDescriptors.get" call.
  5335. // Exactly one of *MetricDescriptor or error will be non-nil. Any
  5336. // non-2xx status code is an error. Response headers are in either
  5337. // *MetricDescriptor.ServerResponse.Header or (if a response was
  5338. // returned at all) in error.(*googleapi.Error).Header. Use
  5339. // googleapi.IsNotModified to check whether the returned error was
  5340. // because http.StatusNotModified was returned.
  5341. func (c *ProjectsMetricDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*MetricDescriptor, error) {
  5342. gensupport.SetOptions(c.urlParams_, opts...)
  5343. res, err := c.doRequest("json")
  5344. if res != nil && res.StatusCode == http.StatusNotModified {
  5345. if res.Body != nil {
  5346. res.Body.Close()
  5347. }
  5348. return nil, &googleapi.Error{
  5349. Code: res.StatusCode,
  5350. Header: res.Header,
  5351. }
  5352. }
  5353. if err != nil {
  5354. return nil, err
  5355. }
  5356. defer googleapi.CloseBody(res)
  5357. if err := googleapi.CheckResponse(res); err != nil {
  5358. return nil, err
  5359. }
  5360. ret := &MetricDescriptor{
  5361. ServerResponse: googleapi.ServerResponse{
  5362. Header: res.Header,
  5363. HTTPStatusCode: res.StatusCode,
  5364. },
  5365. }
  5366. target := &ret
  5367. if err := gensupport.DecodeResponse(target, res); err != nil {
  5368. return nil, err
  5369. }
  5370. return ret, nil
  5371. // {
  5372. // "description": "Gets a single metric descriptor. This method does not require a Stackdriver account.",
  5373. // "flatPath": "v3/projects/{projectsId}/metricDescriptors/{metricDescriptorsId}",
  5374. // "httpMethod": "GET",
  5375. // "id": "monitoring.projects.metricDescriptors.get",
  5376. // "parameterOrder": [
  5377. // "name"
  5378. // ],
  5379. // "parameters": {
  5380. // "name": {
  5381. // "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\".",
  5382. // "location": "path",
  5383. // "pattern": "^projects/[^/]+/metricDescriptors/.+$",
  5384. // "required": true,
  5385. // "type": "string"
  5386. // }
  5387. // },
  5388. // "path": "v3/{+name}",
  5389. // "response": {
  5390. // "$ref": "MetricDescriptor"
  5391. // },
  5392. // "scopes": [
  5393. // "https://www.googleapis.com/auth/cloud-platform",
  5394. // "https://www.googleapis.com/auth/monitoring",
  5395. // "https://www.googleapis.com/auth/monitoring.read",
  5396. // "https://www.googleapis.com/auth/monitoring.write"
  5397. // ]
  5398. // }
  5399. }
  5400. // method id "monitoring.projects.metricDescriptors.list":
  5401. type ProjectsMetricDescriptorsListCall struct {
  5402. s *Service
  5403. name string
  5404. urlParams_ gensupport.URLParams
  5405. ifNoneMatch_ string
  5406. ctx_ context.Context
  5407. header_ http.Header
  5408. }
  5409. // List: Lists metric descriptors that match a filter. This method does
  5410. // not require a Stackdriver account.
  5411. func (r *ProjectsMetricDescriptorsService) List(name string) *ProjectsMetricDescriptorsListCall {
  5412. c := &ProjectsMetricDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5413. c.name = name
  5414. return c
  5415. }
  5416. // Filter sets the optional parameter "filter": If this field is empty,
  5417. // all custom and system-defined metric descriptors are returned.
  5418. // Otherwise, the filter specifies which metric descriptors are to be
  5419. // returned. For example, the following filter matches all custom
  5420. // metrics:
  5421. // metric.type = starts_with("custom.googleapis.com/")
  5422. func (c *ProjectsMetricDescriptorsListCall) Filter(filter string) *ProjectsMetricDescriptorsListCall {
  5423. c.urlParams_.Set("filter", filter)
  5424. return c
  5425. }
  5426. // PageSize sets the optional parameter "pageSize": A positive number
  5427. // that is the maximum number of results to return.
  5428. func (c *ProjectsMetricDescriptorsListCall) PageSize(pageSize int64) *ProjectsMetricDescriptorsListCall {
  5429. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5430. return c
  5431. }
  5432. // PageToken sets the optional parameter "pageToken": If this field is
  5433. // not empty then it must contain the nextPageToken value returned by a
  5434. // previous call to this method. Using this field causes the method to
  5435. // return additional results from the previous method call.
  5436. func (c *ProjectsMetricDescriptorsListCall) PageToken(pageToken string) *ProjectsMetricDescriptorsListCall {
  5437. c.urlParams_.Set("pageToken", pageToken)
  5438. return c
  5439. }
  5440. // Fields allows partial responses to be retrieved. See
  5441. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5442. // for more information.
  5443. func (c *ProjectsMetricDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsMetricDescriptorsListCall {
  5444. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5445. return c
  5446. }
  5447. // IfNoneMatch sets the optional parameter which makes the operation
  5448. // fail if the object's ETag matches the given value. This is useful for
  5449. // getting updates only after the object has changed since the last
  5450. // request. Use googleapi.IsNotModified to check whether the response
  5451. // error from Do is the result of In-None-Match.
  5452. func (c *ProjectsMetricDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsMetricDescriptorsListCall {
  5453. c.ifNoneMatch_ = entityTag
  5454. return c
  5455. }
  5456. // Context sets the context to be used in this call's Do method. Any
  5457. // pending HTTP request will be aborted if the provided context is
  5458. // canceled.
  5459. func (c *ProjectsMetricDescriptorsListCall) Context(ctx context.Context) *ProjectsMetricDescriptorsListCall {
  5460. c.ctx_ = ctx
  5461. return c
  5462. }
  5463. // Header returns an http.Header that can be modified by the caller to
  5464. // add HTTP headers to the request.
  5465. func (c *ProjectsMetricDescriptorsListCall) Header() http.Header {
  5466. if c.header_ == nil {
  5467. c.header_ = make(http.Header)
  5468. }
  5469. return c.header_
  5470. }
  5471. func (c *ProjectsMetricDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  5472. reqHeaders := make(http.Header)
  5473. for k, v := range c.header_ {
  5474. reqHeaders[k] = v
  5475. }
  5476. reqHeaders.Set("User-Agent", c.s.userAgent())
  5477. if c.ifNoneMatch_ != "" {
  5478. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5479. }
  5480. var body io.Reader = nil
  5481. c.urlParams_.Set("alt", alt)
  5482. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/metricDescriptors")
  5483. urls += "?" + c.urlParams_.Encode()
  5484. req, _ := http.NewRequest("GET", urls, body)
  5485. req.Header = reqHeaders
  5486. googleapi.Expand(req.URL, map[string]string{
  5487. "name": c.name,
  5488. })
  5489. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5490. }
  5491. // Do executes the "monitoring.projects.metricDescriptors.list" call.
  5492. // Exactly one of *ListMetricDescriptorsResponse or error will be
  5493. // non-nil. Any non-2xx status code is an error. Response headers are in
  5494. // either *ListMetricDescriptorsResponse.ServerResponse.Header or (if a
  5495. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5496. // googleapi.IsNotModified to check whether the returned error was
  5497. // because http.StatusNotModified was returned.
  5498. func (c *ProjectsMetricDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMetricDescriptorsResponse, error) {
  5499. gensupport.SetOptions(c.urlParams_, opts...)
  5500. res, err := c.doRequest("json")
  5501. if res != nil && res.StatusCode == http.StatusNotModified {
  5502. if res.Body != nil {
  5503. res.Body.Close()
  5504. }
  5505. return nil, &googleapi.Error{
  5506. Code: res.StatusCode,
  5507. Header: res.Header,
  5508. }
  5509. }
  5510. if err != nil {
  5511. return nil, err
  5512. }
  5513. defer googleapi.CloseBody(res)
  5514. if err := googleapi.CheckResponse(res); err != nil {
  5515. return nil, err
  5516. }
  5517. ret := &ListMetricDescriptorsResponse{
  5518. ServerResponse: googleapi.ServerResponse{
  5519. Header: res.Header,
  5520. HTTPStatusCode: res.StatusCode,
  5521. },
  5522. }
  5523. target := &ret
  5524. if err := gensupport.DecodeResponse(target, res); err != nil {
  5525. return nil, err
  5526. }
  5527. return ret, nil
  5528. // {
  5529. // "description": "Lists metric descriptors that match a filter. This method does not require a Stackdriver account.",
  5530. // "flatPath": "v3/projects/{projectsId}/metricDescriptors",
  5531. // "httpMethod": "GET",
  5532. // "id": "monitoring.projects.metricDescriptors.list",
  5533. // "parameterOrder": [
  5534. // "name"
  5535. // ],
  5536. // "parameters": {
  5537. // "filter": {
  5538. // "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",
  5539. // "location": "query",
  5540. // "type": "string"
  5541. // },
  5542. // "name": {
  5543. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  5544. // "location": "path",
  5545. // "pattern": "^projects/[^/]+$",
  5546. // "required": true,
  5547. // "type": "string"
  5548. // },
  5549. // "pageSize": {
  5550. // "description": "A positive number that is the maximum number of results to return.",
  5551. // "format": "int32",
  5552. // "location": "query",
  5553. // "type": "integer"
  5554. // },
  5555. // "pageToken": {
  5556. // "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.",
  5557. // "location": "query",
  5558. // "type": "string"
  5559. // }
  5560. // },
  5561. // "path": "v3/{+name}/metricDescriptors",
  5562. // "response": {
  5563. // "$ref": "ListMetricDescriptorsResponse"
  5564. // },
  5565. // "scopes": [
  5566. // "https://www.googleapis.com/auth/cloud-platform",
  5567. // "https://www.googleapis.com/auth/monitoring",
  5568. // "https://www.googleapis.com/auth/monitoring.read",
  5569. // "https://www.googleapis.com/auth/monitoring.write"
  5570. // ]
  5571. // }
  5572. }
  5573. // Pages invokes f for each page of results.
  5574. // A non-nil error returned from f will halt the iteration.
  5575. // The provided context supersedes any context provided to the Context method.
  5576. func (c *ProjectsMetricDescriptorsListCall) Pages(ctx context.Context, f func(*ListMetricDescriptorsResponse) error) error {
  5577. c.ctx_ = ctx
  5578. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5579. for {
  5580. x, err := c.Do()
  5581. if err != nil {
  5582. return err
  5583. }
  5584. if err := f(x); err != nil {
  5585. return err
  5586. }
  5587. if x.NextPageToken == "" {
  5588. return nil
  5589. }
  5590. c.PageToken(x.NextPageToken)
  5591. }
  5592. }
  5593. // method id "monitoring.projects.monitoredResourceDescriptors.get":
  5594. type ProjectsMonitoredResourceDescriptorsGetCall struct {
  5595. s *Service
  5596. name string
  5597. urlParams_ gensupport.URLParams
  5598. ifNoneMatch_ string
  5599. ctx_ context.Context
  5600. header_ http.Header
  5601. }
  5602. // Get: Gets a single monitored resource descriptor. This method does
  5603. // not require a Stackdriver account.
  5604. func (r *ProjectsMonitoredResourceDescriptorsService) Get(name string) *ProjectsMonitoredResourceDescriptorsGetCall {
  5605. c := &ProjectsMonitoredResourceDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5606. c.name = name
  5607. return c
  5608. }
  5609. // Fields allows partial responses to be retrieved. See
  5610. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5611. // for more information.
  5612. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsMonitoredResourceDescriptorsGetCall {
  5613. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5614. return c
  5615. }
  5616. // IfNoneMatch sets the optional parameter which makes the operation
  5617. // fail if the object's ETag matches the given value. This is useful for
  5618. // getting updates only after the object has changed since the last
  5619. // request. Use googleapi.IsNotModified to check whether the response
  5620. // error from Do is the result of In-None-Match.
  5621. func (c *ProjectsMonitoredResourceDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsMonitoredResourceDescriptorsGetCall {
  5622. c.ifNoneMatch_ = entityTag
  5623. return c
  5624. }
  5625. // Context sets the context to be used in this call's Do method. Any
  5626. // pending HTTP request will be aborted if the provided context is
  5627. // canceled.
  5628. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Context(ctx context.Context) *ProjectsMonitoredResourceDescriptorsGetCall {
  5629. c.ctx_ = ctx
  5630. return c
  5631. }
  5632. // Header returns an http.Header that can be modified by the caller to
  5633. // add HTTP headers to the request.
  5634. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Header() http.Header {
  5635. if c.header_ == nil {
  5636. c.header_ = make(http.Header)
  5637. }
  5638. return c.header_
  5639. }
  5640. func (c *ProjectsMonitoredResourceDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  5641. reqHeaders := make(http.Header)
  5642. for k, v := range c.header_ {
  5643. reqHeaders[k] = v
  5644. }
  5645. reqHeaders.Set("User-Agent", c.s.userAgent())
  5646. if c.ifNoneMatch_ != "" {
  5647. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5648. }
  5649. var body io.Reader = nil
  5650. c.urlParams_.Set("alt", alt)
  5651. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5652. urls += "?" + c.urlParams_.Encode()
  5653. req, _ := http.NewRequest("GET", urls, body)
  5654. req.Header = reqHeaders
  5655. googleapi.Expand(req.URL, map[string]string{
  5656. "name": c.name,
  5657. })
  5658. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5659. }
  5660. // Do executes the "monitoring.projects.monitoredResourceDescriptors.get" call.
  5661. // Exactly one of *MonitoredResourceDescriptor or error will be non-nil.
  5662. // Any non-2xx status code is an error. Response headers are in either
  5663. // *MonitoredResourceDescriptor.ServerResponse.Header or (if a response
  5664. // was returned at all) in error.(*googleapi.Error).Header. Use
  5665. // googleapi.IsNotModified to check whether the returned error was
  5666. // because http.StatusNotModified was returned.
  5667. func (c *ProjectsMonitoredResourceDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*MonitoredResourceDescriptor, error) {
  5668. gensupport.SetOptions(c.urlParams_, opts...)
  5669. res, err := c.doRequest("json")
  5670. if res != nil && res.StatusCode == http.StatusNotModified {
  5671. if res.Body != nil {
  5672. res.Body.Close()
  5673. }
  5674. return nil, &googleapi.Error{
  5675. Code: res.StatusCode,
  5676. Header: res.Header,
  5677. }
  5678. }
  5679. if err != nil {
  5680. return nil, err
  5681. }
  5682. defer googleapi.CloseBody(res)
  5683. if err := googleapi.CheckResponse(res); err != nil {
  5684. return nil, err
  5685. }
  5686. ret := &MonitoredResourceDescriptor{
  5687. ServerResponse: googleapi.ServerResponse{
  5688. Header: res.Header,
  5689. HTTPStatusCode: res.StatusCode,
  5690. },
  5691. }
  5692. target := &ret
  5693. if err := gensupport.DecodeResponse(target, res); err != nil {
  5694. return nil, err
  5695. }
  5696. return ret, nil
  5697. // {
  5698. // "description": "Gets a single monitored resource descriptor. This method does not require a Stackdriver account.",
  5699. // "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors/{monitoredResourceDescriptorsId}",
  5700. // "httpMethod": "GET",
  5701. // "id": "monitoring.projects.monitoredResourceDescriptors.get",
  5702. // "parameterOrder": [
  5703. // "name"
  5704. // ],
  5705. // "parameters": {
  5706. // "name": {
  5707. // "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.",
  5708. // "location": "path",
  5709. // "pattern": "^projects/[^/]+/monitoredResourceDescriptors/[^/]+$",
  5710. // "required": true,
  5711. // "type": "string"
  5712. // }
  5713. // },
  5714. // "path": "v3/{+name}",
  5715. // "response": {
  5716. // "$ref": "MonitoredResourceDescriptor"
  5717. // },
  5718. // "scopes": [
  5719. // "https://www.googleapis.com/auth/cloud-platform",
  5720. // "https://www.googleapis.com/auth/monitoring",
  5721. // "https://www.googleapis.com/auth/monitoring.read",
  5722. // "https://www.googleapis.com/auth/monitoring.write"
  5723. // ]
  5724. // }
  5725. }
  5726. // method id "monitoring.projects.monitoredResourceDescriptors.list":
  5727. type ProjectsMonitoredResourceDescriptorsListCall struct {
  5728. s *Service
  5729. name string
  5730. urlParams_ gensupport.URLParams
  5731. ifNoneMatch_ string
  5732. ctx_ context.Context
  5733. header_ http.Header
  5734. }
  5735. // List: Lists monitored resource descriptors that match a filter. This
  5736. // method does not require a Stackdriver account.
  5737. func (r *ProjectsMonitoredResourceDescriptorsService) List(name string) *ProjectsMonitoredResourceDescriptorsListCall {
  5738. c := &ProjectsMonitoredResourceDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5739. c.name = name
  5740. return c
  5741. }
  5742. // Filter sets the optional parameter "filter": An optional filter
  5743. // describing the descriptors to be returned. The filter can reference
  5744. // the descriptor's type and labels. For example, the following filter
  5745. // returns only Google Compute Engine descriptors that have an id
  5746. // label:
  5747. // resource.type = starts_with("gce_") AND resource.label:id
  5748. func (c *ProjectsMonitoredResourceDescriptorsListCall) Filter(filter string) *ProjectsMonitoredResourceDescriptorsListCall {
  5749. c.urlParams_.Set("filter", filter)
  5750. return c
  5751. }
  5752. // PageSize sets the optional parameter "pageSize": A positive number
  5753. // that is the maximum number of results to return.
  5754. func (c *ProjectsMonitoredResourceDescriptorsListCall) PageSize(pageSize int64) *ProjectsMonitoredResourceDescriptorsListCall {
  5755. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5756. return c
  5757. }
  5758. // PageToken sets the optional parameter "pageToken": If this field is
  5759. // not empty then it must contain the nextPageToken value returned by a
  5760. // previous call to this method. Using this field causes the method to
  5761. // return additional results from the previous method call.
  5762. func (c *ProjectsMonitoredResourceDescriptorsListCall) PageToken(pageToken string) *ProjectsMonitoredResourceDescriptorsListCall {
  5763. c.urlParams_.Set("pageToken", pageToken)
  5764. return c
  5765. }
  5766. // Fields allows partial responses to be retrieved. See
  5767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5768. // for more information.
  5769. func (c *ProjectsMonitoredResourceDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsMonitoredResourceDescriptorsListCall {
  5770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5771. return c
  5772. }
  5773. // IfNoneMatch sets the optional parameter which makes the operation
  5774. // fail if the object's ETag matches the given value. This is useful for
  5775. // getting updates only after the object has changed since the last
  5776. // request. Use googleapi.IsNotModified to check whether the response
  5777. // error from Do is the result of In-None-Match.
  5778. func (c *ProjectsMonitoredResourceDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsMonitoredResourceDescriptorsListCall {
  5779. c.ifNoneMatch_ = entityTag
  5780. return c
  5781. }
  5782. // Context sets the context to be used in this call's Do method. Any
  5783. // pending HTTP request will be aborted if the provided context is
  5784. // canceled.
  5785. func (c *ProjectsMonitoredResourceDescriptorsListCall) Context(ctx context.Context) *ProjectsMonitoredResourceDescriptorsListCall {
  5786. c.ctx_ = ctx
  5787. return c
  5788. }
  5789. // Header returns an http.Header that can be modified by the caller to
  5790. // add HTTP headers to the request.
  5791. func (c *ProjectsMonitoredResourceDescriptorsListCall) Header() http.Header {
  5792. if c.header_ == nil {
  5793. c.header_ = make(http.Header)
  5794. }
  5795. return c.header_
  5796. }
  5797. func (c *ProjectsMonitoredResourceDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  5798. reqHeaders := make(http.Header)
  5799. for k, v := range c.header_ {
  5800. reqHeaders[k] = v
  5801. }
  5802. reqHeaders.Set("User-Agent", c.s.userAgent())
  5803. if c.ifNoneMatch_ != "" {
  5804. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5805. }
  5806. var body io.Reader = nil
  5807. c.urlParams_.Set("alt", alt)
  5808. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/monitoredResourceDescriptors")
  5809. urls += "?" + c.urlParams_.Encode()
  5810. req, _ := http.NewRequest("GET", urls, body)
  5811. req.Header = reqHeaders
  5812. googleapi.Expand(req.URL, map[string]string{
  5813. "name": c.name,
  5814. })
  5815. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5816. }
  5817. // Do executes the "monitoring.projects.monitoredResourceDescriptors.list" call.
  5818. // Exactly one of *ListMonitoredResourceDescriptorsResponse or error
  5819. // will be non-nil. Any non-2xx status code is an error. Response
  5820. // headers are in either
  5821. // *ListMonitoredResourceDescriptorsResponse.ServerResponse.Header or
  5822. // (if a response was returned at all) in
  5823. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5824. // whether the returned error was because http.StatusNotModified was
  5825. // returned.
  5826. func (c *ProjectsMonitoredResourceDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListMonitoredResourceDescriptorsResponse, error) {
  5827. gensupport.SetOptions(c.urlParams_, opts...)
  5828. res, err := c.doRequest("json")
  5829. if res != nil && res.StatusCode == http.StatusNotModified {
  5830. if res.Body != nil {
  5831. res.Body.Close()
  5832. }
  5833. return nil, &googleapi.Error{
  5834. Code: res.StatusCode,
  5835. Header: res.Header,
  5836. }
  5837. }
  5838. if err != nil {
  5839. return nil, err
  5840. }
  5841. defer googleapi.CloseBody(res)
  5842. if err := googleapi.CheckResponse(res); err != nil {
  5843. return nil, err
  5844. }
  5845. ret := &ListMonitoredResourceDescriptorsResponse{
  5846. ServerResponse: googleapi.ServerResponse{
  5847. Header: res.Header,
  5848. HTTPStatusCode: res.StatusCode,
  5849. },
  5850. }
  5851. target := &ret
  5852. if err := gensupport.DecodeResponse(target, res); err != nil {
  5853. return nil, err
  5854. }
  5855. return ret, nil
  5856. // {
  5857. // "description": "Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.",
  5858. // "flatPath": "v3/projects/{projectsId}/monitoredResourceDescriptors",
  5859. // "httpMethod": "GET",
  5860. // "id": "monitoring.projects.monitoredResourceDescriptors.list",
  5861. // "parameterOrder": [
  5862. // "name"
  5863. // ],
  5864. // "parameters": {
  5865. // "filter": {
  5866. // "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",
  5867. // "location": "query",
  5868. // "type": "string"
  5869. // },
  5870. // "name": {
  5871. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  5872. // "location": "path",
  5873. // "pattern": "^projects/[^/]+$",
  5874. // "required": true,
  5875. // "type": "string"
  5876. // },
  5877. // "pageSize": {
  5878. // "description": "A positive number that is the maximum number of results to return.",
  5879. // "format": "int32",
  5880. // "location": "query",
  5881. // "type": "integer"
  5882. // },
  5883. // "pageToken": {
  5884. // "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.",
  5885. // "location": "query",
  5886. // "type": "string"
  5887. // }
  5888. // },
  5889. // "path": "v3/{+name}/monitoredResourceDescriptors",
  5890. // "response": {
  5891. // "$ref": "ListMonitoredResourceDescriptorsResponse"
  5892. // },
  5893. // "scopes": [
  5894. // "https://www.googleapis.com/auth/cloud-platform",
  5895. // "https://www.googleapis.com/auth/monitoring",
  5896. // "https://www.googleapis.com/auth/monitoring.read",
  5897. // "https://www.googleapis.com/auth/monitoring.write"
  5898. // ]
  5899. // }
  5900. }
  5901. // Pages invokes f for each page of results.
  5902. // A non-nil error returned from f will halt the iteration.
  5903. // The provided context supersedes any context provided to the Context method.
  5904. func (c *ProjectsMonitoredResourceDescriptorsListCall) Pages(ctx context.Context, f func(*ListMonitoredResourceDescriptorsResponse) error) error {
  5905. c.ctx_ = ctx
  5906. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5907. for {
  5908. x, err := c.Do()
  5909. if err != nil {
  5910. return err
  5911. }
  5912. if err := f(x); err != nil {
  5913. return err
  5914. }
  5915. if x.NextPageToken == "" {
  5916. return nil
  5917. }
  5918. c.PageToken(x.NextPageToken)
  5919. }
  5920. }
  5921. // method id "monitoring.projects.notificationChannelDescriptors.get":
  5922. type ProjectsNotificationChannelDescriptorsGetCall struct {
  5923. s *Service
  5924. name string
  5925. urlParams_ gensupport.URLParams
  5926. ifNoneMatch_ string
  5927. ctx_ context.Context
  5928. header_ http.Header
  5929. }
  5930. // Get: Gets a single channel descriptor. The descriptor indicates which
  5931. // fields are expected / permitted for a notification channel of the
  5932. // given type.
  5933. func (r *ProjectsNotificationChannelDescriptorsService) Get(name string) *ProjectsNotificationChannelDescriptorsGetCall {
  5934. c := &ProjectsNotificationChannelDescriptorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5935. c.name = name
  5936. return c
  5937. }
  5938. // Fields allows partial responses to be retrieved. See
  5939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5940. // for more information.
  5941. func (c *ProjectsNotificationChannelDescriptorsGetCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelDescriptorsGetCall {
  5942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5943. return c
  5944. }
  5945. // IfNoneMatch sets the optional parameter which makes the operation
  5946. // fail if the object's ETag matches the given value. This is useful for
  5947. // getting updates only after the object has changed since the last
  5948. // request. Use googleapi.IsNotModified to check whether the response
  5949. // error from Do is the result of In-None-Match.
  5950. func (c *ProjectsNotificationChannelDescriptorsGetCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelDescriptorsGetCall {
  5951. c.ifNoneMatch_ = entityTag
  5952. return c
  5953. }
  5954. // Context sets the context to be used in this call's Do method. Any
  5955. // pending HTTP request will be aborted if the provided context is
  5956. // canceled.
  5957. func (c *ProjectsNotificationChannelDescriptorsGetCall) Context(ctx context.Context) *ProjectsNotificationChannelDescriptorsGetCall {
  5958. c.ctx_ = ctx
  5959. return c
  5960. }
  5961. // Header returns an http.Header that can be modified by the caller to
  5962. // add HTTP headers to the request.
  5963. func (c *ProjectsNotificationChannelDescriptorsGetCall) Header() http.Header {
  5964. if c.header_ == nil {
  5965. c.header_ = make(http.Header)
  5966. }
  5967. return c.header_
  5968. }
  5969. func (c *ProjectsNotificationChannelDescriptorsGetCall) doRequest(alt string) (*http.Response, error) {
  5970. reqHeaders := make(http.Header)
  5971. for k, v := range c.header_ {
  5972. reqHeaders[k] = v
  5973. }
  5974. reqHeaders.Set("User-Agent", c.s.userAgent())
  5975. if c.ifNoneMatch_ != "" {
  5976. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5977. }
  5978. var body io.Reader = nil
  5979. c.urlParams_.Set("alt", alt)
  5980. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  5981. urls += "?" + c.urlParams_.Encode()
  5982. req, _ := http.NewRequest("GET", urls, body)
  5983. req.Header = reqHeaders
  5984. googleapi.Expand(req.URL, map[string]string{
  5985. "name": c.name,
  5986. })
  5987. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5988. }
  5989. // Do executes the "monitoring.projects.notificationChannelDescriptors.get" call.
  5990. // Exactly one of *NotificationChannelDescriptor or error will be
  5991. // non-nil. Any non-2xx status code is an error. Response headers are in
  5992. // either *NotificationChannelDescriptor.ServerResponse.Header or (if a
  5993. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5994. // googleapi.IsNotModified to check whether the returned error was
  5995. // because http.StatusNotModified was returned.
  5996. func (c *ProjectsNotificationChannelDescriptorsGetCall) Do(opts ...googleapi.CallOption) (*NotificationChannelDescriptor, error) {
  5997. gensupport.SetOptions(c.urlParams_, opts...)
  5998. res, err := c.doRequest("json")
  5999. if res != nil && res.StatusCode == http.StatusNotModified {
  6000. if res.Body != nil {
  6001. res.Body.Close()
  6002. }
  6003. return nil, &googleapi.Error{
  6004. Code: res.StatusCode,
  6005. Header: res.Header,
  6006. }
  6007. }
  6008. if err != nil {
  6009. return nil, err
  6010. }
  6011. defer googleapi.CloseBody(res)
  6012. if err := googleapi.CheckResponse(res); err != nil {
  6013. return nil, err
  6014. }
  6015. ret := &NotificationChannelDescriptor{
  6016. ServerResponse: googleapi.ServerResponse{
  6017. Header: res.Header,
  6018. HTTPStatusCode: res.StatusCode,
  6019. },
  6020. }
  6021. target := &ret
  6022. if err := gensupport.DecodeResponse(target, res); err != nil {
  6023. return nil, err
  6024. }
  6025. return ret, nil
  6026. // {
  6027. // "description": "Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.",
  6028. // "flatPath": "v3/projects/{projectsId}/notificationChannelDescriptors/{notificationChannelDescriptorsId}",
  6029. // "httpMethod": "GET",
  6030. // "id": "monitoring.projects.notificationChannelDescriptors.get",
  6031. // "parameterOrder": [
  6032. // "name"
  6033. // ],
  6034. // "parameters": {
  6035. // "name": {
  6036. // "description": "The channel type for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}.",
  6037. // "location": "path",
  6038. // "pattern": "^projects/[^/]+/notificationChannelDescriptors/[^/]+$",
  6039. // "required": true,
  6040. // "type": "string"
  6041. // }
  6042. // },
  6043. // "path": "v3/{+name}",
  6044. // "response": {
  6045. // "$ref": "NotificationChannelDescriptor"
  6046. // },
  6047. // "scopes": [
  6048. // "https://www.googleapis.com/auth/cloud-platform",
  6049. // "https://www.googleapis.com/auth/monitoring",
  6050. // "https://www.googleapis.com/auth/monitoring.read"
  6051. // ]
  6052. // }
  6053. }
  6054. // method id "monitoring.projects.notificationChannelDescriptors.list":
  6055. type ProjectsNotificationChannelDescriptorsListCall struct {
  6056. s *Service
  6057. name string
  6058. urlParams_ gensupport.URLParams
  6059. ifNoneMatch_ string
  6060. ctx_ context.Context
  6061. header_ http.Header
  6062. }
  6063. // List: Lists the descriptors for supported channel types. The use of
  6064. // descriptors makes it possible for new channel types to be dynamically
  6065. // added.
  6066. func (r *ProjectsNotificationChannelDescriptorsService) List(name string) *ProjectsNotificationChannelDescriptorsListCall {
  6067. c := &ProjectsNotificationChannelDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6068. c.name = name
  6069. return c
  6070. }
  6071. // PageSize sets the optional parameter "pageSize": The maximum number
  6072. // of results to return in a single response. If not set to a positive
  6073. // number, a reasonable value will be chosen by the service.
  6074. func (c *ProjectsNotificationChannelDescriptorsListCall) PageSize(pageSize int64) *ProjectsNotificationChannelDescriptorsListCall {
  6075. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6076. return c
  6077. }
  6078. // PageToken sets the optional parameter "pageToken": If non-empty,
  6079. // page_token must contain a value returned as the next_page_token in a
  6080. // previous response to request the next set of results.
  6081. func (c *ProjectsNotificationChannelDescriptorsListCall) PageToken(pageToken string) *ProjectsNotificationChannelDescriptorsListCall {
  6082. c.urlParams_.Set("pageToken", pageToken)
  6083. return c
  6084. }
  6085. // Fields allows partial responses to be retrieved. See
  6086. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6087. // for more information.
  6088. func (c *ProjectsNotificationChannelDescriptorsListCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelDescriptorsListCall {
  6089. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6090. return c
  6091. }
  6092. // IfNoneMatch sets the optional parameter which makes the operation
  6093. // fail if the object's ETag matches the given value. This is useful for
  6094. // getting updates only after the object has changed since the last
  6095. // request. Use googleapi.IsNotModified to check whether the response
  6096. // error from Do is the result of In-None-Match.
  6097. func (c *ProjectsNotificationChannelDescriptorsListCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelDescriptorsListCall {
  6098. c.ifNoneMatch_ = entityTag
  6099. return c
  6100. }
  6101. // Context sets the context to be used in this call's Do method. Any
  6102. // pending HTTP request will be aborted if the provided context is
  6103. // canceled.
  6104. func (c *ProjectsNotificationChannelDescriptorsListCall) Context(ctx context.Context) *ProjectsNotificationChannelDescriptorsListCall {
  6105. c.ctx_ = ctx
  6106. return c
  6107. }
  6108. // Header returns an http.Header that can be modified by the caller to
  6109. // add HTTP headers to the request.
  6110. func (c *ProjectsNotificationChannelDescriptorsListCall) Header() http.Header {
  6111. if c.header_ == nil {
  6112. c.header_ = make(http.Header)
  6113. }
  6114. return c.header_
  6115. }
  6116. func (c *ProjectsNotificationChannelDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  6117. reqHeaders := make(http.Header)
  6118. for k, v := range c.header_ {
  6119. reqHeaders[k] = v
  6120. }
  6121. reqHeaders.Set("User-Agent", c.s.userAgent())
  6122. if c.ifNoneMatch_ != "" {
  6123. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6124. }
  6125. var body io.Reader = nil
  6126. c.urlParams_.Set("alt", alt)
  6127. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannelDescriptors")
  6128. urls += "?" + c.urlParams_.Encode()
  6129. req, _ := http.NewRequest("GET", urls, body)
  6130. req.Header = reqHeaders
  6131. googleapi.Expand(req.URL, map[string]string{
  6132. "name": c.name,
  6133. })
  6134. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6135. }
  6136. // Do executes the "monitoring.projects.notificationChannelDescriptors.list" call.
  6137. // Exactly one of *ListNotificationChannelDescriptorsResponse or error
  6138. // will be non-nil. Any non-2xx status code is an error. Response
  6139. // headers are in either
  6140. // *ListNotificationChannelDescriptorsResponse.ServerResponse.Header or
  6141. // (if a response was returned at all) in
  6142. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6143. // whether the returned error was because http.StatusNotModified was
  6144. // returned.
  6145. func (c *ProjectsNotificationChannelDescriptorsListCall) Do(opts ...googleapi.CallOption) (*ListNotificationChannelDescriptorsResponse, error) {
  6146. gensupport.SetOptions(c.urlParams_, opts...)
  6147. res, err := c.doRequest("json")
  6148. if res != nil && res.StatusCode == http.StatusNotModified {
  6149. if res.Body != nil {
  6150. res.Body.Close()
  6151. }
  6152. return nil, &googleapi.Error{
  6153. Code: res.StatusCode,
  6154. Header: res.Header,
  6155. }
  6156. }
  6157. if err != nil {
  6158. return nil, err
  6159. }
  6160. defer googleapi.CloseBody(res)
  6161. if err := googleapi.CheckResponse(res); err != nil {
  6162. return nil, err
  6163. }
  6164. ret := &ListNotificationChannelDescriptorsResponse{
  6165. ServerResponse: googleapi.ServerResponse{
  6166. Header: res.Header,
  6167. HTTPStatusCode: res.StatusCode,
  6168. },
  6169. }
  6170. target := &ret
  6171. if err := gensupport.DecodeResponse(target, res); err != nil {
  6172. return nil, err
  6173. }
  6174. return ret, nil
  6175. // {
  6176. // "description": "Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.",
  6177. // "flatPath": "v3/projects/{projectsId}/notificationChannelDescriptors",
  6178. // "httpMethod": "GET",
  6179. // "id": "monitoring.projects.notificationChannelDescriptors.list",
  6180. // "parameterOrder": [
  6181. // "name"
  6182. // ],
  6183. // "parameters": {
  6184. // "name": {
  6185. // "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.",
  6186. // "location": "path",
  6187. // "pattern": "^projects/[^/]+$",
  6188. // "required": true,
  6189. // "type": "string"
  6190. // },
  6191. // "pageSize": {
  6192. // "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.",
  6193. // "format": "int32",
  6194. // "location": "query",
  6195. // "type": "integer"
  6196. // },
  6197. // "pageToken": {
  6198. // "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.",
  6199. // "location": "query",
  6200. // "type": "string"
  6201. // }
  6202. // },
  6203. // "path": "v3/{+name}/notificationChannelDescriptors",
  6204. // "response": {
  6205. // "$ref": "ListNotificationChannelDescriptorsResponse"
  6206. // },
  6207. // "scopes": [
  6208. // "https://www.googleapis.com/auth/cloud-platform",
  6209. // "https://www.googleapis.com/auth/monitoring",
  6210. // "https://www.googleapis.com/auth/monitoring.read"
  6211. // ]
  6212. // }
  6213. }
  6214. // Pages invokes f for each page of results.
  6215. // A non-nil error returned from f will halt the iteration.
  6216. // The provided context supersedes any context provided to the Context method.
  6217. func (c *ProjectsNotificationChannelDescriptorsListCall) Pages(ctx context.Context, f func(*ListNotificationChannelDescriptorsResponse) error) error {
  6218. c.ctx_ = ctx
  6219. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6220. for {
  6221. x, err := c.Do()
  6222. if err != nil {
  6223. return err
  6224. }
  6225. if err := f(x); err != nil {
  6226. return err
  6227. }
  6228. if x.NextPageToken == "" {
  6229. return nil
  6230. }
  6231. c.PageToken(x.NextPageToken)
  6232. }
  6233. }
  6234. // method id "monitoring.projects.notificationChannels.create":
  6235. type ProjectsNotificationChannelsCreateCall struct {
  6236. s *Service
  6237. name string
  6238. notificationchannel *NotificationChannel
  6239. urlParams_ gensupport.URLParams
  6240. ctx_ context.Context
  6241. header_ http.Header
  6242. }
  6243. // Create: Creates a new notification channel, representing a single
  6244. // notification endpoint such as an email address, SMS number, or
  6245. // pagerduty service.
  6246. func (r *ProjectsNotificationChannelsService) Create(name string, notificationchannel *NotificationChannel) *ProjectsNotificationChannelsCreateCall {
  6247. c := &ProjectsNotificationChannelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6248. c.name = name
  6249. c.notificationchannel = notificationchannel
  6250. return c
  6251. }
  6252. // Fields allows partial responses to be retrieved. See
  6253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6254. // for more information.
  6255. func (c *ProjectsNotificationChannelsCreateCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsCreateCall {
  6256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6257. return c
  6258. }
  6259. // Context sets the context to be used in this call's Do method. Any
  6260. // pending HTTP request will be aborted if the provided context is
  6261. // canceled.
  6262. func (c *ProjectsNotificationChannelsCreateCall) Context(ctx context.Context) *ProjectsNotificationChannelsCreateCall {
  6263. c.ctx_ = ctx
  6264. return c
  6265. }
  6266. // Header returns an http.Header that can be modified by the caller to
  6267. // add HTTP headers to the request.
  6268. func (c *ProjectsNotificationChannelsCreateCall) Header() http.Header {
  6269. if c.header_ == nil {
  6270. c.header_ = make(http.Header)
  6271. }
  6272. return c.header_
  6273. }
  6274. func (c *ProjectsNotificationChannelsCreateCall) doRequest(alt string) (*http.Response, error) {
  6275. reqHeaders := make(http.Header)
  6276. for k, v := range c.header_ {
  6277. reqHeaders[k] = v
  6278. }
  6279. reqHeaders.Set("User-Agent", c.s.userAgent())
  6280. var body io.Reader = nil
  6281. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notificationchannel)
  6282. if err != nil {
  6283. return nil, err
  6284. }
  6285. reqHeaders.Set("Content-Type", "application/json")
  6286. c.urlParams_.Set("alt", alt)
  6287. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannels")
  6288. urls += "?" + c.urlParams_.Encode()
  6289. req, _ := http.NewRequest("POST", urls, body)
  6290. req.Header = reqHeaders
  6291. googleapi.Expand(req.URL, map[string]string{
  6292. "name": c.name,
  6293. })
  6294. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6295. }
  6296. // Do executes the "monitoring.projects.notificationChannels.create" call.
  6297. // Exactly one of *NotificationChannel or error will be non-nil. Any
  6298. // non-2xx status code is an error. Response headers are in either
  6299. // *NotificationChannel.ServerResponse.Header or (if a response was
  6300. // returned at all) in error.(*googleapi.Error).Header. Use
  6301. // googleapi.IsNotModified to check whether the returned error was
  6302. // because http.StatusNotModified was returned.
  6303. func (c *ProjectsNotificationChannelsCreateCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  6304. gensupport.SetOptions(c.urlParams_, opts...)
  6305. res, err := c.doRequest("json")
  6306. if res != nil && res.StatusCode == http.StatusNotModified {
  6307. if res.Body != nil {
  6308. res.Body.Close()
  6309. }
  6310. return nil, &googleapi.Error{
  6311. Code: res.StatusCode,
  6312. Header: res.Header,
  6313. }
  6314. }
  6315. if err != nil {
  6316. return nil, err
  6317. }
  6318. defer googleapi.CloseBody(res)
  6319. if err := googleapi.CheckResponse(res); err != nil {
  6320. return nil, err
  6321. }
  6322. ret := &NotificationChannel{
  6323. ServerResponse: googleapi.ServerResponse{
  6324. Header: res.Header,
  6325. HTTPStatusCode: res.StatusCode,
  6326. },
  6327. }
  6328. target := &ret
  6329. if err := gensupport.DecodeResponse(target, res); err != nil {
  6330. return nil, err
  6331. }
  6332. return ret, nil
  6333. // {
  6334. // "description": "Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or pagerduty service.",
  6335. // "flatPath": "v3/projects/{projectsId}/notificationChannels",
  6336. // "httpMethod": "POST",
  6337. // "id": "monitoring.projects.notificationChannels.create",
  6338. // "parameterOrder": [
  6339. // "name"
  6340. // ],
  6341. // "parameters": {
  6342. // "name": {
  6343. // "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.",
  6344. // "location": "path",
  6345. // "pattern": "^projects/[^/]+$",
  6346. // "required": true,
  6347. // "type": "string"
  6348. // }
  6349. // },
  6350. // "path": "v3/{+name}/notificationChannels",
  6351. // "request": {
  6352. // "$ref": "NotificationChannel"
  6353. // },
  6354. // "response": {
  6355. // "$ref": "NotificationChannel"
  6356. // },
  6357. // "scopes": [
  6358. // "https://www.googleapis.com/auth/cloud-platform",
  6359. // "https://www.googleapis.com/auth/monitoring"
  6360. // ]
  6361. // }
  6362. }
  6363. // method id "monitoring.projects.notificationChannels.delete":
  6364. type ProjectsNotificationChannelsDeleteCall struct {
  6365. s *Service
  6366. name string
  6367. urlParams_ gensupport.URLParams
  6368. ctx_ context.Context
  6369. header_ http.Header
  6370. }
  6371. // Delete: Deletes a notification channel.
  6372. func (r *ProjectsNotificationChannelsService) Delete(name string) *ProjectsNotificationChannelsDeleteCall {
  6373. c := &ProjectsNotificationChannelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6374. c.name = name
  6375. return c
  6376. }
  6377. // Force sets the optional parameter "force": If true, the notification
  6378. // channel will be deleted regardless of its use in alert policies (the
  6379. // policies will be updated to remove the channel). If false, channels
  6380. // that are still referenced by an existing alerting policy will fail to
  6381. // be deleted in a delete operation.
  6382. func (c *ProjectsNotificationChannelsDeleteCall) Force(force bool) *ProjectsNotificationChannelsDeleteCall {
  6383. c.urlParams_.Set("force", fmt.Sprint(force))
  6384. return c
  6385. }
  6386. // Fields allows partial responses to be retrieved. See
  6387. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6388. // for more information.
  6389. func (c *ProjectsNotificationChannelsDeleteCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsDeleteCall {
  6390. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6391. return c
  6392. }
  6393. // Context sets the context to be used in this call's Do method. Any
  6394. // pending HTTP request will be aborted if the provided context is
  6395. // canceled.
  6396. func (c *ProjectsNotificationChannelsDeleteCall) Context(ctx context.Context) *ProjectsNotificationChannelsDeleteCall {
  6397. c.ctx_ = ctx
  6398. return c
  6399. }
  6400. // Header returns an http.Header that can be modified by the caller to
  6401. // add HTTP headers to the request.
  6402. func (c *ProjectsNotificationChannelsDeleteCall) Header() http.Header {
  6403. if c.header_ == nil {
  6404. c.header_ = make(http.Header)
  6405. }
  6406. return c.header_
  6407. }
  6408. func (c *ProjectsNotificationChannelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  6409. reqHeaders := make(http.Header)
  6410. for k, v := range c.header_ {
  6411. reqHeaders[k] = v
  6412. }
  6413. reqHeaders.Set("User-Agent", c.s.userAgent())
  6414. var body io.Reader = nil
  6415. c.urlParams_.Set("alt", alt)
  6416. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6417. urls += "?" + c.urlParams_.Encode()
  6418. req, _ := http.NewRequest("DELETE", urls, body)
  6419. req.Header = reqHeaders
  6420. googleapi.Expand(req.URL, map[string]string{
  6421. "name": c.name,
  6422. })
  6423. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6424. }
  6425. // Do executes the "monitoring.projects.notificationChannels.delete" call.
  6426. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6427. // code is an error. Response headers are in either
  6428. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6429. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6430. // check whether the returned error was because http.StatusNotModified
  6431. // was returned.
  6432. func (c *ProjectsNotificationChannelsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6433. gensupport.SetOptions(c.urlParams_, opts...)
  6434. res, err := c.doRequest("json")
  6435. if res != nil && res.StatusCode == http.StatusNotModified {
  6436. if res.Body != nil {
  6437. res.Body.Close()
  6438. }
  6439. return nil, &googleapi.Error{
  6440. Code: res.StatusCode,
  6441. Header: res.Header,
  6442. }
  6443. }
  6444. if err != nil {
  6445. return nil, err
  6446. }
  6447. defer googleapi.CloseBody(res)
  6448. if err := googleapi.CheckResponse(res); err != nil {
  6449. return nil, err
  6450. }
  6451. ret := &Empty{
  6452. ServerResponse: googleapi.ServerResponse{
  6453. Header: res.Header,
  6454. HTTPStatusCode: res.StatusCode,
  6455. },
  6456. }
  6457. target := &ret
  6458. if err := gensupport.DecodeResponse(target, res); err != nil {
  6459. return nil, err
  6460. }
  6461. return ret, nil
  6462. // {
  6463. // "description": "Deletes a notification channel.",
  6464. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  6465. // "httpMethod": "DELETE",
  6466. // "id": "monitoring.projects.notificationChannels.delete",
  6467. // "parameterOrder": [
  6468. // "name"
  6469. // ],
  6470. // "parameters": {
  6471. // "force": {
  6472. // "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.",
  6473. // "location": "query",
  6474. // "type": "boolean"
  6475. // },
  6476. // "name": {
  6477. // "description": "The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID].",
  6478. // "location": "path",
  6479. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  6480. // "required": true,
  6481. // "type": "string"
  6482. // }
  6483. // },
  6484. // "path": "v3/{+name}",
  6485. // "response": {
  6486. // "$ref": "Empty"
  6487. // },
  6488. // "scopes": [
  6489. // "https://www.googleapis.com/auth/cloud-platform",
  6490. // "https://www.googleapis.com/auth/monitoring"
  6491. // ]
  6492. // }
  6493. }
  6494. // method id "monitoring.projects.notificationChannels.get":
  6495. type ProjectsNotificationChannelsGetCall struct {
  6496. s *Service
  6497. name string
  6498. urlParams_ gensupport.URLParams
  6499. ifNoneMatch_ string
  6500. ctx_ context.Context
  6501. header_ http.Header
  6502. }
  6503. // Get: Gets a single notification channel. The channel includes the
  6504. // relevant configuration details with which the channel was created.
  6505. // However, the response may truncate or omit passwords, API keys, or
  6506. // other private key matter and thus the response may not be 100%
  6507. // identical to the information that was supplied in the call to the
  6508. // create method.
  6509. func (r *ProjectsNotificationChannelsService) Get(name string) *ProjectsNotificationChannelsGetCall {
  6510. c := &ProjectsNotificationChannelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6511. c.name = name
  6512. return c
  6513. }
  6514. // Fields allows partial responses to be retrieved. See
  6515. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6516. // for more information.
  6517. func (c *ProjectsNotificationChannelsGetCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsGetCall {
  6518. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6519. return c
  6520. }
  6521. // IfNoneMatch sets the optional parameter which makes the operation
  6522. // fail if the object's ETag matches the given value. This is useful for
  6523. // getting updates only after the object has changed since the last
  6524. // request. Use googleapi.IsNotModified to check whether the response
  6525. // error from Do is the result of In-None-Match.
  6526. func (c *ProjectsNotificationChannelsGetCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelsGetCall {
  6527. c.ifNoneMatch_ = entityTag
  6528. return c
  6529. }
  6530. // Context sets the context to be used in this call's Do method. Any
  6531. // pending HTTP request will be aborted if the provided context is
  6532. // canceled.
  6533. func (c *ProjectsNotificationChannelsGetCall) Context(ctx context.Context) *ProjectsNotificationChannelsGetCall {
  6534. c.ctx_ = ctx
  6535. return c
  6536. }
  6537. // Header returns an http.Header that can be modified by the caller to
  6538. // add HTTP headers to the request.
  6539. func (c *ProjectsNotificationChannelsGetCall) Header() http.Header {
  6540. if c.header_ == nil {
  6541. c.header_ = make(http.Header)
  6542. }
  6543. return c.header_
  6544. }
  6545. func (c *ProjectsNotificationChannelsGetCall) doRequest(alt string) (*http.Response, error) {
  6546. reqHeaders := make(http.Header)
  6547. for k, v := range c.header_ {
  6548. reqHeaders[k] = v
  6549. }
  6550. reqHeaders.Set("User-Agent", c.s.userAgent())
  6551. if c.ifNoneMatch_ != "" {
  6552. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6553. }
  6554. var body io.Reader = nil
  6555. c.urlParams_.Set("alt", alt)
  6556. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  6557. urls += "?" + c.urlParams_.Encode()
  6558. req, _ := http.NewRequest("GET", urls, body)
  6559. req.Header = reqHeaders
  6560. googleapi.Expand(req.URL, map[string]string{
  6561. "name": c.name,
  6562. })
  6563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6564. }
  6565. // Do executes the "monitoring.projects.notificationChannels.get" call.
  6566. // Exactly one of *NotificationChannel or error will be non-nil. Any
  6567. // non-2xx status code is an error. Response headers are in either
  6568. // *NotificationChannel.ServerResponse.Header or (if a response was
  6569. // returned at all) in error.(*googleapi.Error).Header. Use
  6570. // googleapi.IsNotModified to check whether the returned error was
  6571. // because http.StatusNotModified was returned.
  6572. func (c *ProjectsNotificationChannelsGetCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  6573. gensupport.SetOptions(c.urlParams_, opts...)
  6574. res, err := c.doRequest("json")
  6575. if res != nil && res.StatusCode == http.StatusNotModified {
  6576. if res.Body != nil {
  6577. res.Body.Close()
  6578. }
  6579. return nil, &googleapi.Error{
  6580. Code: res.StatusCode,
  6581. Header: res.Header,
  6582. }
  6583. }
  6584. if err != nil {
  6585. return nil, err
  6586. }
  6587. defer googleapi.CloseBody(res)
  6588. if err := googleapi.CheckResponse(res); err != nil {
  6589. return nil, err
  6590. }
  6591. ret := &NotificationChannel{
  6592. ServerResponse: googleapi.ServerResponse{
  6593. Header: res.Header,
  6594. HTTPStatusCode: res.StatusCode,
  6595. },
  6596. }
  6597. target := &ret
  6598. if err := gensupport.DecodeResponse(target, res); err != nil {
  6599. return nil, err
  6600. }
  6601. return ret, nil
  6602. // {
  6603. // "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.",
  6604. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  6605. // "httpMethod": "GET",
  6606. // "id": "monitoring.projects.notificationChannels.get",
  6607. // "parameterOrder": [
  6608. // "name"
  6609. // ],
  6610. // "parameters": {
  6611. // "name": {
  6612. // "description": "The channel for which to execute the request. The format is projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID].",
  6613. // "location": "path",
  6614. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  6615. // "required": true,
  6616. // "type": "string"
  6617. // }
  6618. // },
  6619. // "path": "v3/{+name}",
  6620. // "response": {
  6621. // "$ref": "NotificationChannel"
  6622. // },
  6623. // "scopes": [
  6624. // "https://www.googleapis.com/auth/cloud-platform",
  6625. // "https://www.googleapis.com/auth/monitoring",
  6626. // "https://www.googleapis.com/auth/monitoring.read"
  6627. // ]
  6628. // }
  6629. }
  6630. // method id "monitoring.projects.notificationChannels.getVerificationCode":
  6631. type ProjectsNotificationChannelsGetVerificationCodeCall struct {
  6632. s *Service
  6633. name string
  6634. getnotificationchannelverificationcoderequest *GetNotificationChannelVerificationCodeRequest
  6635. urlParams_ gensupport.URLParams
  6636. ctx_ context.Context
  6637. header_ http.Header
  6638. }
  6639. // GetVerificationCode: Requests a verification code for an already
  6640. // verified channel that can then be used in a call to
  6641. // VerifyNotificationChannel() on a different channel with an equivalent
  6642. // identity in the same or in a different project. This makes it
  6643. // possible to copy a channel between projects without requiring manual
  6644. // reverification of the channel. If the channel is not in the verified
  6645. // state, this method will fail (in other words, this may only be used
  6646. // if the SendNotificationChannelVerificationCode and
  6647. // VerifyNotificationChannel paths have already been used to put the
  6648. // given channel into the verified state).There is no guarantee that the
  6649. // verification codes returned by this method will be of a similar
  6650. // structure or form as the ones that are delivered to the channel via
  6651. // SendNotificationChannelVerificationCode; while
  6652. // VerifyNotificationChannel() will recognize both the codes delivered
  6653. // via SendNotificationChannelVerificationCode() and returned from
  6654. // GetNotificationChannelVerificationCode(), it is typically the case
  6655. // that the verification codes delivered via
  6656. // SendNotificationChannelVerificationCode() will be shorter and also
  6657. // have a shorter expiration (e.g. codes such as "G-123456") whereas
  6658. // GetVerificationCode() will typically return a much longer, websafe
  6659. // base 64 encoded string that has a longer expiration time.
  6660. func (r *ProjectsNotificationChannelsService) GetVerificationCode(name string, getnotificationchannelverificationcoderequest *GetNotificationChannelVerificationCodeRequest) *ProjectsNotificationChannelsGetVerificationCodeCall {
  6661. c := &ProjectsNotificationChannelsGetVerificationCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6662. c.name = name
  6663. c.getnotificationchannelverificationcoderequest = getnotificationchannelverificationcoderequest
  6664. return c
  6665. }
  6666. // Fields allows partial responses to be retrieved. See
  6667. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6668. // for more information.
  6669. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsGetVerificationCodeCall {
  6670. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6671. return c
  6672. }
  6673. // Context sets the context to be used in this call's Do method. Any
  6674. // pending HTTP request will be aborted if the provided context is
  6675. // canceled.
  6676. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Context(ctx context.Context) *ProjectsNotificationChannelsGetVerificationCodeCall {
  6677. c.ctx_ = ctx
  6678. return c
  6679. }
  6680. // Header returns an http.Header that can be modified by the caller to
  6681. // add HTTP headers to the request.
  6682. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Header() http.Header {
  6683. if c.header_ == nil {
  6684. c.header_ = make(http.Header)
  6685. }
  6686. return c.header_
  6687. }
  6688. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) doRequest(alt string) (*http.Response, error) {
  6689. reqHeaders := make(http.Header)
  6690. for k, v := range c.header_ {
  6691. reqHeaders[k] = v
  6692. }
  6693. reqHeaders.Set("User-Agent", c.s.userAgent())
  6694. var body io.Reader = nil
  6695. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getnotificationchannelverificationcoderequest)
  6696. if err != nil {
  6697. return nil, err
  6698. }
  6699. reqHeaders.Set("Content-Type", "application/json")
  6700. c.urlParams_.Set("alt", alt)
  6701. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:getVerificationCode")
  6702. urls += "?" + c.urlParams_.Encode()
  6703. req, _ := http.NewRequest("POST", urls, body)
  6704. req.Header = reqHeaders
  6705. googleapi.Expand(req.URL, map[string]string{
  6706. "name": c.name,
  6707. })
  6708. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6709. }
  6710. // Do executes the "monitoring.projects.notificationChannels.getVerificationCode" call.
  6711. // Exactly one of *GetNotificationChannelVerificationCodeResponse or
  6712. // error will be non-nil. Any non-2xx status code is an error. Response
  6713. // headers are in either
  6714. // *GetNotificationChannelVerificationCodeResponse.ServerResponse.Header
  6715. // or (if a response was returned at all) in
  6716. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6717. // whether the returned error was because http.StatusNotModified was
  6718. // returned.
  6719. func (c *ProjectsNotificationChannelsGetVerificationCodeCall) Do(opts ...googleapi.CallOption) (*GetNotificationChannelVerificationCodeResponse, error) {
  6720. gensupport.SetOptions(c.urlParams_, opts...)
  6721. res, err := c.doRequest("json")
  6722. if res != nil && res.StatusCode == http.StatusNotModified {
  6723. if res.Body != nil {
  6724. res.Body.Close()
  6725. }
  6726. return nil, &googleapi.Error{
  6727. Code: res.StatusCode,
  6728. Header: res.Header,
  6729. }
  6730. }
  6731. if err != nil {
  6732. return nil, err
  6733. }
  6734. defer googleapi.CloseBody(res)
  6735. if err := googleapi.CheckResponse(res); err != nil {
  6736. return nil, err
  6737. }
  6738. ret := &GetNotificationChannelVerificationCodeResponse{
  6739. ServerResponse: googleapi.ServerResponse{
  6740. Header: res.Header,
  6741. HTTPStatusCode: res.StatusCode,
  6742. },
  6743. }
  6744. target := &ret
  6745. if err := gensupport.DecodeResponse(target, res); err != nil {
  6746. return nil, err
  6747. }
  6748. return ret, nil
  6749. // {
  6750. // "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.",
  6751. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:getVerificationCode",
  6752. // "httpMethod": "POST",
  6753. // "id": "monitoring.projects.notificationChannels.getVerificationCode",
  6754. // "parameterOrder": [
  6755. // "name"
  6756. // ],
  6757. // "parameters": {
  6758. // "name": {
  6759. // "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.",
  6760. // "location": "path",
  6761. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  6762. // "required": true,
  6763. // "type": "string"
  6764. // }
  6765. // },
  6766. // "path": "v3/{+name}:getVerificationCode",
  6767. // "request": {
  6768. // "$ref": "GetNotificationChannelVerificationCodeRequest"
  6769. // },
  6770. // "response": {
  6771. // "$ref": "GetNotificationChannelVerificationCodeResponse"
  6772. // },
  6773. // "scopes": [
  6774. // "https://www.googleapis.com/auth/cloud-platform",
  6775. // "https://www.googleapis.com/auth/monitoring"
  6776. // ]
  6777. // }
  6778. }
  6779. // method id "monitoring.projects.notificationChannels.list":
  6780. type ProjectsNotificationChannelsListCall struct {
  6781. s *Service
  6782. name string
  6783. urlParams_ gensupport.URLParams
  6784. ifNoneMatch_ string
  6785. ctx_ context.Context
  6786. header_ http.Header
  6787. }
  6788. // List: Lists the notification channels that have been created for the
  6789. // project.
  6790. func (r *ProjectsNotificationChannelsService) List(name string) *ProjectsNotificationChannelsListCall {
  6791. c := &ProjectsNotificationChannelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6792. c.name = name
  6793. return c
  6794. }
  6795. // Filter sets the optional parameter "filter": If provided, this field
  6796. // specifies the criteria that must be met by notification channels to
  6797. // be included in the response.For more details, see sorting and
  6798. // filtering.
  6799. func (c *ProjectsNotificationChannelsListCall) Filter(filter string) *ProjectsNotificationChannelsListCall {
  6800. c.urlParams_.Set("filter", filter)
  6801. return c
  6802. }
  6803. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  6804. // of fields by which to sort the result. Supports the same set of
  6805. // fields as in filter. Entries can be prefixed with a minus sign to
  6806. // sort in descending rather than ascending order.For more details, see
  6807. // sorting and filtering.
  6808. func (c *ProjectsNotificationChannelsListCall) OrderBy(orderBy string) *ProjectsNotificationChannelsListCall {
  6809. c.urlParams_.Set("orderBy", orderBy)
  6810. return c
  6811. }
  6812. // PageSize sets the optional parameter "pageSize": The maximum number
  6813. // of results to return in a single response. If not set to a positive
  6814. // number, a reasonable value will be chosen by the service.
  6815. func (c *ProjectsNotificationChannelsListCall) PageSize(pageSize int64) *ProjectsNotificationChannelsListCall {
  6816. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6817. return c
  6818. }
  6819. // PageToken sets the optional parameter "pageToken": If non-empty,
  6820. // page_token must contain a value returned as the next_page_token in a
  6821. // previous response to request the next set of results.
  6822. func (c *ProjectsNotificationChannelsListCall) PageToken(pageToken string) *ProjectsNotificationChannelsListCall {
  6823. c.urlParams_.Set("pageToken", pageToken)
  6824. return c
  6825. }
  6826. // Fields allows partial responses to be retrieved. See
  6827. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6828. // for more information.
  6829. func (c *ProjectsNotificationChannelsListCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsListCall {
  6830. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6831. return c
  6832. }
  6833. // IfNoneMatch sets the optional parameter which makes the operation
  6834. // fail if the object's ETag matches the given value. This is useful for
  6835. // getting updates only after the object has changed since the last
  6836. // request. Use googleapi.IsNotModified to check whether the response
  6837. // error from Do is the result of In-None-Match.
  6838. func (c *ProjectsNotificationChannelsListCall) IfNoneMatch(entityTag string) *ProjectsNotificationChannelsListCall {
  6839. c.ifNoneMatch_ = entityTag
  6840. return c
  6841. }
  6842. // Context sets the context to be used in this call's Do method. Any
  6843. // pending HTTP request will be aborted if the provided context is
  6844. // canceled.
  6845. func (c *ProjectsNotificationChannelsListCall) Context(ctx context.Context) *ProjectsNotificationChannelsListCall {
  6846. c.ctx_ = ctx
  6847. return c
  6848. }
  6849. // Header returns an http.Header that can be modified by the caller to
  6850. // add HTTP headers to the request.
  6851. func (c *ProjectsNotificationChannelsListCall) Header() http.Header {
  6852. if c.header_ == nil {
  6853. c.header_ = make(http.Header)
  6854. }
  6855. return c.header_
  6856. }
  6857. func (c *ProjectsNotificationChannelsListCall) doRequest(alt string) (*http.Response, error) {
  6858. reqHeaders := make(http.Header)
  6859. for k, v := range c.header_ {
  6860. reqHeaders[k] = v
  6861. }
  6862. reqHeaders.Set("User-Agent", c.s.userAgent())
  6863. if c.ifNoneMatch_ != "" {
  6864. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6865. }
  6866. var body io.Reader = nil
  6867. c.urlParams_.Set("alt", alt)
  6868. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/notificationChannels")
  6869. urls += "?" + c.urlParams_.Encode()
  6870. req, _ := http.NewRequest("GET", urls, body)
  6871. req.Header = reqHeaders
  6872. googleapi.Expand(req.URL, map[string]string{
  6873. "name": c.name,
  6874. })
  6875. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6876. }
  6877. // Do executes the "monitoring.projects.notificationChannels.list" call.
  6878. // Exactly one of *ListNotificationChannelsResponse or error will be
  6879. // non-nil. Any non-2xx status code is an error. Response headers are in
  6880. // either *ListNotificationChannelsResponse.ServerResponse.Header or (if
  6881. // a response was returned at all) in error.(*googleapi.Error).Header.
  6882. // Use googleapi.IsNotModified to check whether the returned error was
  6883. // because http.StatusNotModified was returned.
  6884. func (c *ProjectsNotificationChannelsListCall) Do(opts ...googleapi.CallOption) (*ListNotificationChannelsResponse, error) {
  6885. gensupport.SetOptions(c.urlParams_, opts...)
  6886. res, err := c.doRequest("json")
  6887. if res != nil && res.StatusCode == http.StatusNotModified {
  6888. if res.Body != nil {
  6889. res.Body.Close()
  6890. }
  6891. return nil, &googleapi.Error{
  6892. Code: res.StatusCode,
  6893. Header: res.Header,
  6894. }
  6895. }
  6896. if err != nil {
  6897. return nil, err
  6898. }
  6899. defer googleapi.CloseBody(res)
  6900. if err := googleapi.CheckResponse(res); err != nil {
  6901. return nil, err
  6902. }
  6903. ret := &ListNotificationChannelsResponse{
  6904. ServerResponse: googleapi.ServerResponse{
  6905. Header: res.Header,
  6906. HTTPStatusCode: res.StatusCode,
  6907. },
  6908. }
  6909. target := &ret
  6910. if err := gensupport.DecodeResponse(target, res); err != nil {
  6911. return nil, err
  6912. }
  6913. return ret, nil
  6914. // {
  6915. // "description": "Lists the notification channels that have been created for the project.",
  6916. // "flatPath": "v3/projects/{projectsId}/notificationChannels",
  6917. // "httpMethod": "GET",
  6918. // "id": "monitoring.projects.notificationChannels.list",
  6919. // "parameterOrder": [
  6920. // "name"
  6921. // ],
  6922. // "parameters": {
  6923. // "filter": {
  6924. // "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.",
  6925. // "location": "query",
  6926. // "type": "string"
  6927. // },
  6928. // "name": {
  6929. // "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.",
  6930. // "location": "path",
  6931. // "pattern": "^projects/[^/]+$",
  6932. // "required": true,
  6933. // "type": "string"
  6934. // },
  6935. // "orderBy": {
  6936. // "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.",
  6937. // "location": "query",
  6938. // "type": "string"
  6939. // },
  6940. // "pageSize": {
  6941. // "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.",
  6942. // "format": "int32",
  6943. // "location": "query",
  6944. // "type": "integer"
  6945. // },
  6946. // "pageToken": {
  6947. // "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.",
  6948. // "location": "query",
  6949. // "type": "string"
  6950. // }
  6951. // },
  6952. // "path": "v3/{+name}/notificationChannels",
  6953. // "response": {
  6954. // "$ref": "ListNotificationChannelsResponse"
  6955. // },
  6956. // "scopes": [
  6957. // "https://www.googleapis.com/auth/cloud-platform",
  6958. // "https://www.googleapis.com/auth/monitoring",
  6959. // "https://www.googleapis.com/auth/monitoring.read"
  6960. // ]
  6961. // }
  6962. }
  6963. // Pages invokes f for each page of results.
  6964. // A non-nil error returned from f will halt the iteration.
  6965. // The provided context supersedes any context provided to the Context method.
  6966. func (c *ProjectsNotificationChannelsListCall) Pages(ctx context.Context, f func(*ListNotificationChannelsResponse) error) error {
  6967. c.ctx_ = ctx
  6968. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6969. for {
  6970. x, err := c.Do()
  6971. if err != nil {
  6972. return err
  6973. }
  6974. if err := f(x); err != nil {
  6975. return err
  6976. }
  6977. if x.NextPageToken == "" {
  6978. return nil
  6979. }
  6980. c.PageToken(x.NextPageToken)
  6981. }
  6982. }
  6983. // method id "monitoring.projects.notificationChannels.patch":
  6984. type ProjectsNotificationChannelsPatchCall struct {
  6985. s *Service
  6986. name string
  6987. notificationchannel *NotificationChannel
  6988. urlParams_ gensupport.URLParams
  6989. ctx_ context.Context
  6990. header_ http.Header
  6991. }
  6992. // Patch: Updates a notification channel. Fields not specified in the
  6993. // field mask remain unchanged.
  6994. func (r *ProjectsNotificationChannelsService) Patch(name string, notificationchannel *NotificationChannel) *ProjectsNotificationChannelsPatchCall {
  6995. c := &ProjectsNotificationChannelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6996. c.name = name
  6997. c.notificationchannel = notificationchannel
  6998. return c
  6999. }
  7000. // UpdateMask sets the optional parameter "updateMask": The fields to
  7001. // update.
  7002. func (c *ProjectsNotificationChannelsPatchCall) UpdateMask(updateMask string) *ProjectsNotificationChannelsPatchCall {
  7003. c.urlParams_.Set("updateMask", updateMask)
  7004. return c
  7005. }
  7006. // Fields allows partial responses to be retrieved. See
  7007. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7008. // for more information.
  7009. func (c *ProjectsNotificationChannelsPatchCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsPatchCall {
  7010. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7011. return c
  7012. }
  7013. // Context sets the context to be used in this call's Do method. Any
  7014. // pending HTTP request will be aborted if the provided context is
  7015. // canceled.
  7016. func (c *ProjectsNotificationChannelsPatchCall) Context(ctx context.Context) *ProjectsNotificationChannelsPatchCall {
  7017. c.ctx_ = ctx
  7018. return c
  7019. }
  7020. // Header returns an http.Header that can be modified by the caller to
  7021. // add HTTP headers to the request.
  7022. func (c *ProjectsNotificationChannelsPatchCall) Header() http.Header {
  7023. if c.header_ == nil {
  7024. c.header_ = make(http.Header)
  7025. }
  7026. return c.header_
  7027. }
  7028. func (c *ProjectsNotificationChannelsPatchCall) doRequest(alt string) (*http.Response, error) {
  7029. reqHeaders := make(http.Header)
  7030. for k, v := range c.header_ {
  7031. reqHeaders[k] = v
  7032. }
  7033. reqHeaders.Set("User-Agent", c.s.userAgent())
  7034. var body io.Reader = nil
  7035. body, err := googleapi.WithoutDataWrapper.JSONReader(c.notificationchannel)
  7036. if err != nil {
  7037. return nil, err
  7038. }
  7039. reqHeaders.Set("Content-Type", "application/json")
  7040. c.urlParams_.Set("alt", alt)
  7041. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  7042. urls += "?" + c.urlParams_.Encode()
  7043. req, _ := http.NewRequest("PATCH", urls, body)
  7044. req.Header = reqHeaders
  7045. googleapi.Expand(req.URL, map[string]string{
  7046. "name": c.name,
  7047. })
  7048. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7049. }
  7050. // Do executes the "monitoring.projects.notificationChannels.patch" call.
  7051. // Exactly one of *NotificationChannel or error will be non-nil. Any
  7052. // non-2xx status code is an error. Response headers are in either
  7053. // *NotificationChannel.ServerResponse.Header or (if a response was
  7054. // returned at all) in error.(*googleapi.Error).Header. Use
  7055. // googleapi.IsNotModified to check whether the returned error was
  7056. // because http.StatusNotModified was returned.
  7057. func (c *ProjectsNotificationChannelsPatchCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  7058. gensupport.SetOptions(c.urlParams_, opts...)
  7059. res, err := c.doRequest("json")
  7060. if res != nil && res.StatusCode == http.StatusNotModified {
  7061. if res.Body != nil {
  7062. res.Body.Close()
  7063. }
  7064. return nil, &googleapi.Error{
  7065. Code: res.StatusCode,
  7066. Header: res.Header,
  7067. }
  7068. }
  7069. if err != nil {
  7070. return nil, err
  7071. }
  7072. defer googleapi.CloseBody(res)
  7073. if err := googleapi.CheckResponse(res); err != nil {
  7074. return nil, err
  7075. }
  7076. ret := &NotificationChannel{
  7077. ServerResponse: googleapi.ServerResponse{
  7078. Header: res.Header,
  7079. HTTPStatusCode: res.StatusCode,
  7080. },
  7081. }
  7082. target := &ret
  7083. if err := gensupport.DecodeResponse(target, res); err != nil {
  7084. return nil, err
  7085. }
  7086. return ret, nil
  7087. // {
  7088. // "description": "Updates a notification channel. Fields not specified in the field mask remain unchanged.",
  7089. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}",
  7090. // "httpMethod": "PATCH",
  7091. // "id": "monitoring.projects.notificationChannels.patch",
  7092. // "parameterOrder": [
  7093. // "name"
  7094. // ],
  7095. // "parameters": {
  7096. // "name": {
  7097. // "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.",
  7098. // "location": "path",
  7099. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7100. // "required": true,
  7101. // "type": "string"
  7102. // },
  7103. // "updateMask": {
  7104. // "description": "The fields to update.",
  7105. // "format": "google-fieldmask",
  7106. // "location": "query",
  7107. // "type": "string"
  7108. // }
  7109. // },
  7110. // "path": "v3/{+name}",
  7111. // "request": {
  7112. // "$ref": "NotificationChannel"
  7113. // },
  7114. // "response": {
  7115. // "$ref": "NotificationChannel"
  7116. // },
  7117. // "scopes": [
  7118. // "https://www.googleapis.com/auth/cloud-platform",
  7119. // "https://www.googleapis.com/auth/monitoring"
  7120. // ]
  7121. // }
  7122. }
  7123. // method id "monitoring.projects.notificationChannels.sendVerificationCode":
  7124. type ProjectsNotificationChannelsSendVerificationCodeCall struct {
  7125. s *Service
  7126. name string
  7127. sendnotificationchannelverificationcoderequest *SendNotificationChannelVerificationCodeRequest
  7128. urlParams_ gensupport.URLParams
  7129. ctx_ context.Context
  7130. header_ http.Header
  7131. }
  7132. // SendVerificationCode: Causes a verification code to be delivered to
  7133. // the channel. The code can then be supplied in
  7134. // VerifyNotificationChannel to verify the channel.
  7135. func (r *ProjectsNotificationChannelsService) SendVerificationCode(name string, sendnotificationchannelverificationcoderequest *SendNotificationChannelVerificationCodeRequest) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7136. c := &ProjectsNotificationChannelsSendVerificationCodeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7137. c.name = name
  7138. c.sendnotificationchannelverificationcoderequest = sendnotificationchannelverificationcoderequest
  7139. return c
  7140. }
  7141. // Fields allows partial responses to be retrieved. See
  7142. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7143. // for more information.
  7144. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7145. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7146. return c
  7147. }
  7148. // Context sets the context to be used in this call's Do method. Any
  7149. // pending HTTP request will be aborted if the provided context is
  7150. // canceled.
  7151. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Context(ctx context.Context) *ProjectsNotificationChannelsSendVerificationCodeCall {
  7152. c.ctx_ = ctx
  7153. return c
  7154. }
  7155. // Header returns an http.Header that can be modified by the caller to
  7156. // add HTTP headers to the request.
  7157. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Header() http.Header {
  7158. if c.header_ == nil {
  7159. c.header_ = make(http.Header)
  7160. }
  7161. return c.header_
  7162. }
  7163. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) doRequest(alt string) (*http.Response, error) {
  7164. reqHeaders := make(http.Header)
  7165. for k, v := range c.header_ {
  7166. reqHeaders[k] = v
  7167. }
  7168. reqHeaders.Set("User-Agent", c.s.userAgent())
  7169. var body io.Reader = nil
  7170. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendnotificationchannelverificationcoderequest)
  7171. if err != nil {
  7172. return nil, err
  7173. }
  7174. reqHeaders.Set("Content-Type", "application/json")
  7175. c.urlParams_.Set("alt", alt)
  7176. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:sendVerificationCode")
  7177. urls += "?" + c.urlParams_.Encode()
  7178. req, _ := http.NewRequest("POST", urls, body)
  7179. req.Header = reqHeaders
  7180. googleapi.Expand(req.URL, map[string]string{
  7181. "name": c.name,
  7182. })
  7183. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7184. }
  7185. // Do executes the "monitoring.projects.notificationChannels.sendVerificationCode" call.
  7186. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7187. // code is an error. Response headers are in either
  7188. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7189. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7190. // check whether the returned error was because http.StatusNotModified
  7191. // was returned.
  7192. func (c *ProjectsNotificationChannelsSendVerificationCodeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7193. gensupport.SetOptions(c.urlParams_, opts...)
  7194. res, err := c.doRequest("json")
  7195. if res != nil && res.StatusCode == http.StatusNotModified {
  7196. if res.Body != nil {
  7197. res.Body.Close()
  7198. }
  7199. return nil, &googleapi.Error{
  7200. Code: res.StatusCode,
  7201. Header: res.Header,
  7202. }
  7203. }
  7204. if err != nil {
  7205. return nil, err
  7206. }
  7207. defer googleapi.CloseBody(res)
  7208. if err := googleapi.CheckResponse(res); err != nil {
  7209. return nil, err
  7210. }
  7211. ret := &Empty{
  7212. ServerResponse: googleapi.ServerResponse{
  7213. Header: res.Header,
  7214. HTTPStatusCode: res.StatusCode,
  7215. },
  7216. }
  7217. target := &ret
  7218. if err := gensupport.DecodeResponse(target, res); err != nil {
  7219. return nil, err
  7220. }
  7221. return ret, nil
  7222. // {
  7223. // "description": "Causes a verification code to be delivered to the channel. The code can then be supplied in VerifyNotificationChannel to verify the channel.",
  7224. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:sendVerificationCode",
  7225. // "httpMethod": "POST",
  7226. // "id": "monitoring.projects.notificationChannels.sendVerificationCode",
  7227. // "parameterOrder": [
  7228. // "name"
  7229. // ],
  7230. // "parameters": {
  7231. // "name": {
  7232. // "description": "The notification channel to which to send a verification code.",
  7233. // "location": "path",
  7234. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7235. // "required": true,
  7236. // "type": "string"
  7237. // }
  7238. // },
  7239. // "path": "v3/{+name}:sendVerificationCode",
  7240. // "request": {
  7241. // "$ref": "SendNotificationChannelVerificationCodeRequest"
  7242. // },
  7243. // "response": {
  7244. // "$ref": "Empty"
  7245. // },
  7246. // "scopes": [
  7247. // "https://www.googleapis.com/auth/cloud-platform",
  7248. // "https://www.googleapis.com/auth/monitoring"
  7249. // ]
  7250. // }
  7251. }
  7252. // method id "monitoring.projects.notificationChannels.verify":
  7253. type ProjectsNotificationChannelsVerifyCall struct {
  7254. s *Service
  7255. name string
  7256. verifynotificationchannelrequest *VerifyNotificationChannelRequest
  7257. urlParams_ gensupport.URLParams
  7258. ctx_ context.Context
  7259. header_ http.Header
  7260. }
  7261. // Verify: Verifies a NotificationChannel by proving receipt of the code
  7262. // delivered to the channel as a result of calling
  7263. // SendNotificationChannelVerificationCode.
  7264. func (r *ProjectsNotificationChannelsService) Verify(name string, verifynotificationchannelrequest *VerifyNotificationChannelRequest) *ProjectsNotificationChannelsVerifyCall {
  7265. c := &ProjectsNotificationChannelsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7266. c.name = name
  7267. c.verifynotificationchannelrequest = verifynotificationchannelrequest
  7268. return c
  7269. }
  7270. // Fields allows partial responses to be retrieved. See
  7271. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7272. // for more information.
  7273. func (c *ProjectsNotificationChannelsVerifyCall) Fields(s ...googleapi.Field) *ProjectsNotificationChannelsVerifyCall {
  7274. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7275. return c
  7276. }
  7277. // Context sets the context to be used in this call's Do method. Any
  7278. // pending HTTP request will be aborted if the provided context is
  7279. // canceled.
  7280. func (c *ProjectsNotificationChannelsVerifyCall) Context(ctx context.Context) *ProjectsNotificationChannelsVerifyCall {
  7281. c.ctx_ = ctx
  7282. return c
  7283. }
  7284. // Header returns an http.Header that can be modified by the caller to
  7285. // add HTTP headers to the request.
  7286. func (c *ProjectsNotificationChannelsVerifyCall) Header() http.Header {
  7287. if c.header_ == nil {
  7288. c.header_ = make(http.Header)
  7289. }
  7290. return c.header_
  7291. }
  7292. func (c *ProjectsNotificationChannelsVerifyCall) doRequest(alt string) (*http.Response, error) {
  7293. reqHeaders := make(http.Header)
  7294. for k, v := range c.header_ {
  7295. reqHeaders[k] = v
  7296. }
  7297. reqHeaders.Set("User-Agent", c.s.userAgent())
  7298. var body io.Reader = nil
  7299. body, err := googleapi.WithoutDataWrapper.JSONReader(c.verifynotificationchannelrequest)
  7300. if err != nil {
  7301. return nil, err
  7302. }
  7303. reqHeaders.Set("Content-Type", "application/json")
  7304. c.urlParams_.Set("alt", alt)
  7305. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:verify")
  7306. urls += "?" + c.urlParams_.Encode()
  7307. req, _ := http.NewRequest("POST", urls, body)
  7308. req.Header = reqHeaders
  7309. googleapi.Expand(req.URL, map[string]string{
  7310. "name": c.name,
  7311. })
  7312. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7313. }
  7314. // Do executes the "monitoring.projects.notificationChannels.verify" call.
  7315. // Exactly one of *NotificationChannel or error will be non-nil. Any
  7316. // non-2xx status code is an error. Response headers are in either
  7317. // *NotificationChannel.ServerResponse.Header or (if a response was
  7318. // returned at all) in error.(*googleapi.Error).Header. Use
  7319. // googleapi.IsNotModified to check whether the returned error was
  7320. // because http.StatusNotModified was returned.
  7321. func (c *ProjectsNotificationChannelsVerifyCall) Do(opts ...googleapi.CallOption) (*NotificationChannel, error) {
  7322. gensupport.SetOptions(c.urlParams_, opts...)
  7323. res, err := c.doRequest("json")
  7324. if res != nil && res.StatusCode == http.StatusNotModified {
  7325. if res.Body != nil {
  7326. res.Body.Close()
  7327. }
  7328. return nil, &googleapi.Error{
  7329. Code: res.StatusCode,
  7330. Header: res.Header,
  7331. }
  7332. }
  7333. if err != nil {
  7334. return nil, err
  7335. }
  7336. defer googleapi.CloseBody(res)
  7337. if err := googleapi.CheckResponse(res); err != nil {
  7338. return nil, err
  7339. }
  7340. ret := &NotificationChannel{
  7341. ServerResponse: googleapi.ServerResponse{
  7342. Header: res.Header,
  7343. HTTPStatusCode: res.StatusCode,
  7344. },
  7345. }
  7346. target := &ret
  7347. if err := gensupport.DecodeResponse(target, res); err != nil {
  7348. return nil, err
  7349. }
  7350. return ret, nil
  7351. // {
  7352. // "description": "Verifies a NotificationChannel by proving receipt of the code delivered to the channel as a result of calling SendNotificationChannelVerificationCode.",
  7353. // "flatPath": "v3/projects/{projectsId}/notificationChannels/{notificationChannelsId}:verify",
  7354. // "httpMethod": "POST",
  7355. // "id": "monitoring.projects.notificationChannels.verify",
  7356. // "parameterOrder": [
  7357. // "name"
  7358. // ],
  7359. // "parameters": {
  7360. // "name": {
  7361. // "description": "The notification channel to verify.",
  7362. // "location": "path",
  7363. // "pattern": "^projects/[^/]+/notificationChannels/[^/]+$",
  7364. // "required": true,
  7365. // "type": "string"
  7366. // }
  7367. // },
  7368. // "path": "v3/{+name}:verify",
  7369. // "request": {
  7370. // "$ref": "VerifyNotificationChannelRequest"
  7371. // },
  7372. // "response": {
  7373. // "$ref": "NotificationChannel"
  7374. // },
  7375. // "scopes": [
  7376. // "https://www.googleapis.com/auth/cloud-platform",
  7377. // "https://www.googleapis.com/auth/monitoring"
  7378. // ]
  7379. // }
  7380. }
  7381. // method id "monitoring.projects.timeSeries.create":
  7382. type ProjectsTimeSeriesCreateCall struct {
  7383. s *Service
  7384. name string
  7385. createtimeseriesrequest *CreateTimeSeriesRequest
  7386. urlParams_ gensupport.URLParams
  7387. ctx_ context.Context
  7388. header_ http.Header
  7389. }
  7390. // Create: Creates or adds data to one or more time series. The response
  7391. // is empty if all time series in the request were written. If any time
  7392. // series could not be written, a corresponding failure message is
  7393. // included in the error response.
  7394. func (r *ProjectsTimeSeriesService) Create(name string, createtimeseriesrequest *CreateTimeSeriesRequest) *ProjectsTimeSeriesCreateCall {
  7395. c := &ProjectsTimeSeriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7396. c.name = name
  7397. c.createtimeseriesrequest = createtimeseriesrequest
  7398. return c
  7399. }
  7400. // Fields allows partial responses to be retrieved. See
  7401. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7402. // for more information.
  7403. func (c *ProjectsTimeSeriesCreateCall) Fields(s ...googleapi.Field) *ProjectsTimeSeriesCreateCall {
  7404. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7405. return c
  7406. }
  7407. // Context sets the context to be used in this call's Do method. Any
  7408. // pending HTTP request will be aborted if the provided context is
  7409. // canceled.
  7410. func (c *ProjectsTimeSeriesCreateCall) Context(ctx context.Context) *ProjectsTimeSeriesCreateCall {
  7411. c.ctx_ = ctx
  7412. return c
  7413. }
  7414. // Header returns an http.Header that can be modified by the caller to
  7415. // add HTTP headers to the request.
  7416. func (c *ProjectsTimeSeriesCreateCall) Header() http.Header {
  7417. if c.header_ == nil {
  7418. c.header_ = make(http.Header)
  7419. }
  7420. return c.header_
  7421. }
  7422. func (c *ProjectsTimeSeriesCreateCall) doRequest(alt string) (*http.Response, error) {
  7423. reqHeaders := make(http.Header)
  7424. for k, v := range c.header_ {
  7425. reqHeaders[k] = v
  7426. }
  7427. reqHeaders.Set("User-Agent", c.s.userAgent())
  7428. var body io.Reader = nil
  7429. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createtimeseriesrequest)
  7430. if err != nil {
  7431. return nil, err
  7432. }
  7433. reqHeaders.Set("Content-Type", "application/json")
  7434. c.urlParams_.Set("alt", alt)
  7435. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/timeSeries")
  7436. urls += "?" + c.urlParams_.Encode()
  7437. req, _ := http.NewRequest("POST", urls, body)
  7438. req.Header = reqHeaders
  7439. googleapi.Expand(req.URL, map[string]string{
  7440. "name": c.name,
  7441. })
  7442. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7443. }
  7444. // Do executes the "monitoring.projects.timeSeries.create" call.
  7445. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7446. // code is an error. Response headers are in either
  7447. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7448. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7449. // check whether the returned error was because http.StatusNotModified
  7450. // was returned.
  7451. func (c *ProjectsTimeSeriesCreateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7452. gensupport.SetOptions(c.urlParams_, opts...)
  7453. res, err := c.doRequest("json")
  7454. if res != nil && res.StatusCode == http.StatusNotModified {
  7455. if res.Body != nil {
  7456. res.Body.Close()
  7457. }
  7458. return nil, &googleapi.Error{
  7459. Code: res.StatusCode,
  7460. Header: res.Header,
  7461. }
  7462. }
  7463. if err != nil {
  7464. return nil, err
  7465. }
  7466. defer googleapi.CloseBody(res)
  7467. if err := googleapi.CheckResponse(res); err != nil {
  7468. return nil, err
  7469. }
  7470. ret := &Empty{
  7471. ServerResponse: googleapi.ServerResponse{
  7472. Header: res.Header,
  7473. HTTPStatusCode: res.StatusCode,
  7474. },
  7475. }
  7476. target := &ret
  7477. if err := gensupport.DecodeResponse(target, res); err != nil {
  7478. return nil, err
  7479. }
  7480. return ret, nil
  7481. // {
  7482. // "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.",
  7483. // "flatPath": "v3/projects/{projectsId}/timeSeries",
  7484. // "httpMethod": "POST",
  7485. // "id": "monitoring.projects.timeSeries.create",
  7486. // "parameterOrder": [
  7487. // "name"
  7488. // ],
  7489. // "parameters": {
  7490. // "name": {
  7491. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  7492. // "location": "path",
  7493. // "pattern": "^projects/[^/]+$",
  7494. // "required": true,
  7495. // "type": "string"
  7496. // }
  7497. // },
  7498. // "path": "v3/{+name}/timeSeries",
  7499. // "request": {
  7500. // "$ref": "CreateTimeSeriesRequest"
  7501. // },
  7502. // "response": {
  7503. // "$ref": "Empty"
  7504. // },
  7505. // "scopes": [
  7506. // "https://www.googleapis.com/auth/cloud-platform",
  7507. // "https://www.googleapis.com/auth/monitoring",
  7508. // "https://www.googleapis.com/auth/monitoring.write"
  7509. // ]
  7510. // }
  7511. }
  7512. // method id "monitoring.projects.timeSeries.list":
  7513. type ProjectsTimeSeriesListCall struct {
  7514. s *Service
  7515. name string
  7516. urlParams_ gensupport.URLParams
  7517. ifNoneMatch_ string
  7518. ctx_ context.Context
  7519. header_ http.Header
  7520. }
  7521. // List: Lists time series that match a filter. This method does not
  7522. // require a Stackdriver account.
  7523. func (r *ProjectsTimeSeriesService) List(name string) *ProjectsTimeSeriesListCall {
  7524. c := &ProjectsTimeSeriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7525. c.name = name
  7526. return c
  7527. }
  7528. // AggregationAlignmentPeriod sets the optional parameter
  7529. // "aggregation.alignmentPeriod": The alignment period for per-time
  7530. // series alignment. If present, alignmentPeriod must be at least 60
  7531. // seconds. After per-time series alignment, each time series will
  7532. // contain data points only on the period boundaries. If
  7533. // perSeriesAligner is not specified or equals ALIGN_NONE, then this
  7534. // field is ignored. If perSeriesAligner is specified and does not equal
  7535. // ALIGN_NONE, then this field must be defined; otherwise an error is
  7536. // returned.
  7537. func (c *ProjectsTimeSeriesListCall) AggregationAlignmentPeriod(aggregationAlignmentPeriod string) *ProjectsTimeSeriesListCall {
  7538. c.urlParams_.Set("aggregation.alignmentPeriod", aggregationAlignmentPeriod)
  7539. return c
  7540. }
  7541. // AggregationCrossSeriesReducer sets the optional parameter
  7542. // "aggregation.crossSeriesReducer": The approach to be used to combine
  7543. // time series. Not all reducer functions may be applied to all time
  7544. // series, depending on the metric type and the value type of the
  7545. // original time series. Reduction may change the metric type of value
  7546. // type of the time series.Time series data must be aligned in order to
  7547. // perform cross-time series reduction. If crossSeriesReducer is
  7548. // specified, then perSeriesAligner must be specified and not equal
  7549. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  7550. // is returned.
  7551. //
  7552. // Possible values:
  7553. // "REDUCE_NONE"
  7554. // "REDUCE_MEAN"
  7555. // "REDUCE_MIN"
  7556. // "REDUCE_MAX"
  7557. // "REDUCE_SUM"
  7558. // "REDUCE_STDDEV"
  7559. // "REDUCE_COUNT"
  7560. // "REDUCE_COUNT_TRUE"
  7561. // "REDUCE_COUNT_FALSE"
  7562. // "REDUCE_FRACTION_TRUE"
  7563. // "REDUCE_PERCENTILE_99"
  7564. // "REDUCE_PERCENTILE_95"
  7565. // "REDUCE_PERCENTILE_50"
  7566. // "REDUCE_PERCENTILE_05"
  7567. func (c *ProjectsTimeSeriesListCall) AggregationCrossSeriesReducer(aggregationCrossSeriesReducer string) *ProjectsTimeSeriesListCall {
  7568. c.urlParams_.Set("aggregation.crossSeriesReducer", aggregationCrossSeriesReducer)
  7569. return c
  7570. }
  7571. // AggregationGroupByFields sets the optional parameter
  7572. // "aggregation.groupByFields": The set of fields to preserve when
  7573. // crossSeriesReducer is specified. The groupByFields determine how the
  7574. // time series are partitioned into subsets prior to applying the
  7575. // aggregation function. Each subset contains time series that have the
  7576. // same value for each of the grouping fields. Each individual time
  7577. // series is a member of exactly one subset. The crossSeriesReducer is
  7578. // applied to each subset of time series. It is not possible to reduce
  7579. // across different resource types, so this field implicitly contains
  7580. // resource.type. Fields not specified in groupByFields are aggregated
  7581. // away. If groupByFields is not specified and all the time series have
  7582. // the same resource type, then the time series are aggregated into a
  7583. // single output time series. If crossSeriesReducer is not defined, this
  7584. // field is ignored.
  7585. func (c *ProjectsTimeSeriesListCall) AggregationGroupByFields(aggregationGroupByFields ...string) *ProjectsTimeSeriesListCall {
  7586. c.urlParams_.SetMulti("aggregation.groupByFields", append([]string{}, aggregationGroupByFields...))
  7587. return c
  7588. }
  7589. // AggregationPerSeriesAligner sets the optional parameter
  7590. // "aggregation.perSeriesAligner": The approach to be used to align
  7591. // individual time series. Not all alignment functions may be applied to
  7592. // all time series, depending on the metric type and value type of the
  7593. // original time series. Alignment may change the metric type or the
  7594. // value type of the time series.Time series data must be aligned in
  7595. // order to perform cross-time series reduction. If crossSeriesReducer
  7596. // is specified, then perSeriesAligner must be specified and not equal
  7597. // ALIGN_NONE and alignmentPeriod must be specified; otherwise, an error
  7598. // is returned.
  7599. //
  7600. // Possible values:
  7601. // "ALIGN_NONE"
  7602. // "ALIGN_DELTA"
  7603. // "ALIGN_RATE"
  7604. // "ALIGN_INTERPOLATE"
  7605. // "ALIGN_NEXT_OLDER"
  7606. // "ALIGN_MIN"
  7607. // "ALIGN_MAX"
  7608. // "ALIGN_MEAN"
  7609. // "ALIGN_COUNT"
  7610. // "ALIGN_SUM"
  7611. // "ALIGN_STDDEV"
  7612. // "ALIGN_COUNT_TRUE"
  7613. // "ALIGN_COUNT_FALSE"
  7614. // "ALIGN_FRACTION_TRUE"
  7615. // "ALIGN_PERCENTILE_99"
  7616. // "ALIGN_PERCENTILE_95"
  7617. // "ALIGN_PERCENTILE_50"
  7618. // "ALIGN_PERCENTILE_05"
  7619. // "ALIGN_PERCENT_CHANGE"
  7620. func (c *ProjectsTimeSeriesListCall) AggregationPerSeriesAligner(aggregationPerSeriesAligner string) *ProjectsTimeSeriesListCall {
  7621. c.urlParams_.Set("aggregation.perSeriesAligner", aggregationPerSeriesAligner)
  7622. return c
  7623. }
  7624. // Filter sets the optional parameter "filter": A monitoring filter that
  7625. // specifies which time series should be returned. The filter must
  7626. // specify a single metric type, and can additionally specify metric
  7627. // labels and other information. For example:
  7628. // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
  7629. // metric.label.instance_name = "my-instance-name"
  7630. func (c *ProjectsTimeSeriesListCall) Filter(filter string) *ProjectsTimeSeriesListCall {
  7631. c.urlParams_.Set("filter", filter)
  7632. return c
  7633. }
  7634. // IntervalEndTime sets the optional parameter "interval.endTime":
  7635. // Required. The end of the time interval.
  7636. func (c *ProjectsTimeSeriesListCall) IntervalEndTime(intervalEndTime string) *ProjectsTimeSeriesListCall {
  7637. c.urlParams_.Set("interval.endTime", intervalEndTime)
  7638. return c
  7639. }
  7640. // IntervalStartTime sets the optional parameter "interval.startTime":
  7641. // The beginning of the time interval. The default value for the start
  7642. // time is the end time. The start time must not be later than the end
  7643. // time.
  7644. func (c *ProjectsTimeSeriesListCall) IntervalStartTime(intervalStartTime string) *ProjectsTimeSeriesListCall {
  7645. c.urlParams_.Set("interval.startTime", intervalStartTime)
  7646. return c
  7647. }
  7648. // OrderBy sets the optional parameter "orderBy": Unsupported: must be
  7649. // left blank. The points in each time series are returned in reverse
  7650. // time order.
  7651. func (c *ProjectsTimeSeriesListCall) OrderBy(orderBy string) *ProjectsTimeSeriesListCall {
  7652. c.urlParams_.Set("orderBy", orderBy)
  7653. return c
  7654. }
  7655. // PageSize sets the optional parameter "pageSize": A positive number
  7656. // that is the maximum number of results to return. If page_size is
  7657. // empty or more than 100,000 results, the effective page_size is
  7658. // 100,000 results. If view is set to FULL, this is the maximum number
  7659. // of Points returned. If view is set to HEADERS, this is the maximum
  7660. // number of TimeSeries returned.
  7661. func (c *ProjectsTimeSeriesListCall) PageSize(pageSize int64) *ProjectsTimeSeriesListCall {
  7662. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7663. return c
  7664. }
  7665. // PageToken sets the optional parameter "pageToken": If this field is
  7666. // not empty then it must contain the nextPageToken value returned by a
  7667. // previous call to this method. Using this field causes the method to
  7668. // return additional results from the previous method call.
  7669. func (c *ProjectsTimeSeriesListCall) PageToken(pageToken string) *ProjectsTimeSeriesListCall {
  7670. c.urlParams_.Set("pageToken", pageToken)
  7671. return c
  7672. }
  7673. // View sets the optional parameter "view": Specifies which information
  7674. // is returned about the time series.
  7675. //
  7676. // Possible values:
  7677. // "FULL"
  7678. // "HEADERS"
  7679. func (c *ProjectsTimeSeriesListCall) View(view string) *ProjectsTimeSeriesListCall {
  7680. c.urlParams_.Set("view", view)
  7681. return c
  7682. }
  7683. // Fields allows partial responses to be retrieved. See
  7684. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7685. // for more information.
  7686. func (c *ProjectsTimeSeriesListCall) Fields(s ...googleapi.Field) *ProjectsTimeSeriesListCall {
  7687. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7688. return c
  7689. }
  7690. // IfNoneMatch sets the optional parameter which makes the operation
  7691. // fail if the object's ETag matches the given value. This is useful for
  7692. // getting updates only after the object has changed since the last
  7693. // request. Use googleapi.IsNotModified to check whether the response
  7694. // error from Do is the result of In-None-Match.
  7695. func (c *ProjectsTimeSeriesListCall) IfNoneMatch(entityTag string) *ProjectsTimeSeriesListCall {
  7696. c.ifNoneMatch_ = entityTag
  7697. return c
  7698. }
  7699. // Context sets the context to be used in this call's Do method. Any
  7700. // pending HTTP request will be aborted if the provided context is
  7701. // canceled.
  7702. func (c *ProjectsTimeSeriesListCall) Context(ctx context.Context) *ProjectsTimeSeriesListCall {
  7703. c.ctx_ = ctx
  7704. return c
  7705. }
  7706. // Header returns an http.Header that can be modified by the caller to
  7707. // add HTTP headers to the request.
  7708. func (c *ProjectsTimeSeriesListCall) Header() http.Header {
  7709. if c.header_ == nil {
  7710. c.header_ = make(http.Header)
  7711. }
  7712. return c.header_
  7713. }
  7714. func (c *ProjectsTimeSeriesListCall) doRequest(alt string) (*http.Response, error) {
  7715. reqHeaders := make(http.Header)
  7716. for k, v := range c.header_ {
  7717. reqHeaders[k] = v
  7718. }
  7719. reqHeaders.Set("User-Agent", c.s.userAgent())
  7720. if c.ifNoneMatch_ != "" {
  7721. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7722. }
  7723. var body io.Reader = nil
  7724. c.urlParams_.Set("alt", alt)
  7725. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/timeSeries")
  7726. urls += "?" + c.urlParams_.Encode()
  7727. req, _ := http.NewRequest("GET", urls, body)
  7728. req.Header = reqHeaders
  7729. googleapi.Expand(req.URL, map[string]string{
  7730. "name": c.name,
  7731. })
  7732. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7733. }
  7734. // Do executes the "monitoring.projects.timeSeries.list" call.
  7735. // Exactly one of *ListTimeSeriesResponse or error will be non-nil. Any
  7736. // non-2xx status code is an error. Response headers are in either
  7737. // *ListTimeSeriesResponse.ServerResponse.Header or (if a response was
  7738. // returned at all) in error.(*googleapi.Error).Header. Use
  7739. // googleapi.IsNotModified to check whether the returned error was
  7740. // because http.StatusNotModified was returned.
  7741. func (c *ProjectsTimeSeriesListCall) Do(opts ...googleapi.CallOption) (*ListTimeSeriesResponse, error) {
  7742. gensupport.SetOptions(c.urlParams_, opts...)
  7743. res, err := c.doRequest("json")
  7744. if res != nil && res.StatusCode == http.StatusNotModified {
  7745. if res.Body != nil {
  7746. res.Body.Close()
  7747. }
  7748. return nil, &googleapi.Error{
  7749. Code: res.StatusCode,
  7750. Header: res.Header,
  7751. }
  7752. }
  7753. if err != nil {
  7754. return nil, err
  7755. }
  7756. defer googleapi.CloseBody(res)
  7757. if err := googleapi.CheckResponse(res); err != nil {
  7758. return nil, err
  7759. }
  7760. ret := &ListTimeSeriesResponse{
  7761. ServerResponse: googleapi.ServerResponse{
  7762. Header: res.Header,
  7763. HTTPStatusCode: res.StatusCode,
  7764. },
  7765. }
  7766. target := &ret
  7767. if err := gensupport.DecodeResponse(target, res); err != nil {
  7768. return nil, err
  7769. }
  7770. return ret, nil
  7771. // {
  7772. // "description": "Lists time series that match a filter. This method does not require a Stackdriver account.",
  7773. // "flatPath": "v3/projects/{projectsId}/timeSeries",
  7774. // "httpMethod": "GET",
  7775. // "id": "monitoring.projects.timeSeries.list",
  7776. // "parameterOrder": [
  7777. // "name"
  7778. // ],
  7779. // "parameters": {
  7780. // "aggregation.alignmentPeriod": {
  7781. // "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.",
  7782. // "format": "google-duration",
  7783. // "location": "query",
  7784. // "type": "string"
  7785. // },
  7786. // "aggregation.crossSeriesReducer": {
  7787. // "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.",
  7788. // "enum": [
  7789. // "REDUCE_NONE",
  7790. // "REDUCE_MEAN",
  7791. // "REDUCE_MIN",
  7792. // "REDUCE_MAX",
  7793. // "REDUCE_SUM",
  7794. // "REDUCE_STDDEV",
  7795. // "REDUCE_COUNT",
  7796. // "REDUCE_COUNT_TRUE",
  7797. // "REDUCE_COUNT_FALSE",
  7798. // "REDUCE_FRACTION_TRUE",
  7799. // "REDUCE_PERCENTILE_99",
  7800. // "REDUCE_PERCENTILE_95",
  7801. // "REDUCE_PERCENTILE_50",
  7802. // "REDUCE_PERCENTILE_05"
  7803. // ],
  7804. // "location": "query",
  7805. // "type": "string"
  7806. // },
  7807. // "aggregation.groupByFields": {
  7808. // "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.",
  7809. // "location": "query",
  7810. // "repeated": true,
  7811. // "type": "string"
  7812. // },
  7813. // "aggregation.perSeriesAligner": {
  7814. // "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.",
  7815. // "enum": [
  7816. // "ALIGN_NONE",
  7817. // "ALIGN_DELTA",
  7818. // "ALIGN_RATE",
  7819. // "ALIGN_INTERPOLATE",
  7820. // "ALIGN_NEXT_OLDER",
  7821. // "ALIGN_MIN",
  7822. // "ALIGN_MAX",
  7823. // "ALIGN_MEAN",
  7824. // "ALIGN_COUNT",
  7825. // "ALIGN_SUM",
  7826. // "ALIGN_STDDEV",
  7827. // "ALIGN_COUNT_TRUE",
  7828. // "ALIGN_COUNT_FALSE",
  7829. // "ALIGN_FRACTION_TRUE",
  7830. // "ALIGN_PERCENTILE_99",
  7831. // "ALIGN_PERCENTILE_95",
  7832. // "ALIGN_PERCENTILE_50",
  7833. // "ALIGN_PERCENTILE_05",
  7834. // "ALIGN_PERCENT_CHANGE"
  7835. // ],
  7836. // "location": "query",
  7837. // "type": "string"
  7838. // },
  7839. // "filter": {
  7840. // "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",
  7841. // "location": "query",
  7842. // "type": "string"
  7843. // },
  7844. // "interval.endTime": {
  7845. // "description": "Required. The end of the time interval.",
  7846. // "format": "google-datetime",
  7847. // "location": "query",
  7848. // "type": "string"
  7849. // },
  7850. // "interval.startTime": {
  7851. // "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.",
  7852. // "format": "google-datetime",
  7853. // "location": "query",
  7854. // "type": "string"
  7855. // },
  7856. // "name": {
  7857. // "description": "The project on which to execute the request. The format is \"projects/{project_id_or_number}\".",
  7858. // "location": "path",
  7859. // "pattern": "^projects/[^/]+$",
  7860. // "required": true,
  7861. // "type": "string"
  7862. // },
  7863. // "orderBy": {
  7864. // "description": "Unsupported: must be left blank. The points in each time series are returned in reverse time order.",
  7865. // "location": "query",
  7866. // "type": "string"
  7867. // },
  7868. // "pageSize": {
  7869. // "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.",
  7870. // "format": "int32",
  7871. // "location": "query",
  7872. // "type": "integer"
  7873. // },
  7874. // "pageToken": {
  7875. // "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.",
  7876. // "location": "query",
  7877. // "type": "string"
  7878. // },
  7879. // "view": {
  7880. // "description": "Specifies which information is returned about the time series.",
  7881. // "enum": [
  7882. // "FULL",
  7883. // "HEADERS"
  7884. // ],
  7885. // "location": "query",
  7886. // "type": "string"
  7887. // }
  7888. // },
  7889. // "path": "v3/{+name}/timeSeries",
  7890. // "response": {
  7891. // "$ref": "ListTimeSeriesResponse"
  7892. // },
  7893. // "scopes": [
  7894. // "https://www.googleapis.com/auth/cloud-platform",
  7895. // "https://www.googleapis.com/auth/monitoring",
  7896. // "https://www.googleapis.com/auth/monitoring.read"
  7897. // ]
  7898. // }
  7899. }
  7900. // Pages invokes f for each page of results.
  7901. // A non-nil error returned from f will halt the iteration.
  7902. // The provided context supersedes any context provided to the Context method.
  7903. func (c *ProjectsTimeSeriesListCall) Pages(ctx context.Context, f func(*ListTimeSeriesResponse) error) error {
  7904. c.ctx_ = ctx
  7905. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7906. for {
  7907. x, err := c.Do()
  7908. if err != nil {
  7909. return err
  7910. }
  7911. if err := f(x); err != nil {
  7912. return err
  7913. }
  7914. if x.NextPageToken == "" {
  7915. return nil
  7916. }
  7917. c.PageToken(x.NextPageToken)
  7918. }
  7919. }
  7920. // method id "monitoring.projects.uptimeCheckConfigs.create":
  7921. type ProjectsUptimeCheckConfigsCreateCall struct {
  7922. s *Service
  7923. parent string
  7924. uptimecheckconfig *UptimeCheckConfig
  7925. urlParams_ gensupport.URLParams
  7926. ctx_ context.Context
  7927. header_ http.Header
  7928. }
  7929. // Create: Creates a new uptime check configuration.
  7930. func (r *ProjectsUptimeCheckConfigsService) Create(parent string, uptimecheckconfig *UptimeCheckConfig) *ProjectsUptimeCheckConfigsCreateCall {
  7931. c := &ProjectsUptimeCheckConfigsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7932. c.parent = parent
  7933. c.uptimecheckconfig = uptimecheckconfig
  7934. return c
  7935. }
  7936. // Fields allows partial responses to be retrieved. See
  7937. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7938. // for more information.
  7939. func (c *ProjectsUptimeCheckConfigsCreateCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsCreateCall {
  7940. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7941. return c
  7942. }
  7943. // Context sets the context to be used in this call's Do method. Any
  7944. // pending HTTP request will be aborted if the provided context is
  7945. // canceled.
  7946. func (c *ProjectsUptimeCheckConfigsCreateCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsCreateCall {
  7947. c.ctx_ = ctx
  7948. return c
  7949. }
  7950. // Header returns an http.Header that can be modified by the caller to
  7951. // add HTTP headers to the request.
  7952. func (c *ProjectsUptimeCheckConfigsCreateCall) Header() http.Header {
  7953. if c.header_ == nil {
  7954. c.header_ = make(http.Header)
  7955. }
  7956. return c.header_
  7957. }
  7958. func (c *ProjectsUptimeCheckConfigsCreateCall) doRequest(alt string) (*http.Response, error) {
  7959. reqHeaders := make(http.Header)
  7960. for k, v := range c.header_ {
  7961. reqHeaders[k] = v
  7962. }
  7963. reqHeaders.Set("User-Agent", c.s.userAgent())
  7964. var body io.Reader = nil
  7965. body, err := googleapi.WithoutDataWrapper.JSONReader(c.uptimecheckconfig)
  7966. if err != nil {
  7967. return nil, err
  7968. }
  7969. reqHeaders.Set("Content-Type", "application/json")
  7970. c.urlParams_.Set("alt", alt)
  7971. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/uptimeCheckConfigs")
  7972. urls += "?" + c.urlParams_.Encode()
  7973. req, _ := http.NewRequest("POST", urls, body)
  7974. req.Header = reqHeaders
  7975. googleapi.Expand(req.URL, map[string]string{
  7976. "parent": c.parent,
  7977. })
  7978. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7979. }
  7980. // Do executes the "monitoring.projects.uptimeCheckConfigs.create" call.
  7981. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  7982. // non-2xx status code is an error. Response headers are in either
  7983. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  7984. // returned at all) in error.(*googleapi.Error).Header. Use
  7985. // googleapi.IsNotModified to check whether the returned error was
  7986. // because http.StatusNotModified was returned.
  7987. func (c *ProjectsUptimeCheckConfigsCreateCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  7988. gensupport.SetOptions(c.urlParams_, opts...)
  7989. res, err := c.doRequest("json")
  7990. if res != nil && res.StatusCode == http.StatusNotModified {
  7991. if res.Body != nil {
  7992. res.Body.Close()
  7993. }
  7994. return nil, &googleapi.Error{
  7995. Code: res.StatusCode,
  7996. Header: res.Header,
  7997. }
  7998. }
  7999. if err != nil {
  8000. return nil, err
  8001. }
  8002. defer googleapi.CloseBody(res)
  8003. if err := googleapi.CheckResponse(res); err != nil {
  8004. return nil, err
  8005. }
  8006. ret := &UptimeCheckConfig{
  8007. ServerResponse: googleapi.ServerResponse{
  8008. Header: res.Header,
  8009. HTTPStatusCode: res.StatusCode,
  8010. },
  8011. }
  8012. target := &ret
  8013. if err := gensupport.DecodeResponse(target, res); err != nil {
  8014. return nil, err
  8015. }
  8016. return ret, nil
  8017. // {
  8018. // "description": "Creates a new uptime check configuration.",
  8019. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs",
  8020. // "httpMethod": "POST",
  8021. // "id": "monitoring.projects.uptimeCheckConfigs.create",
  8022. // "parameterOrder": [
  8023. // "parent"
  8024. // ],
  8025. // "parameters": {
  8026. // "parent": {
  8027. // "description": "The project in which to create the uptime check. The format is projects/[PROJECT_ID].",
  8028. // "location": "path",
  8029. // "pattern": "^projects/[^/]+$",
  8030. // "required": true,
  8031. // "type": "string"
  8032. // }
  8033. // },
  8034. // "path": "v3/{+parent}/uptimeCheckConfigs",
  8035. // "request": {
  8036. // "$ref": "UptimeCheckConfig"
  8037. // },
  8038. // "response": {
  8039. // "$ref": "UptimeCheckConfig"
  8040. // },
  8041. // "scopes": [
  8042. // "https://www.googleapis.com/auth/cloud-platform",
  8043. // "https://www.googleapis.com/auth/monitoring"
  8044. // ]
  8045. // }
  8046. }
  8047. // method id "monitoring.projects.uptimeCheckConfigs.delete":
  8048. type ProjectsUptimeCheckConfigsDeleteCall struct {
  8049. s *Service
  8050. name string
  8051. urlParams_ gensupport.URLParams
  8052. ctx_ context.Context
  8053. header_ http.Header
  8054. }
  8055. // Delete: Deletes an uptime check configuration. Note that this method
  8056. // will fail if the uptime check configuration is referenced by an alert
  8057. // policy or other dependent configs that would be rendered invalid by
  8058. // the deletion.
  8059. func (r *ProjectsUptimeCheckConfigsService) Delete(name string) *ProjectsUptimeCheckConfigsDeleteCall {
  8060. c := &ProjectsUptimeCheckConfigsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8061. c.name = name
  8062. return c
  8063. }
  8064. // Fields allows partial responses to be retrieved. See
  8065. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8066. // for more information.
  8067. func (c *ProjectsUptimeCheckConfigsDeleteCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsDeleteCall {
  8068. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8069. return c
  8070. }
  8071. // Context sets the context to be used in this call's Do method. Any
  8072. // pending HTTP request will be aborted if the provided context is
  8073. // canceled.
  8074. func (c *ProjectsUptimeCheckConfigsDeleteCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsDeleteCall {
  8075. c.ctx_ = ctx
  8076. return c
  8077. }
  8078. // Header returns an http.Header that can be modified by the caller to
  8079. // add HTTP headers to the request.
  8080. func (c *ProjectsUptimeCheckConfigsDeleteCall) Header() http.Header {
  8081. if c.header_ == nil {
  8082. c.header_ = make(http.Header)
  8083. }
  8084. return c.header_
  8085. }
  8086. func (c *ProjectsUptimeCheckConfigsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8087. reqHeaders := make(http.Header)
  8088. for k, v := range c.header_ {
  8089. reqHeaders[k] = v
  8090. }
  8091. reqHeaders.Set("User-Agent", c.s.userAgent())
  8092. var body io.Reader = nil
  8093. c.urlParams_.Set("alt", alt)
  8094. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8095. urls += "?" + c.urlParams_.Encode()
  8096. req, _ := http.NewRequest("DELETE", urls, body)
  8097. req.Header = reqHeaders
  8098. googleapi.Expand(req.URL, map[string]string{
  8099. "name": c.name,
  8100. })
  8101. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8102. }
  8103. // Do executes the "monitoring.projects.uptimeCheckConfigs.delete" call.
  8104. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  8105. // code is an error. Response headers are in either
  8106. // *Empty.ServerResponse.Header or (if a response was returned at all)
  8107. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8108. // check whether the returned error was because http.StatusNotModified
  8109. // was returned.
  8110. func (c *ProjectsUptimeCheckConfigsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  8111. gensupport.SetOptions(c.urlParams_, opts...)
  8112. res, err := c.doRequest("json")
  8113. if res != nil && res.StatusCode == http.StatusNotModified {
  8114. if res.Body != nil {
  8115. res.Body.Close()
  8116. }
  8117. return nil, &googleapi.Error{
  8118. Code: res.StatusCode,
  8119. Header: res.Header,
  8120. }
  8121. }
  8122. if err != nil {
  8123. return nil, err
  8124. }
  8125. defer googleapi.CloseBody(res)
  8126. if err := googleapi.CheckResponse(res); err != nil {
  8127. return nil, err
  8128. }
  8129. ret := &Empty{
  8130. ServerResponse: googleapi.ServerResponse{
  8131. Header: res.Header,
  8132. HTTPStatusCode: res.StatusCode,
  8133. },
  8134. }
  8135. target := &ret
  8136. if err := gensupport.DecodeResponse(target, res); err != nil {
  8137. return nil, err
  8138. }
  8139. return ret, nil
  8140. // {
  8141. // "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.",
  8142. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  8143. // "httpMethod": "DELETE",
  8144. // "id": "monitoring.projects.uptimeCheckConfigs.delete",
  8145. // "parameterOrder": [
  8146. // "name"
  8147. // ],
  8148. // "parameters": {
  8149. // "name": {
  8150. // "description": "The uptime check configuration to delete. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].",
  8151. // "location": "path",
  8152. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  8153. // "required": true,
  8154. // "type": "string"
  8155. // }
  8156. // },
  8157. // "path": "v3/{+name}",
  8158. // "response": {
  8159. // "$ref": "Empty"
  8160. // },
  8161. // "scopes": [
  8162. // "https://www.googleapis.com/auth/cloud-platform",
  8163. // "https://www.googleapis.com/auth/monitoring"
  8164. // ]
  8165. // }
  8166. }
  8167. // method id "monitoring.projects.uptimeCheckConfigs.get":
  8168. type ProjectsUptimeCheckConfigsGetCall struct {
  8169. s *Service
  8170. name string
  8171. urlParams_ gensupport.URLParams
  8172. ifNoneMatch_ string
  8173. ctx_ context.Context
  8174. header_ http.Header
  8175. }
  8176. // Get: Gets a single uptime check configuration.
  8177. func (r *ProjectsUptimeCheckConfigsService) Get(name string) *ProjectsUptimeCheckConfigsGetCall {
  8178. c := &ProjectsUptimeCheckConfigsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8179. c.name = name
  8180. return c
  8181. }
  8182. // Fields allows partial responses to be retrieved. See
  8183. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8184. // for more information.
  8185. func (c *ProjectsUptimeCheckConfigsGetCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsGetCall {
  8186. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8187. return c
  8188. }
  8189. // IfNoneMatch sets the optional parameter which makes the operation
  8190. // fail if the object's ETag matches the given value. This is useful for
  8191. // getting updates only after the object has changed since the last
  8192. // request. Use googleapi.IsNotModified to check whether the response
  8193. // error from Do is the result of In-None-Match.
  8194. func (c *ProjectsUptimeCheckConfigsGetCall) IfNoneMatch(entityTag string) *ProjectsUptimeCheckConfigsGetCall {
  8195. c.ifNoneMatch_ = entityTag
  8196. return c
  8197. }
  8198. // Context sets the context to be used in this call's Do method. Any
  8199. // pending HTTP request will be aborted if the provided context is
  8200. // canceled.
  8201. func (c *ProjectsUptimeCheckConfigsGetCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsGetCall {
  8202. c.ctx_ = ctx
  8203. return c
  8204. }
  8205. // Header returns an http.Header that can be modified by the caller to
  8206. // add HTTP headers to the request.
  8207. func (c *ProjectsUptimeCheckConfigsGetCall) Header() http.Header {
  8208. if c.header_ == nil {
  8209. c.header_ = make(http.Header)
  8210. }
  8211. return c.header_
  8212. }
  8213. func (c *ProjectsUptimeCheckConfigsGetCall) doRequest(alt string) (*http.Response, error) {
  8214. reqHeaders := make(http.Header)
  8215. for k, v := range c.header_ {
  8216. reqHeaders[k] = v
  8217. }
  8218. reqHeaders.Set("User-Agent", c.s.userAgent())
  8219. if c.ifNoneMatch_ != "" {
  8220. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8221. }
  8222. var body io.Reader = nil
  8223. c.urlParams_.Set("alt", alt)
  8224. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8225. urls += "?" + c.urlParams_.Encode()
  8226. req, _ := http.NewRequest("GET", urls, body)
  8227. req.Header = reqHeaders
  8228. googleapi.Expand(req.URL, map[string]string{
  8229. "name": c.name,
  8230. })
  8231. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8232. }
  8233. // Do executes the "monitoring.projects.uptimeCheckConfigs.get" call.
  8234. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  8235. // non-2xx status code is an error. Response headers are in either
  8236. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  8237. // returned at all) in error.(*googleapi.Error).Header. Use
  8238. // googleapi.IsNotModified to check whether the returned error was
  8239. // because http.StatusNotModified was returned.
  8240. func (c *ProjectsUptimeCheckConfigsGetCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  8241. gensupport.SetOptions(c.urlParams_, opts...)
  8242. res, err := c.doRequest("json")
  8243. if res != nil && res.StatusCode == http.StatusNotModified {
  8244. if res.Body != nil {
  8245. res.Body.Close()
  8246. }
  8247. return nil, &googleapi.Error{
  8248. Code: res.StatusCode,
  8249. Header: res.Header,
  8250. }
  8251. }
  8252. if err != nil {
  8253. return nil, err
  8254. }
  8255. defer googleapi.CloseBody(res)
  8256. if err := googleapi.CheckResponse(res); err != nil {
  8257. return nil, err
  8258. }
  8259. ret := &UptimeCheckConfig{
  8260. ServerResponse: googleapi.ServerResponse{
  8261. Header: res.Header,
  8262. HTTPStatusCode: res.StatusCode,
  8263. },
  8264. }
  8265. target := &ret
  8266. if err := gensupport.DecodeResponse(target, res); err != nil {
  8267. return nil, err
  8268. }
  8269. return ret, nil
  8270. // {
  8271. // "description": "Gets a single uptime check configuration.",
  8272. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  8273. // "httpMethod": "GET",
  8274. // "id": "monitoring.projects.uptimeCheckConfigs.get",
  8275. // "parameterOrder": [
  8276. // "name"
  8277. // ],
  8278. // "parameters": {
  8279. // "name": {
  8280. // "description": "The uptime check configuration to retrieve. The format is projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].",
  8281. // "location": "path",
  8282. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  8283. // "required": true,
  8284. // "type": "string"
  8285. // }
  8286. // },
  8287. // "path": "v3/{+name}",
  8288. // "response": {
  8289. // "$ref": "UptimeCheckConfig"
  8290. // },
  8291. // "scopes": [
  8292. // "https://www.googleapis.com/auth/cloud-platform",
  8293. // "https://www.googleapis.com/auth/monitoring",
  8294. // "https://www.googleapis.com/auth/monitoring.read"
  8295. // ]
  8296. // }
  8297. }
  8298. // method id "monitoring.projects.uptimeCheckConfigs.list":
  8299. type ProjectsUptimeCheckConfigsListCall struct {
  8300. s *Service
  8301. parent string
  8302. urlParams_ gensupport.URLParams
  8303. ifNoneMatch_ string
  8304. ctx_ context.Context
  8305. header_ http.Header
  8306. }
  8307. // List: Lists the existing valid uptime check configurations for the
  8308. // project, leaving out any invalid configurations.
  8309. func (r *ProjectsUptimeCheckConfigsService) List(parent string) *ProjectsUptimeCheckConfigsListCall {
  8310. c := &ProjectsUptimeCheckConfigsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8311. c.parent = parent
  8312. return c
  8313. }
  8314. // PageSize sets the optional parameter "pageSize": The maximum number
  8315. // of results to return in a single response. The server may further
  8316. // constrain the maximum number of results returned in a single page. If
  8317. // the page_size is <=0, the server will decide the number of results to
  8318. // be returned.
  8319. func (c *ProjectsUptimeCheckConfigsListCall) PageSize(pageSize int64) *ProjectsUptimeCheckConfigsListCall {
  8320. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8321. return c
  8322. }
  8323. // PageToken sets the optional parameter "pageToken": If this field is
  8324. // not empty then it must contain the nextPageToken value returned by a
  8325. // previous call to this method. Using this field causes the method to
  8326. // return more results from the previous method call.
  8327. func (c *ProjectsUptimeCheckConfigsListCall) PageToken(pageToken string) *ProjectsUptimeCheckConfigsListCall {
  8328. c.urlParams_.Set("pageToken", pageToken)
  8329. return c
  8330. }
  8331. // Fields allows partial responses to be retrieved. See
  8332. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8333. // for more information.
  8334. func (c *ProjectsUptimeCheckConfigsListCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsListCall {
  8335. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8336. return c
  8337. }
  8338. // IfNoneMatch sets the optional parameter which makes the operation
  8339. // fail if the object's ETag matches the given value. This is useful for
  8340. // getting updates only after the object has changed since the last
  8341. // request. Use googleapi.IsNotModified to check whether the response
  8342. // error from Do is the result of In-None-Match.
  8343. func (c *ProjectsUptimeCheckConfigsListCall) IfNoneMatch(entityTag string) *ProjectsUptimeCheckConfigsListCall {
  8344. c.ifNoneMatch_ = entityTag
  8345. return c
  8346. }
  8347. // Context sets the context to be used in this call's Do method. Any
  8348. // pending HTTP request will be aborted if the provided context is
  8349. // canceled.
  8350. func (c *ProjectsUptimeCheckConfigsListCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsListCall {
  8351. c.ctx_ = ctx
  8352. return c
  8353. }
  8354. // Header returns an http.Header that can be modified by the caller to
  8355. // add HTTP headers to the request.
  8356. func (c *ProjectsUptimeCheckConfigsListCall) Header() http.Header {
  8357. if c.header_ == nil {
  8358. c.header_ = make(http.Header)
  8359. }
  8360. return c.header_
  8361. }
  8362. func (c *ProjectsUptimeCheckConfigsListCall) doRequest(alt string) (*http.Response, error) {
  8363. reqHeaders := make(http.Header)
  8364. for k, v := range c.header_ {
  8365. reqHeaders[k] = v
  8366. }
  8367. reqHeaders.Set("User-Agent", c.s.userAgent())
  8368. if c.ifNoneMatch_ != "" {
  8369. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8370. }
  8371. var body io.Reader = nil
  8372. c.urlParams_.Set("alt", alt)
  8373. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/uptimeCheckConfigs")
  8374. urls += "?" + c.urlParams_.Encode()
  8375. req, _ := http.NewRequest("GET", urls, body)
  8376. req.Header = reqHeaders
  8377. googleapi.Expand(req.URL, map[string]string{
  8378. "parent": c.parent,
  8379. })
  8380. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8381. }
  8382. // Do executes the "monitoring.projects.uptimeCheckConfigs.list" call.
  8383. // Exactly one of *ListUptimeCheckConfigsResponse or error will be
  8384. // non-nil. Any non-2xx status code is an error. Response headers are in
  8385. // either *ListUptimeCheckConfigsResponse.ServerResponse.Header or (if a
  8386. // response was returned at all) in error.(*googleapi.Error).Header. Use
  8387. // googleapi.IsNotModified to check whether the returned error was
  8388. // because http.StatusNotModified was returned.
  8389. func (c *ProjectsUptimeCheckConfigsListCall) Do(opts ...googleapi.CallOption) (*ListUptimeCheckConfigsResponse, error) {
  8390. gensupport.SetOptions(c.urlParams_, opts...)
  8391. res, err := c.doRequest("json")
  8392. if res != nil && res.StatusCode == http.StatusNotModified {
  8393. if res.Body != nil {
  8394. res.Body.Close()
  8395. }
  8396. return nil, &googleapi.Error{
  8397. Code: res.StatusCode,
  8398. Header: res.Header,
  8399. }
  8400. }
  8401. if err != nil {
  8402. return nil, err
  8403. }
  8404. defer googleapi.CloseBody(res)
  8405. if err := googleapi.CheckResponse(res); err != nil {
  8406. return nil, err
  8407. }
  8408. ret := &ListUptimeCheckConfigsResponse{
  8409. ServerResponse: googleapi.ServerResponse{
  8410. Header: res.Header,
  8411. HTTPStatusCode: res.StatusCode,
  8412. },
  8413. }
  8414. target := &ret
  8415. if err := gensupport.DecodeResponse(target, res); err != nil {
  8416. return nil, err
  8417. }
  8418. return ret, nil
  8419. // {
  8420. // "description": "Lists the existing valid uptime check configurations for the project, leaving out any invalid configurations.",
  8421. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs",
  8422. // "httpMethod": "GET",
  8423. // "id": "monitoring.projects.uptimeCheckConfigs.list",
  8424. // "parameterOrder": [
  8425. // "parent"
  8426. // ],
  8427. // "parameters": {
  8428. // "pageSize": {
  8429. // "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.",
  8430. // "format": "int32",
  8431. // "location": "query",
  8432. // "type": "integer"
  8433. // },
  8434. // "pageToken": {
  8435. // "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.",
  8436. // "location": "query",
  8437. // "type": "string"
  8438. // },
  8439. // "parent": {
  8440. // "description": "The project whose uptime check configurations are listed. 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. // "response": {
  8449. // "$ref": "ListUptimeCheckConfigsResponse"
  8450. // },
  8451. // "scopes": [
  8452. // "https://www.googleapis.com/auth/cloud-platform",
  8453. // "https://www.googleapis.com/auth/monitoring",
  8454. // "https://www.googleapis.com/auth/monitoring.read"
  8455. // ]
  8456. // }
  8457. }
  8458. // Pages invokes f for each page of results.
  8459. // A non-nil error returned from f will halt the iteration.
  8460. // The provided context supersedes any context provided to the Context method.
  8461. func (c *ProjectsUptimeCheckConfigsListCall) Pages(ctx context.Context, f func(*ListUptimeCheckConfigsResponse) error) error {
  8462. c.ctx_ = ctx
  8463. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8464. for {
  8465. x, err := c.Do()
  8466. if err != nil {
  8467. return err
  8468. }
  8469. if err := f(x); err != nil {
  8470. return err
  8471. }
  8472. if x.NextPageToken == "" {
  8473. return nil
  8474. }
  8475. c.PageToken(x.NextPageToken)
  8476. }
  8477. }
  8478. // method id "monitoring.projects.uptimeCheckConfigs.patch":
  8479. type ProjectsUptimeCheckConfigsPatchCall struct {
  8480. s *Service
  8481. name string
  8482. uptimecheckconfig *UptimeCheckConfig
  8483. urlParams_ gensupport.URLParams
  8484. ctx_ context.Context
  8485. header_ http.Header
  8486. }
  8487. // Patch: Updates an uptime check configuration. You can either replace
  8488. // the entire configuration with a new one or replace only certain
  8489. // fields in the current configuration by specifying the fields to be
  8490. // updated via "updateMask". Returns the updated configuration.
  8491. func (r *ProjectsUptimeCheckConfigsService) Patch(name string, uptimecheckconfig *UptimeCheckConfig) *ProjectsUptimeCheckConfigsPatchCall {
  8492. c := &ProjectsUptimeCheckConfigsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8493. c.name = name
  8494. c.uptimecheckconfig = uptimecheckconfig
  8495. return c
  8496. }
  8497. // UpdateMask sets the optional parameter "updateMask": If present, only
  8498. // the listed fields in the current uptime check configuration are
  8499. // updated with values from the new configuration. If this field is
  8500. // empty, then the current configuration is completely replaced with the
  8501. // new configuration.
  8502. func (c *ProjectsUptimeCheckConfigsPatchCall) UpdateMask(updateMask string) *ProjectsUptimeCheckConfigsPatchCall {
  8503. c.urlParams_.Set("updateMask", updateMask)
  8504. return c
  8505. }
  8506. // Fields allows partial responses to be retrieved. See
  8507. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8508. // for more information.
  8509. func (c *ProjectsUptimeCheckConfigsPatchCall) Fields(s ...googleapi.Field) *ProjectsUptimeCheckConfigsPatchCall {
  8510. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8511. return c
  8512. }
  8513. // Context sets the context to be used in this call's Do method. Any
  8514. // pending HTTP request will be aborted if the provided context is
  8515. // canceled.
  8516. func (c *ProjectsUptimeCheckConfigsPatchCall) Context(ctx context.Context) *ProjectsUptimeCheckConfigsPatchCall {
  8517. c.ctx_ = ctx
  8518. return c
  8519. }
  8520. // Header returns an http.Header that can be modified by the caller to
  8521. // add HTTP headers to the request.
  8522. func (c *ProjectsUptimeCheckConfigsPatchCall) Header() http.Header {
  8523. if c.header_ == nil {
  8524. c.header_ = make(http.Header)
  8525. }
  8526. return c.header_
  8527. }
  8528. func (c *ProjectsUptimeCheckConfigsPatchCall) doRequest(alt string) (*http.Response, error) {
  8529. reqHeaders := make(http.Header)
  8530. for k, v := range c.header_ {
  8531. reqHeaders[k] = v
  8532. }
  8533. reqHeaders.Set("User-Agent", c.s.userAgent())
  8534. var body io.Reader = nil
  8535. body, err := googleapi.WithoutDataWrapper.JSONReader(c.uptimecheckconfig)
  8536. if err != nil {
  8537. return nil, err
  8538. }
  8539. reqHeaders.Set("Content-Type", "application/json")
  8540. c.urlParams_.Set("alt", alt)
  8541. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
  8542. urls += "?" + c.urlParams_.Encode()
  8543. req, _ := http.NewRequest("PATCH", urls, body)
  8544. req.Header = reqHeaders
  8545. googleapi.Expand(req.URL, map[string]string{
  8546. "name": c.name,
  8547. })
  8548. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8549. }
  8550. // Do executes the "monitoring.projects.uptimeCheckConfigs.patch" call.
  8551. // Exactly one of *UptimeCheckConfig or error will be non-nil. Any
  8552. // non-2xx status code is an error. Response headers are in either
  8553. // *UptimeCheckConfig.ServerResponse.Header or (if a response was
  8554. // returned at all) in error.(*googleapi.Error).Header. Use
  8555. // googleapi.IsNotModified to check whether the returned error was
  8556. // because http.StatusNotModified was returned.
  8557. func (c *ProjectsUptimeCheckConfigsPatchCall) Do(opts ...googleapi.CallOption) (*UptimeCheckConfig, error) {
  8558. gensupport.SetOptions(c.urlParams_, opts...)
  8559. res, err := c.doRequest("json")
  8560. if res != nil && res.StatusCode == http.StatusNotModified {
  8561. if res.Body != nil {
  8562. res.Body.Close()
  8563. }
  8564. return nil, &googleapi.Error{
  8565. Code: res.StatusCode,
  8566. Header: res.Header,
  8567. }
  8568. }
  8569. if err != nil {
  8570. return nil, err
  8571. }
  8572. defer googleapi.CloseBody(res)
  8573. if err := googleapi.CheckResponse(res); err != nil {
  8574. return nil, err
  8575. }
  8576. ret := &UptimeCheckConfig{
  8577. ServerResponse: googleapi.ServerResponse{
  8578. Header: res.Header,
  8579. HTTPStatusCode: res.StatusCode,
  8580. },
  8581. }
  8582. target := &ret
  8583. if err := gensupport.DecodeResponse(target, res); err != nil {
  8584. return nil, err
  8585. }
  8586. return ret, nil
  8587. // {
  8588. // "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.",
  8589. // "flatPath": "v3/projects/{projectsId}/uptimeCheckConfigs/{uptimeCheckConfigsId}",
  8590. // "httpMethod": "PATCH",
  8591. // "id": "monitoring.projects.uptimeCheckConfigs.patch",
  8592. // "parameterOrder": [
  8593. // "name"
  8594. // ],
  8595. // "parameters": {
  8596. // "name": {
  8597. // "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.",
  8598. // "location": "path",
  8599. // "pattern": "^projects/[^/]+/uptimeCheckConfigs/[^/]+$",
  8600. // "required": true,
  8601. // "type": "string"
  8602. // },
  8603. // "updateMask": {
  8604. // "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.",
  8605. // "format": "google-fieldmask",
  8606. // "location": "query",
  8607. // "type": "string"
  8608. // }
  8609. // },
  8610. // "path": "v3/{+name}",
  8611. // "request": {
  8612. // "$ref": "UptimeCheckConfig"
  8613. // },
  8614. // "response": {
  8615. // "$ref": "UptimeCheckConfig"
  8616. // },
  8617. // "scopes": [
  8618. // "https://www.googleapis.com/auth/cloud-platform",
  8619. // "https://www.googleapis.com/auth/monitoring"
  8620. // ]
  8621. // }
  8622. }
  8623. // method id "monitoring.uptimeCheckIps.list":
  8624. type UptimeCheckIpsListCall struct {
  8625. s *Service
  8626. urlParams_ gensupport.URLParams
  8627. ifNoneMatch_ string
  8628. ctx_ context.Context
  8629. header_ http.Header
  8630. }
  8631. // List: Returns the list of IPs that checkers run from
  8632. func (r *UptimeCheckIpsService) List() *UptimeCheckIpsListCall {
  8633. c := &UptimeCheckIpsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8634. return c
  8635. }
  8636. // PageSize sets the optional parameter "pageSize": The maximum number
  8637. // of results to return in a single response. The server may further
  8638. // constrain the maximum number of results returned in a single page. If
  8639. // the page_size is <=0, the server will decide the number of results to
  8640. // be returned. NOTE: this field is not yet implemented
  8641. func (c *UptimeCheckIpsListCall) PageSize(pageSize int64) *UptimeCheckIpsListCall {
  8642. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  8643. return c
  8644. }
  8645. // PageToken sets the optional parameter "pageToken": If this field is
  8646. // not empty then it must contain the nextPageToken value returned by a
  8647. // previous call to this method. Using this field causes the method to
  8648. // return more results from the previous method call. NOTE: this field
  8649. // is not yet implemented
  8650. func (c *UptimeCheckIpsListCall) PageToken(pageToken string) *UptimeCheckIpsListCall {
  8651. c.urlParams_.Set("pageToken", pageToken)
  8652. return c
  8653. }
  8654. // Fields allows partial responses to be retrieved. See
  8655. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8656. // for more information.
  8657. func (c *UptimeCheckIpsListCall) Fields(s ...googleapi.Field) *UptimeCheckIpsListCall {
  8658. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8659. return c
  8660. }
  8661. // IfNoneMatch sets the optional parameter which makes the operation
  8662. // fail if the object's ETag matches the given value. This is useful for
  8663. // getting updates only after the object has changed since the last
  8664. // request. Use googleapi.IsNotModified to check whether the response
  8665. // error from Do is the result of In-None-Match.
  8666. func (c *UptimeCheckIpsListCall) IfNoneMatch(entityTag string) *UptimeCheckIpsListCall {
  8667. c.ifNoneMatch_ = entityTag
  8668. return c
  8669. }
  8670. // Context sets the context to be used in this call's Do method. Any
  8671. // pending HTTP request will be aborted if the provided context is
  8672. // canceled.
  8673. func (c *UptimeCheckIpsListCall) Context(ctx context.Context) *UptimeCheckIpsListCall {
  8674. c.ctx_ = ctx
  8675. return c
  8676. }
  8677. // Header returns an http.Header that can be modified by the caller to
  8678. // add HTTP headers to the request.
  8679. func (c *UptimeCheckIpsListCall) Header() http.Header {
  8680. if c.header_ == nil {
  8681. c.header_ = make(http.Header)
  8682. }
  8683. return c.header_
  8684. }
  8685. func (c *UptimeCheckIpsListCall) doRequest(alt string) (*http.Response, error) {
  8686. reqHeaders := make(http.Header)
  8687. for k, v := range c.header_ {
  8688. reqHeaders[k] = v
  8689. }
  8690. reqHeaders.Set("User-Agent", c.s.userAgent())
  8691. if c.ifNoneMatch_ != "" {
  8692. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8693. }
  8694. var body io.Reader = nil
  8695. c.urlParams_.Set("alt", alt)
  8696. urls := googleapi.ResolveRelative(c.s.BasePath, "v3/uptimeCheckIps")
  8697. urls += "?" + c.urlParams_.Encode()
  8698. req, _ := http.NewRequest("GET", urls, body)
  8699. req.Header = reqHeaders
  8700. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8701. }
  8702. // Do executes the "monitoring.uptimeCheckIps.list" call.
  8703. // Exactly one of *ListUptimeCheckIpsResponse or error will be non-nil.
  8704. // Any non-2xx status code is an error. Response headers are in either
  8705. // *ListUptimeCheckIpsResponse.ServerResponse.Header or (if a response
  8706. // was returned at all) in error.(*googleapi.Error).Header. Use
  8707. // googleapi.IsNotModified to check whether the returned error was
  8708. // because http.StatusNotModified was returned.
  8709. func (c *UptimeCheckIpsListCall) Do(opts ...googleapi.CallOption) (*ListUptimeCheckIpsResponse, error) {
  8710. gensupport.SetOptions(c.urlParams_, opts...)
  8711. res, err := c.doRequest("json")
  8712. if res != nil && res.StatusCode == http.StatusNotModified {
  8713. if res.Body != nil {
  8714. res.Body.Close()
  8715. }
  8716. return nil, &googleapi.Error{
  8717. Code: res.StatusCode,
  8718. Header: res.Header,
  8719. }
  8720. }
  8721. if err != nil {
  8722. return nil, err
  8723. }
  8724. defer googleapi.CloseBody(res)
  8725. if err := googleapi.CheckResponse(res); err != nil {
  8726. return nil, err
  8727. }
  8728. ret := &ListUptimeCheckIpsResponse{
  8729. ServerResponse: googleapi.ServerResponse{
  8730. Header: res.Header,
  8731. HTTPStatusCode: res.StatusCode,
  8732. },
  8733. }
  8734. target := &ret
  8735. if err := gensupport.DecodeResponse(target, res); err != nil {
  8736. return nil, err
  8737. }
  8738. return ret, nil
  8739. // {
  8740. // "description": "Returns the list of IPs that checkers run from",
  8741. // "flatPath": "v3/uptimeCheckIps",
  8742. // "httpMethod": "GET",
  8743. // "id": "monitoring.uptimeCheckIps.list",
  8744. // "parameterOrder": [],
  8745. // "parameters": {
  8746. // "pageSize": {
  8747. // "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",
  8748. // "format": "int32",
  8749. // "location": "query",
  8750. // "type": "integer"
  8751. // },
  8752. // "pageToken": {
  8753. // "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",
  8754. // "location": "query",
  8755. // "type": "string"
  8756. // }
  8757. // },
  8758. // "path": "v3/uptimeCheckIps",
  8759. // "response": {
  8760. // "$ref": "ListUptimeCheckIpsResponse"
  8761. // },
  8762. // "scopes": [
  8763. // "https://www.googleapis.com/auth/cloud-platform",
  8764. // "https://www.googleapis.com/auth/monitoring",
  8765. // "https://www.googleapis.com/auth/monitoring.read"
  8766. // ]
  8767. // }
  8768. }
  8769. // Pages invokes f for each page of results.
  8770. // A non-nil error returned from f will halt the iteration.
  8771. // The provided context supersedes any context provided to the Context method.
  8772. func (c *UptimeCheckIpsListCall) Pages(ctx context.Context, f func(*ListUptimeCheckIpsResponse) error) error {
  8773. c.ctx_ = ctx
  8774. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8775. for {
  8776. x, err := c.Do()
  8777. if err != nil {
  8778. return err
  8779. }
  8780. if err := f(x); err != nil {
  8781. return err
  8782. }
  8783. if x.NextPageToken == "" {
  8784. return nil
  8785. }
  8786. c.PageToken(x.NextPageToken)
  8787. }
  8788. }