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

2528 lines
90 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package alertcenter provides access to the G Suite Alert Center API.
  6. //
  7. // For product documentation, see: https://developers.google.com/admin-sdk/alertcenter/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/alertcenter/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // alertcenterService, err := alertcenter.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // alertcenterService, err := alertcenter.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // alertcenterService, err := alertcenter.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package alertcenter // import "google.golang.org/api/alertcenter/v1beta1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "alertcenter:v1beta1"
  67. const apiName = "alertcenter"
  68. const apiVersion = "v1beta1"
  69. const basePath = "https://alertcenter.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // See and delete your domain's G Suite alerts, and send alert feedback
  73. AppsAlertsScope = "https://www.googleapis.com/auth/apps.alerts"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/apps.alerts",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Alerts = NewAlertsService(s)
  106. s.V1beta1 = NewV1beta1Service(s)
  107. return s, nil
  108. }
  109. type Service struct {
  110. client *http.Client
  111. BasePath string // API endpoint base URL
  112. UserAgent string // optional additional User-Agent fragment
  113. Alerts *AlertsService
  114. V1beta1 *V1beta1Service
  115. }
  116. func (s *Service) userAgent() string {
  117. if s.UserAgent == "" {
  118. return googleapi.UserAgent
  119. }
  120. return googleapi.UserAgent + " " + s.UserAgent
  121. }
  122. func NewAlertsService(s *Service) *AlertsService {
  123. rs := &AlertsService{s: s}
  124. rs.Feedback = NewAlertsFeedbackService(s)
  125. return rs
  126. }
  127. type AlertsService struct {
  128. s *Service
  129. Feedback *AlertsFeedbackService
  130. }
  131. func NewAlertsFeedbackService(s *Service) *AlertsFeedbackService {
  132. rs := &AlertsFeedbackService{s: s}
  133. return rs
  134. }
  135. type AlertsFeedbackService struct {
  136. s *Service
  137. }
  138. func NewV1beta1Service(s *Service) *V1beta1Service {
  139. rs := &V1beta1Service{s: s}
  140. return rs
  141. }
  142. type V1beta1Service struct {
  143. s *Service
  144. }
  145. // AccountWarning: Alerts for user account warning events.
  146. type AccountWarning struct {
  147. // Email: Required. The email of the user that this event belongs to.
  148. Email string `json:"email,omitempty"`
  149. // LoginDetails: Optional. Details of the login action associated with
  150. // the warning event.
  151. // This is only available for:
  152. //
  153. // * Suspicious login
  154. // * Suspicious login (less secure app)
  155. // * Suspicious programmatic login
  156. // * User suspended (suspicious activity)
  157. LoginDetails *LoginDetails `json:"loginDetails,omitempty"`
  158. // ForceSendFields is a list of field names (e.g. "Email") to
  159. // unconditionally include in API requests. By default, fields with
  160. // empty values are omitted from API requests. However, any non-pointer,
  161. // non-interface field appearing in ForceSendFields will be sent to the
  162. // server regardless of whether the field is empty or not. This may be
  163. // used to include empty fields in Patch requests.
  164. ForceSendFields []string `json:"-"`
  165. // NullFields is a list of field names (e.g. "Email") to include in API
  166. // requests with the JSON null value. By default, fields with empty
  167. // values are omitted from API requests. However, any field with an
  168. // empty value appearing in NullFields will be sent to the server as
  169. // null. It is an error if a field in this list has a non-empty value.
  170. // This may be used to include null fields in Patch requests.
  171. NullFields []string `json:"-"`
  172. }
  173. func (s *AccountWarning) MarshalJSON() ([]byte, error) {
  174. type NoMethod AccountWarning
  175. raw := NoMethod(*s)
  176. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  177. }
  178. // Alert: An alert affecting a customer.
  179. type Alert struct {
  180. // AlertId: Output only. The unique identifier for the alert.
  181. AlertId string `json:"alertId,omitempty"`
  182. // CreateTime: Output only. The time this alert was created.
  183. CreateTime string `json:"createTime,omitempty"`
  184. // CustomerId: Output only. The unique identifier of the Google account
  185. // of the customer.
  186. CustomerId string `json:"customerId,omitempty"`
  187. // Data: Optional. The data associated with this alert, for
  188. // example
  189. // google.apps.alertcenter.type.DeviceCompromised.
  190. Data googleapi.RawMessage `json:"data,omitempty"`
  191. // Deleted: Output only. `True` if this alert is marked for deletion.
  192. Deleted bool `json:"deleted,omitempty"`
  193. // EndTime: Optional. The time the event that caused this alert ceased
  194. // being active.
  195. // If provided, the end time must not be earlier than the start time.
  196. // If not provided, it indicates an ongoing alert.
  197. EndTime string `json:"endTime,omitempty"`
  198. // SecurityInvestigationToolLink: Output only. An optional
  199. // [Security Investigation
  200. // Tool](https://support.google.com/a/answer/7575955)
  201. // query for this alert.
  202. SecurityInvestigationToolLink string `json:"securityInvestigationToolLink,omitempty"`
  203. // Source: Required. A unique identifier for the system that reported
  204. // the alert.
  205. // This is output only after alert is created.
  206. //
  207. // Supported sources are any of the following:
  208. //
  209. // * Google Operations
  210. // * Mobile device management
  211. // * Gmail phishing
  212. // * Domain wide takeout
  213. // * Government attack warning
  214. // * Google identity
  215. Source string `json:"source,omitempty"`
  216. // StartTime: Required. The time the event that caused this alert was
  217. // started or
  218. // detected.
  219. StartTime string `json:"startTime,omitempty"`
  220. // Type: Required. The type of the alert.
  221. // This is output only after alert is created.
  222. // For a list of available alert types see
  223. // [G Suite Alert types](/admin-sdk/alertcenter/reference/alert-types).
  224. Type string `json:"type,omitempty"`
  225. // ServerResponse contains the HTTP response code and headers from the
  226. // server.
  227. googleapi.ServerResponse `json:"-"`
  228. // ForceSendFields is a list of field names (e.g. "AlertId") to
  229. // unconditionally include in API requests. By default, fields with
  230. // empty values are omitted from API requests. However, any non-pointer,
  231. // non-interface field appearing in ForceSendFields will be sent to the
  232. // server regardless of whether the field is empty or not. This may be
  233. // used to include empty fields in Patch requests.
  234. ForceSendFields []string `json:"-"`
  235. // NullFields is a list of field names (e.g. "AlertId") to include in
  236. // API requests with the JSON null value. By default, fields with empty
  237. // values are omitted from API requests. However, any field with an
  238. // empty value appearing in NullFields will be sent to the server as
  239. // null. It is an error if a field in this list has a non-empty value.
  240. // This may be used to include null fields in Patch requests.
  241. NullFields []string `json:"-"`
  242. }
  243. func (s *Alert) MarshalJSON() ([]byte, error) {
  244. type NoMethod Alert
  245. raw := NoMethod(*s)
  246. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  247. }
  248. // AlertFeedback: A customer feedback about an alert.
  249. type AlertFeedback struct {
  250. // AlertId: Output only. The alert identifier.
  251. AlertId string `json:"alertId,omitempty"`
  252. // CreateTime: Output only. The time this feedback was created.
  253. CreateTime string `json:"createTime,omitempty"`
  254. // CustomerId: Output only. The unique identifier of the Google account
  255. // of the customer.
  256. CustomerId string `json:"customerId,omitempty"`
  257. // Email: Output only. The email of the user that provided the feedback.
  258. Email string `json:"email,omitempty"`
  259. // FeedbackId: Output only. The unique identifier for the feedback.
  260. FeedbackId string `json:"feedbackId,omitempty"`
  261. // Type: Required. The type of the feedback.
  262. //
  263. // Possible values:
  264. // "ALERT_FEEDBACK_TYPE_UNSPECIFIED" - The feedback type is not
  265. // specified.
  266. // "NOT_USEFUL" - The alert report is not useful.
  267. // "SOMEWHAT_USEFUL" - The alert report is somewhat useful.
  268. // "VERY_USEFUL" - The alert report is very useful.
  269. Type string `json:"type,omitempty"`
  270. // ServerResponse contains the HTTP response code and headers from the
  271. // server.
  272. googleapi.ServerResponse `json:"-"`
  273. // ForceSendFields is a list of field names (e.g. "AlertId") to
  274. // unconditionally include in API requests. By default, fields with
  275. // empty values are omitted from API requests. However, any non-pointer,
  276. // non-interface field appearing in ForceSendFields will be sent to the
  277. // server regardless of whether the field is empty or not. This may be
  278. // used to include empty fields in Patch requests.
  279. ForceSendFields []string `json:"-"`
  280. // NullFields is a list of field names (e.g. "AlertId") to include in
  281. // API requests with the JSON null value. By default, fields with empty
  282. // values are omitted from API requests. However, any field with an
  283. // empty value appearing in NullFields will be sent to the server as
  284. // null. It is an error if a field in this list has a non-empty value.
  285. // This may be used to include null fields in Patch requests.
  286. NullFields []string `json:"-"`
  287. }
  288. func (s *AlertFeedback) MarshalJSON() ([]byte, error) {
  289. type NoMethod AlertFeedback
  290. raw := NoMethod(*s)
  291. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  292. }
  293. // Attachment: Attachment with application-specific information about an
  294. // alert.
  295. type Attachment struct {
  296. // Csv: A CSV file attachment.
  297. Csv *Csv `json:"csv,omitempty"`
  298. // ForceSendFields is a list of field names (e.g. "Csv") to
  299. // unconditionally include in API requests. By default, fields with
  300. // empty values are omitted from API requests. However, any non-pointer,
  301. // non-interface field appearing in ForceSendFields will be sent to the
  302. // server regardless of whether the field is empty or not. This may be
  303. // used to include empty fields in Patch requests.
  304. ForceSendFields []string `json:"-"`
  305. // NullFields is a list of field names (e.g. "Csv") to include in API
  306. // requests with the JSON null value. By default, fields with empty
  307. // values are omitted from API requests. However, any field with an
  308. // empty value appearing in NullFields will be sent to the server as
  309. // null. It is an error if a field in this list has a non-empty value.
  310. // This may be used to include null fields in Patch requests.
  311. NullFields []string `json:"-"`
  312. }
  313. func (s *Attachment) MarshalJSON() ([]byte, error) {
  314. type NoMethod Attachment
  315. raw := NoMethod(*s)
  316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  317. }
  318. // BadWhitelist: Alert for setting the domain or IP that malicious email
  319. // comes from as
  320. // whitelisted domain or IP in Gmail advanced settings.
  321. type BadWhitelist struct {
  322. // DomainId: The domain ID.
  323. DomainId *DomainId `json:"domainId,omitempty"`
  324. // MaliciousEntity: The entity whose actions triggered a Gmail phishing
  325. // alert.
  326. MaliciousEntity *MaliciousEntity `json:"maliciousEntity,omitempty"`
  327. // Messages: The list of messages contained by this alert.
  328. Messages []*GmailMessageInfo `json:"messages,omitempty"`
  329. // SourceIp: The source IP address of the malicious email, for
  330. // example,
  331. // `127.0.0.1`.
  332. SourceIp string `json:"sourceIp,omitempty"`
  333. // ForceSendFields is a list of field names (e.g. "DomainId") to
  334. // unconditionally include in API requests. By default, fields with
  335. // empty values are omitted from API requests. However, any non-pointer,
  336. // non-interface field appearing in ForceSendFields will be sent to the
  337. // server regardless of whether the field is empty or not. This may be
  338. // used to include empty fields in Patch requests.
  339. ForceSendFields []string `json:"-"`
  340. // NullFields is a list of field names (e.g. "DomainId") to include in
  341. // API requests with the JSON null value. By default, fields with empty
  342. // values are omitted from API requests. However, any field with an
  343. // empty value appearing in NullFields will be sent to the server as
  344. // null. It is an error if a field in this list has a non-empty value.
  345. // This may be used to include null fields in Patch requests.
  346. NullFields []string `json:"-"`
  347. }
  348. func (s *BadWhitelist) MarshalJSON() ([]byte, error) {
  349. type NoMethod BadWhitelist
  350. raw := NoMethod(*s)
  351. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  352. }
  353. // CloudPubsubTopic: A reference to a Cloud Pubsub topic.
  354. //
  355. // To register for notifications, the owner of the topic must
  356. // grant
  357. // `alerts-api-push-notifications@system.gserviceaccount.com` the
  358. // `projects.topics.publish` permission.
  359. type CloudPubsubTopic struct {
  360. // PayloadFormat: Optional. The format of the payload that would be
  361. // sent.
  362. // If not specified the format will be JSON.
  363. //
  364. // Possible values:
  365. // "PAYLOAD_FORMAT_UNSPECIFIED" - Payload format is not specified
  366. // (will use JSON as default).
  367. // "JSON" - Use JSON.
  368. PayloadFormat string `json:"payloadFormat,omitempty"`
  369. // TopicName: The `name` field of a Cloud Pubsub
  370. // [Topic]
  371. // (https://cloud.google.com/pubsub/docs/reference/rest/v1/projec
  372. // ts.topics#Topic).
  373. TopicName string `json:"topicName,omitempty"`
  374. // ForceSendFields is a list of field names (e.g. "PayloadFormat") to
  375. // unconditionally include in API requests. By default, fields with
  376. // empty values are omitted from API requests. However, any non-pointer,
  377. // non-interface field appearing in ForceSendFields will be sent to the
  378. // server regardless of whether the field is empty or not. This may be
  379. // used to include empty fields in Patch requests.
  380. ForceSendFields []string `json:"-"`
  381. // NullFields is a list of field names (e.g. "PayloadFormat") to include
  382. // in API requests with the JSON null value. By default, fields with
  383. // empty values are omitted from API requests. However, any field with
  384. // an empty value appearing in NullFields will be sent to the server as
  385. // null. It is an error if a field in this list has a non-empty value.
  386. // This may be used to include null fields in Patch requests.
  387. NullFields []string `json:"-"`
  388. }
  389. func (s *CloudPubsubTopic) MarshalJSON() ([]byte, error) {
  390. type NoMethod CloudPubsubTopic
  391. raw := NoMethod(*s)
  392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  393. }
  394. // Csv: A representation of a CSV file attachment, as a list of column
  395. // headers and
  396. // a list of data rows.
  397. type Csv struct {
  398. // DataRows: The list of data rows in a CSV file, as string arrays
  399. // rather than as a
  400. // single comma-separated string.
  401. DataRows []*CsvRow `json:"dataRows,omitempty"`
  402. // Headers: The list of headers for data columns in a CSV file.
  403. Headers []string `json:"headers,omitempty"`
  404. // ForceSendFields is a list of field names (e.g. "DataRows") to
  405. // unconditionally include in API requests. By default, fields with
  406. // empty values are omitted from API requests. However, any non-pointer,
  407. // non-interface field appearing in ForceSendFields will be sent to the
  408. // server regardless of whether the field is empty or not. This may be
  409. // used to include empty fields in Patch requests.
  410. ForceSendFields []string `json:"-"`
  411. // NullFields is a list of field names (e.g. "DataRows") to include in
  412. // API requests with the JSON null value. By default, fields with empty
  413. // values are omitted from API requests. However, any field with an
  414. // empty value appearing in NullFields will be sent to the server as
  415. // null. It is an error if a field in this list has a non-empty value.
  416. // This may be used to include null fields in Patch requests.
  417. NullFields []string `json:"-"`
  418. }
  419. func (s *Csv) MarshalJSON() ([]byte, error) {
  420. type NoMethod Csv
  421. raw := NoMethod(*s)
  422. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  423. }
  424. // CsvRow: A representation of a single data row in a CSV file.
  425. type CsvRow struct {
  426. // Entries: The data entries in a CSV file row, as a string array rather
  427. // than a
  428. // single comma-separated string.
  429. Entries []string `json:"entries,omitempty"`
  430. // ForceSendFields is a list of field names (e.g. "Entries") to
  431. // unconditionally include in API requests. By default, fields with
  432. // empty values are omitted from API requests. However, any non-pointer,
  433. // non-interface field appearing in ForceSendFields will be sent to the
  434. // server regardless of whether the field is empty or not. This may be
  435. // used to include empty fields in Patch requests.
  436. ForceSendFields []string `json:"-"`
  437. // NullFields is a list of field names (e.g. "Entries") to include in
  438. // API requests with the JSON null value. By default, fields with empty
  439. // values are omitted from API requests. However, any field with an
  440. // empty value appearing in NullFields will be sent to the server as
  441. // null. It is an error if a field in this list has a non-empty value.
  442. // This may be used to include null fields in Patch requests.
  443. NullFields []string `json:"-"`
  444. }
  445. func (s *CsvRow) MarshalJSON() ([]byte, error) {
  446. type NoMethod CsvRow
  447. raw := NoMethod(*s)
  448. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  449. }
  450. // DeviceCompromised: A mobile device compromised alert. Derived from
  451. // audit logs.
  452. type DeviceCompromised struct {
  453. // Email: The email of the user this alert was created for.
  454. Email string `json:"email,omitempty"`
  455. // Events: Required. The list of security events.
  456. Events []*DeviceCompromisedSecurityDetail `json:"events,omitempty"`
  457. // ForceSendFields is a list of field names (e.g. "Email") to
  458. // unconditionally include in API requests. By default, fields with
  459. // empty values are omitted from API requests. However, any non-pointer,
  460. // non-interface field appearing in ForceSendFields will be sent to the
  461. // server regardless of whether the field is empty or not. This may be
  462. // used to include empty fields in Patch requests.
  463. ForceSendFields []string `json:"-"`
  464. // NullFields is a list of field names (e.g. "Email") to include in API
  465. // requests with the JSON null value. By default, fields with empty
  466. // values are omitted from API requests. However, any field with an
  467. // empty value appearing in NullFields will be sent to the server as
  468. // null. It is an error if a field in this list has a non-empty value.
  469. // This may be used to include null fields in Patch requests.
  470. NullFields []string `json:"-"`
  471. }
  472. func (s *DeviceCompromised) MarshalJSON() ([]byte, error) {
  473. type NoMethod DeviceCompromised
  474. raw := NoMethod(*s)
  475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  476. }
  477. // DeviceCompromisedSecurityDetail: Detailed information of a single MDM
  478. // device compromised event.
  479. type DeviceCompromisedSecurityDetail struct {
  480. // DeviceCompromisedState: The device compromised state. Possible values
  481. // are "Compromised" or
  482. // "Not Compromised".
  483. DeviceCompromisedState string `json:"deviceCompromisedState,omitempty"`
  484. // DeviceId: Required. The device ID.
  485. DeviceId string `json:"deviceId,omitempty"`
  486. // DeviceModel: The model of the device.
  487. DeviceModel string `json:"deviceModel,omitempty"`
  488. // DeviceType: The type of the device.
  489. DeviceType string `json:"deviceType,omitempty"`
  490. // IosVendorId: Required for iOS, empty for others.
  491. IosVendorId string `json:"iosVendorId,omitempty"`
  492. // ResourceId: The device resource ID.
  493. ResourceId string `json:"resourceId,omitempty"`
  494. // SerialNumber: The serial number of the device.
  495. SerialNumber string `json:"serialNumber,omitempty"`
  496. // ForceSendFields is a list of field names (e.g.
  497. // "DeviceCompromisedState") to unconditionally include in API requests.
  498. // By default, fields with empty values are omitted from API requests.
  499. // However, any non-pointer, non-interface field appearing in
  500. // ForceSendFields will be sent to the server regardless of whether the
  501. // field is empty or not. This may be used to include empty fields in
  502. // Patch requests.
  503. ForceSendFields []string `json:"-"`
  504. // NullFields is a list of field names (e.g. "DeviceCompromisedState")
  505. // to include in API requests with the JSON null value. By default,
  506. // fields with empty values are omitted from API requests. However, any
  507. // field with an empty value appearing in NullFields will be sent to the
  508. // server as null. It is an error if a field in this list has a
  509. // non-empty value. This may be used to include null fields in Patch
  510. // requests.
  511. NullFields []string `json:"-"`
  512. }
  513. func (s *DeviceCompromisedSecurityDetail) MarshalJSON() ([]byte, error) {
  514. type NoMethod DeviceCompromisedSecurityDetail
  515. raw := NoMethod(*s)
  516. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  517. }
  518. // DomainId: Domain ID of Gmail phishing alerts.
  519. type DomainId struct {
  520. // CustomerPrimaryDomain: The primary domain for the customer.
  521. CustomerPrimaryDomain string `json:"customerPrimaryDomain,omitempty"`
  522. // ForceSendFields is a list of field names (e.g.
  523. // "CustomerPrimaryDomain") to unconditionally include in API requests.
  524. // By default, fields with empty values are omitted from API requests.
  525. // However, any non-pointer, non-interface field appearing in
  526. // ForceSendFields will be sent to the server regardless of whether the
  527. // field is empty or not. This may be used to include empty fields in
  528. // Patch requests.
  529. ForceSendFields []string `json:"-"`
  530. // NullFields is a list of field names (e.g. "CustomerPrimaryDomain") to
  531. // include in API requests with the JSON null value. By default, fields
  532. // with empty values are omitted from API requests. However, any field
  533. // with an empty value appearing in NullFields will be sent to the
  534. // server as null. It is an error if a field in this list has a
  535. // non-empty value. This may be used to include null fields in Patch
  536. // requests.
  537. NullFields []string `json:"-"`
  538. }
  539. func (s *DomainId) MarshalJSON() ([]byte, error) {
  540. type NoMethod DomainId
  541. raw := NoMethod(*s)
  542. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  543. }
  544. // DomainWideTakeoutInitiated: A takeout operation for the entire domain
  545. // was initiated by an admin. Derived
  546. // from audit logs.
  547. type DomainWideTakeoutInitiated struct {
  548. // Email: The email of the admin who initiated the takeout.
  549. Email string `json:"email,omitempty"`
  550. // TakeoutRequestId: The takeout request ID.
  551. TakeoutRequestId string `json:"takeoutRequestId,omitempty"`
  552. // ForceSendFields is a list of field names (e.g. "Email") to
  553. // unconditionally include in API requests. By default, fields with
  554. // empty values are omitted from API requests. However, any non-pointer,
  555. // non-interface field appearing in ForceSendFields will be sent to the
  556. // server regardless of whether the field is empty or not. This may be
  557. // used to include empty fields in Patch requests.
  558. ForceSendFields []string `json:"-"`
  559. // NullFields is a list of field names (e.g. "Email") to include in API
  560. // requests with the JSON null value. By default, fields with empty
  561. // values are omitted from API requests. However, any field with an
  562. // empty value appearing in NullFields will be sent to the server as
  563. // null. It is an error if a field in this list has a non-empty value.
  564. // This may be used to include null fields in Patch requests.
  565. NullFields []string `json:"-"`
  566. }
  567. func (s *DomainWideTakeoutInitiated) MarshalJSON() ([]byte, error) {
  568. type NoMethod DomainWideTakeoutInitiated
  569. raw := NoMethod(*s)
  570. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  571. }
  572. // Empty: A generic empty message that you can re-use to avoid defining
  573. // duplicated
  574. // empty messages in your APIs. A typical example is to use it as the
  575. // request
  576. // or the response type of an API method. For instance:
  577. //
  578. // service Foo {
  579. // rpc Bar(google.protobuf.Empty) returns
  580. // (google.protobuf.Empty);
  581. // }
  582. //
  583. // The JSON representation for `Empty` is empty JSON object `{}`.
  584. type Empty struct {
  585. // ServerResponse contains the HTTP response code and headers from the
  586. // server.
  587. googleapi.ServerResponse `json:"-"`
  588. }
  589. // GmailMessageInfo: Details of a message in phishing spike alert.
  590. type GmailMessageInfo struct {
  591. // AttachmentsSha256Hash: The `SHA256` hash of email's attachment and
  592. // all MIME parts.
  593. AttachmentsSha256Hash []string `json:"attachmentsSha256Hash,omitempty"`
  594. // Date: The date the malicious email was sent.
  595. Date string `json:"date,omitempty"`
  596. // Md5HashMessageBody: The hash of the message body text.
  597. Md5HashMessageBody string `json:"md5HashMessageBody,omitempty"`
  598. // Md5HashSubject: The MD5 Hash of email's subject (only available for
  599. // reported emails).
  600. Md5HashSubject string `json:"md5HashSubject,omitempty"`
  601. // MessageBodySnippet: The snippet of the message body text (only
  602. // available for reported emails).
  603. MessageBodySnippet string `json:"messageBodySnippet,omitempty"`
  604. // MessageId: The message ID.
  605. MessageId string `json:"messageId,omitempty"`
  606. // Recipient: The recipient of this email.
  607. Recipient string `json:"recipient,omitempty"`
  608. // SubjectText: The email subject text (only available for reported
  609. // emails).
  610. SubjectText string `json:"subjectText,omitempty"`
  611. // ForceSendFields is a list of field names (e.g.
  612. // "AttachmentsSha256Hash") to unconditionally include in API requests.
  613. // By default, fields with empty values are omitted from API requests.
  614. // However, any non-pointer, non-interface field appearing in
  615. // ForceSendFields will be sent to the server regardless of whether the
  616. // field is empty or not. This may be used to include empty fields in
  617. // Patch requests.
  618. ForceSendFields []string `json:"-"`
  619. // NullFields is a list of field names (e.g. "AttachmentsSha256Hash") to
  620. // include in API requests with the JSON null value. By default, fields
  621. // with empty values are omitted from API requests. However, any field
  622. // with an empty value appearing in NullFields will be sent to the
  623. // server as null. It is an error if a field in this list has a
  624. // non-empty value. This may be used to include null fields in Patch
  625. // requests.
  626. NullFields []string `json:"-"`
  627. }
  628. func (s *GmailMessageInfo) MarshalJSON() ([]byte, error) {
  629. type NoMethod GmailMessageInfo
  630. raw := NoMethod(*s)
  631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  632. }
  633. // GoogleOperations: An incident reported by Google Operations for a G
  634. // Suite application.
  635. type GoogleOperations struct {
  636. // AffectedUserEmails: The list of emails which correspond to the users
  637. // directly affected by the
  638. // incident.
  639. AffectedUserEmails []string `json:"affectedUserEmails,omitempty"`
  640. // AttachmentData: Optional. Application-specific data for an incident,
  641. // provided when the
  642. // G Suite application which reported the incident cannot be
  643. // completely
  644. // restored to a valid state.
  645. AttachmentData *Attachment `json:"attachmentData,omitempty"`
  646. // Description: A detailed, freeform incident description.
  647. Description string `json:"description,omitempty"`
  648. // Title: A one-line incident description.
  649. Title string `json:"title,omitempty"`
  650. // ForceSendFields is a list of field names (e.g. "AffectedUserEmails")
  651. // to unconditionally include in API requests. By default, fields with
  652. // empty values are omitted from API requests. However, any non-pointer,
  653. // non-interface field appearing in ForceSendFields will be sent to the
  654. // server regardless of whether the field is empty or not. This may be
  655. // used to include empty fields in Patch requests.
  656. ForceSendFields []string `json:"-"`
  657. // NullFields is a list of field names (e.g. "AffectedUserEmails") to
  658. // include in API requests with the JSON null value. By default, fields
  659. // with empty values are omitted from API requests. However, any field
  660. // with an empty value appearing in NullFields will be sent to the
  661. // server as null. It is an error if a field in this list has a
  662. // non-empty value. This may be used to include null fields in Patch
  663. // requests.
  664. NullFields []string `json:"-"`
  665. }
  666. func (s *GoogleOperations) MarshalJSON() ([]byte, error) {
  667. type NoMethod GoogleOperations
  668. raw := NoMethod(*s)
  669. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  670. }
  671. // ListAlertFeedbackResponse: Response message for an alert feedback
  672. // listing request.
  673. type ListAlertFeedbackResponse struct {
  674. // Feedback: The list of alert feedback.
  675. // Feedback entries for each alert are ordered by creation time
  676. // descending.
  677. Feedback []*AlertFeedback `json:"feedback,omitempty"`
  678. // ServerResponse contains the HTTP response code and headers from the
  679. // server.
  680. googleapi.ServerResponse `json:"-"`
  681. // ForceSendFields is a list of field names (e.g. "Feedback") to
  682. // unconditionally include in API requests. By default, fields with
  683. // empty values are omitted from API requests. However, any non-pointer,
  684. // non-interface field appearing in ForceSendFields will be sent to the
  685. // server regardless of whether the field is empty or not. This may be
  686. // used to include empty fields in Patch requests.
  687. ForceSendFields []string `json:"-"`
  688. // NullFields is a list of field names (e.g. "Feedback") to include in
  689. // API requests with the JSON null value. By default, fields with empty
  690. // values are omitted from API requests. However, any field with an
  691. // empty value appearing in NullFields will be sent to the server as
  692. // null. It is an error if a field in this list has a non-empty value.
  693. // This may be used to include null fields in Patch requests.
  694. NullFields []string `json:"-"`
  695. }
  696. func (s *ListAlertFeedbackResponse) MarshalJSON() ([]byte, error) {
  697. type NoMethod ListAlertFeedbackResponse
  698. raw := NoMethod(*s)
  699. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  700. }
  701. // ListAlertsResponse: Response message for an alert listing request.
  702. type ListAlertsResponse struct {
  703. // Alerts: The list of alerts.
  704. Alerts []*Alert `json:"alerts,omitempty"`
  705. // NextPageToken: The token for the next page. If not empty, indicates
  706. // that there may be more
  707. // alerts that match the listing request; this value can be used in
  708. // a
  709. // subsequent ListAlertsRequest to get alerts continuing from last
  710. // result
  711. // of the current list call.
  712. NextPageToken string `json:"nextPageToken,omitempty"`
  713. // ServerResponse contains the HTTP response code and headers from the
  714. // server.
  715. googleapi.ServerResponse `json:"-"`
  716. // ForceSendFields is a list of field names (e.g. "Alerts") to
  717. // unconditionally include in API requests. By default, fields with
  718. // empty values are omitted from API requests. However, any non-pointer,
  719. // non-interface field appearing in ForceSendFields will be sent to the
  720. // server regardless of whether the field is empty or not. This may be
  721. // used to include empty fields in Patch requests.
  722. ForceSendFields []string `json:"-"`
  723. // NullFields is a list of field names (e.g. "Alerts") to include in API
  724. // requests with the JSON null value. By default, fields with empty
  725. // values are omitted from API requests. However, any field with an
  726. // empty value appearing in NullFields will be sent to the server as
  727. // null. It is an error if a field in this list has a non-empty value.
  728. // This may be used to include null fields in Patch requests.
  729. NullFields []string `json:"-"`
  730. }
  731. func (s *ListAlertsResponse) MarshalJSON() ([]byte, error) {
  732. type NoMethod ListAlertsResponse
  733. raw := NoMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  735. }
  736. // LoginDetails: The details of the login action.
  737. type LoginDetails struct {
  738. // IpAddress: Optional. The human-readable IP address (for
  739. // example,
  740. // `11.22.33.44`) that is associated with the warning event.
  741. IpAddress string `json:"ipAddress,omitempty"`
  742. // LoginTime: Optional. The successful login time that is associated
  743. // with the warning
  744. // event. This will not be present for blocked login attempts.
  745. LoginTime string `json:"loginTime,omitempty"`
  746. // ForceSendFields is a list of field names (e.g. "IpAddress") to
  747. // unconditionally include in API requests. By default, fields with
  748. // empty values are omitted from API requests. However, any non-pointer,
  749. // non-interface field appearing in ForceSendFields will be sent to the
  750. // server regardless of whether the field is empty or not. This may be
  751. // used to include empty fields in Patch requests.
  752. ForceSendFields []string `json:"-"`
  753. // NullFields is a list of field names (e.g. "IpAddress") to include in
  754. // API requests with the JSON null value. By default, fields with empty
  755. // values are omitted from API requests. However, any field with an
  756. // empty value appearing in NullFields will be sent to the server as
  757. // null. It is an error if a field in this list has a non-empty value.
  758. // This may be used to include null fields in Patch requests.
  759. NullFields []string `json:"-"`
  760. }
  761. func (s *LoginDetails) MarshalJSON() ([]byte, error) {
  762. type NoMethod LoginDetails
  763. raw := NoMethod(*s)
  764. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  765. }
  766. // MailPhishing: Proto for all phishing alerts with common
  767. // payload.
  768. // Supported types are any of the following:
  769. //
  770. // * User reported phishing
  771. // * User reported spam spike
  772. // * Suspicious message reported
  773. // * Phishing reclassification
  774. // * Malware reclassification
  775. type MailPhishing struct {
  776. // DomainId: The domain ID.
  777. DomainId *DomainId `json:"domainId,omitempty"`
  778. // IsInternal: If `true`, the email originated from within the
  779. // organization.
  780. IsInternal bool `json:"isInternal,omitempty"`
  781. // MaliciousEntity: The entity whose actions triggered a Gmail phishing
  782. // alert.
  783. MaliciousEntity *MaliciousEntity `json:"maliciousEntity,omitempty"`
  784. // Messages: The list of messages contained by this alert.
  785. Messages []*GmailMessageInfo `json:"messages,omitempty"`
  786. // ForceSendFields is a list of field names (e.g. "DomainId") to
  787. // unconditionally include in API requests. By default, fields with
  788. // empty values are omitted from API requests. However, any non-pointer,
  789. // non-interface field appearing in ForceSendFields will be sent to the
  790. // server regardless of whether the field is empty or not. This may be
  791. // used to include empty fields in Patch requests.
  792. ForceSendFields []string `json:"-"`
  793. // NullFields is a list of field names (e.g. "DomainId") to include in
  794. // API requests with the JSON null value. By default, fields with empty
  795. // values are omitted from API requests. However, any field with an
  796. // empty value appearing in NullFields will be sent to the server as
  797. // null. It is an error if a field in this list has a non-empty value.
  798. // This may be used to include null fields in Patch requests.
  799. NullFields []string `json:"-"`
  800. }
  801. func (s *MailPhishing) MarshalJSON() ([]byte, error) {
  802. type NoMethod MailPhishing
  803. raw := NoMethod(*s)
  804. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  805. }
  806. // MaliciousEntity: Entity whose actions triggered a Gmail phishing
  807. // alert.
  808. type MaliciousEntity struct {
  809. // FromHeader: The sender email address.
  810. FromHeader string `json:"fromHeader,omitempty"`
  811. // ForceSendFields is a list of field names (e.g. "FromHeader") to
  812. // unconditionally include in API requests. By default, fields with
  813. // empty values are omitted from API requests. However, any non-pointer,
  814. // non-interface field appearing in ForceSendFields will be sent to the
  815. // server regardless of whether the field is empty or not. This may be
  816. // used to include empty fields in Patch requests.
  817. ForceSendFields []string `json:"-"`
  818. // NullFields is a list of field names (e.g. "FromHeader") to include in
  819. // API requests with the JSON null value. By default, fields with empty
  820. // values are omitted from API requests. However, any field with an
  821. // empty value appearing in NullFields will be sent to the server as
  822. // null. It is an error if a field in this list has a non-empty value.
  823. // This may be used to include null fields in Patch requests.
  824. NullFields []string `json:"-"`
  825. }
  826. func (s *MaliciousEntity) MarshalJSON() ([]byte, error) {
  827. type NoMethod MaliciousEntity
  828. raw := NoMethod(*s)
  829. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  830. }
  831. // Notification: Settings for callback notifications.
  832. // For more details see [G Suite
  833. // Alert
  834. // Notification](/admin-sdk/alertcenter/guides/notifications).
  835. type Notification struct {
  836. // CloudPubsubTopic: A Google Cloud Pub/sub topic destination.
  837. CloudPubsubTopic *CloudPubsubTopic `json:"cloudPubsubTopic,omitempty"`
  838. // ForceSendFields is a list of field names (e.g. "CloudPubsubTopic") to
  839. // unconditionally include in API requests. By default, fields with
  840. // empty values are omitted from API requests. However, any non-pointer,
  841. // non-interface field appearing in ForceSendFields will be sent to the
  842. // server regardless of whether the field is empty or not. This may be
  843. // used to include empty fields in Patch requests.
  844. ForceSendFields []string `json:"-"`
  845. // NullFields is a list of field names (e.g. "CloudPubsubTopic") to
  846. // include in API requests with the JSON null value. By default, fields
  847. // with empty values are omitted from API requests. However, any field
  848. // with an empty value appearing in NullFields will be sent to the
  849. // server as null. It is an error if a field in this list has a
  850. // non-empty value. This may be used to include null fields in Patch
  851. // requests.
  852. NullFields []string `json:"-"`
  853. }
  854. func (s *Notification) MarshalJSON() ([]byte, error) {
  855. type NoMethod Notification
  856. raw := NoMethod(*s)
  857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  858. }
  859. // PhishingSpike: Alert for a spike in user reported phishing.
  860. // <aside class="warning"><b>Warning</b>: This type has been deprecated.
  861. // Use
  862. // [MailPhishing](/admin-sdk/alertcenter/reference/rest/v1beta1/MailP
  863. // hishing)
  864. // instead.</aside>
  865. type PhishingSpike struct {
  866. // DomainId: The domain ID.
  867. DomainId *DomainId `json:"domainId,omitempty"`
  868. // IsInternal: If `true`, the email originated from within the
  869. // organization.
  870. IsInternal bool `json:"isInternal,omitempty"`
  871. // MaliciousEntity: The entity whose actions triggered a Gmail phishing
  872. // alert.
  873. MaliciousEntity *MaliciousEntity `json:"maliciousEntity,omitempty"`
  874. // Messages: The list of messages contained by this alert.
  875. Messages []*GmailMessageInfo `json:"messages,omitempty"`
  876. // ForceSendFields is a list of field names (e.g. "DomainId") to
  877. // unconditionally include in API requests. By default, fields with
  878. // empty values are omitted from API requests. However, any non-pointer,
  879. // non-interface field appearing in ForceSendFields will be sent to the
  880. // server regardless of whether the field is empty or not. This may be
  881. // used to include empty fields in Patch requests.
  882. ForceSendFields []string `json:"-"`
  883. // NullFields is a list of field names (e.g. "DomainId") to include in
  884. // API requests with the JSON null value. By default, fields with empty
  885. // values are omitted from API requests. However, any field with an
  886. // empty value appearing in NullFields will be sent to the server as
  887. // null. It is an error if a field in this list has a non-empty value.
  888. // This may be used to include null fields in Patch requests.
  889. NullFields []string `json:"-"`
  890. }
  891. func (s *PhishingSpike) MarshalJSON() ([]byte, error) {
  892. type NoMethod PhishingSpike
  893. raw := NoMethod(*s)
  894. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  895. }
  896. // Settings: Customer-level settings.
  897. type Settings struct {
  898. // Notifications: The list of notifications.
  899. Notifications []*Notification `json:"notifications,omitempty"`
  900. // ServerResponse contains the HTTP response code and headers from the
  901. // server.
  902. googleapi.ServerResponse `json:"-"`
  903. // ForceSendFields is a list of field names (e.g. "Notifications") to
  904. // unconditionally include in API requests. By default, fields with
  905. // empty values are omitted from API requests. However, any non-pointer,
  906. // non-interface field appearing in ForceSendFields will be sent to the
  907. // server regardless of whether the field is empty or not. This may be
  908. // used to include empty fields in Patch requests.
  909. ForceSendFields []string `json:"-"`
  910. // NullFields is a list of field names (e.g. "Notifications") to include
  911. // in API requests with the JSON null value. By default, fields with
  912. // empty values are omitted from API requests. However, any field with
  913. // an empty value appearing in NullFields will be sent to the server as
  914. // null. It is an error if a field in this list has a non-empty value.
  915. // This may be used to include null fields in Patch requests.
  916. NullFields []string `json:"-"`
  917. }
  918. func (s *Settings) MarshalJSON() ([]byte, error) {
  919. type NoMethod Settings
  920. raw := NoMethod(*s)
  921. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  922. }
  923. // StateSponsoredAttack: A state-sponsored attack alert. Derived from
  924. // audit logs.
  925. type StateSponsoredAttack struct {
  926. // Email: The email of the user this incident was created for.
  927. Email string `json:"email,omitempty"`
  928. // ForceSendFields is a list of field names (e.g. "Email") to
  929. // unconditionally include in API requests. By default, fields with
  930. // empty values are omitted from API requests. However, any non-pointer,
  931. // non-interface field appearing in ForceSendFields will be sent to the
  932. // server regardless of whether the field is empty or not. This may be
  933. // used to include empty fields in Patch requests.
  934. ForceSendFields []string `json:"-"`
  935. // NullFields is a list of field names (e.g. "Email") to include in API
  936. // requests with the JSON null value. By default, fields with empty
  937. // values are omitted from API requests. However, any field with an
  938. // empty value appearing in NullFields will be sent to the server as
  939. // null. It is an error if a field in this list has a non-empty value.
  940. // This may be used to include null fields in Patch requests.
  941. NullFields []string `json:"-"`
  942. }
  943. func (s *StateSponsoredAttack) MarshalJSON() ([]byte, error) {
  944. type NoMethod StateSponsoredAttack
  945. raw := NoMethod(*s)
  946. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  947. }
  948. // SuspiciousActivity: A mobile suspicious activity alert. Derived from
  949. // audit logs.
  950. type SuspiciousActivity struct {
  951. // Email: The email of the user this alert was created for.
  952. Email string `json:"email,omitempty"`
  953. // Events: Required. The list of security events.
  954. Events []*SuspiciousActivitySecurityDetail `json:"events,omitempty"`
  955. // ForceSendFields is a list of field names (e.g. "Email") to
  956. // unconditionally include in API requests. By default, fields with
  957. // empty values are omitted from API requests. However, any non-pointer,
  958. // non-interface field appearing in ForceSendFields will be sent to the
  959. // server regardless of whether the field is empty or not. This may be
  960. // used to include empty fields in Patch requests.
  961. ForceSendFields []string `json:"-"`
  962. // NullFields is a list of field names (e.g. "Email") to include in API
  963. // requests with the JSON null value. By default, fields with empty
  964. // values are omitted from API requests. However, any field with an
  965. // empty value appearing in NullFields will be sent to the server as
  966. // null. It is an error if a field in this list has a non-empty value.
  967. // This may be used to include null fields in Patch requests.
  968. NullFields []string `json:"-"`
  969. }
  970. func (s *SuspiciousActivity) MarshalJSON() ([]byte, error) {
  971. type NoMethod SuspiciousActivity
  972. raw := NoMethod(*s)
  973. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  974. }
  975. // SuspiciousActivitySecurityDetail: Detailed information of a single
  976. // MDM suspicious activity event.
  977. type SuspiciousActivitySecurityDetail struct {
  978. // DeviceId: Required. The device ID.
  979. DeviceId string `json:"deviceId,omitempty"`
  980. // DeviceModel: The model of the device.
  981. DeviceModel string `json:"deviceModel,omitempty"`
  982. // DeviceProperty: The device property which was changed.
  983. DeviceProperty string `json:"deviceProperty,omitempty"`
  984. // DeviceType: The type of the device.
  985. DeviceType string `json:"deviceType,omitempty"`
  986. // IosVendorId: Required for iOS, empty for others.
  987. IosVendorId string `json:"iosVendorId,omitempty"`
  988. // NewValue: The new value of the device property after the change.
  989. NewValue string `json:"newValue,omitempty"`
  990. // OldValue: The old value of the device property before the change.
  991. OldValue string `json:"oldValue,omitempty"`
  992. // ResourceId: The device resource ID.
  993. ResourceId string `json:"resourceId,omitempty"`
  994. // SerialNumber: The serial number of the device.
  995. SerialNumber string `json:"serialNumber,omitempty"`
  996. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  997. // unconditionally include in API requests. By default, fields with
  998. // empty values are omitted from API requests. However, any non-pointer,
  999. // non-interface field appearing in ForceSendFields will be sent to the
  1000. // server regardless of whether the field is empty or not. This may be
  1001. // used to include empty fields in Patch requests.
  1002. ForceSendFields []string `json:"-"`
  1003. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1004. // API requests with the JSON null value. By default, fields with empty
  1005. // values are omitted from API requests. However, any field with an
  1006. // empty value appearing in NullFields will be sent to the server as
  1007. // null. It is an error if a field in this list has a non-empty value.
  1008. // This may be used to include null fields in Patch requests.
  1009. NullFields []string `json:"-"`
  1010. }
  1011. func (s *SuspiciousActivitySecurityDetail) MarshalJSON() ([]byte, error) {
  1012. type NoMethod SuspiciousActivitySecurityDetail
  1013. raw := NoMethod(*s)
  1014. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1015. }
  1016. // UndeleteAlertRequest: A request to undelete a specific alert that was
  1017. // marked for deletion.
  1018. type UndeleteAlertRequest struct {
  1019. // CustomerId: Optional. The unique identifier of the G Suite
  1020. // organization account of the
  1021. // customer the alert is associated with.
  1022. // Inferred from the caller identity if not provided.
  1023. CustomerId string `json:"customerId,omitempty"`
  1024. // ForceSendFields is a list of field names (e.g. "CustomerId") to
  1025. // unconditionally include in API requests. By default, fields with
  1026. // empty values are omitted from API requests. However, any non-pointer,
  1027. // non-interface field appearing in ForceSendFields will be sent to the
  1028. // server regardless of whether the field is empty or not. This may be
  1029. // used to include empty fields in Patch requests.
  1030. ForceSendFields []string `json:"-"`
  1031. // NullFields is a list of field names (e.g. "CustomerId") to include in
  1032. // API requests with the JSON null value. By default, fields with empty
  1033. // values are omitted from API requests. However, any field with an
  1034. // empty value appearing in NullFields will be sent to the server as
  1035. // null. It is an error if a field in this list has a non-empty value.
  1036. // This may be used to include null fields in Patch requests.
  1037. NullFields []string `json:"-"`
  1038. }
  1039. func (s *UndeleteAlertRequest) MarshalJSON() ([]byte, error) {
  1040. type NoMethod UndeleteAlertRequest
  1041. raw := NoMethod(*s)
  1042. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1043. }
  1044. // method id "alertcenter.alerts.delete":
  1045. type AlertsDeleteCall struct {
  1046. s *Service
  1047. alertId string
  1048. urlParams_ gensupport.URLParams
  1049. ctx_ context.Context
  1050. header_ http.Header
  1051. }
  1052. // Delete: Marks the specified alert for deletion. An alert that has
  1053. // been marked for
  1054. // deletion is removed from Alert Center after 30 days.
  1055. // Marking an alert for deletion has no effect on an alert which
  1056. // has
  1057. // already been marked for deletion. Attempting to mark a nonexistent
  1058. // alert
  1059. // for deletion results in a `NOT_FOUND` error.
  1060. func (r *AlertsService) Delete(alertId string) *AlertsDeleteCall {
  1061. c := &AlertsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1062. c.alertId = alertId
  1063. return c
  1064. }
  1065. // CustomerId sets the optional parameter "customerId": The unique
  1066. // identifier of the G Suite organization account of the
  1067. // customer the alert is associated with.
  1068. // Inferred from the caller identity if not provided.
  1069. func (c *AlertsDeleteCall) CustomerId(customerId string) *AlertsDeleteCall {
  1070. c.urlParams_.Set("customerId", customerId)
  1071. return c
  1072. }
  1073. // Fields allows partial responses to be retrieved. See
  1074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1075. // for more information.
  1076. func (c *AlertsDeleteCall) Fields(s ...googleapi.Field) *AlertsDeleteCall {
  1077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1078. return c
  1079. }
  1080. // Context sets the context to be used in this call's Do method. Any
  1081. // pending HTTP request will be aborted if the provided context is
  1082. // canceled.
  1083. func (c *AlertsDeleteCall) Context(ctx context.Context) *AlertsDeleteCall {
  1084. c.ctx_ = ctx
  1085. return c
  1086. }
  1087. // Header returns an http.Header that can be modified by the caller to
  1088. // add HTTP headers to the request.
  1089. func (c *AlertsDeleteCall) Header() http.Header {
  1090. if c.header_ == nil {
  1091. c.header_ = make(http.Header)
  1092. }
  1093. return c.header_
  1094. }
  1095. func (c *AlertsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1096. reqHeaders := make(http.Header)
  1097. for k, v := range c.header_ {
  1098. reqHeaders[k] = v
  1099. }
  1100. reqHeaders.Set("User-Agent", c.s.userAgent())
  1101. var body io.Reader = nil
  1102. c.urlParams_.Set("alt", alt)
  1103. c.urlParams_.Set("prettyPrint", "false")
  1104. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts/{alertId}")
  1105. urls += "?" + c.urlParams_.Encode()
  1106. req, err := http.NewRequest("DELETE", urls, body)
  1107. if err != nil {
  1108. return nil, err
  1109. }
  1110. req.Header = reqHeaders
  1111. googleapi.Expand(req.URL, map[string]string{
  1112. "alertId": c.alertId,
  1113. })
  1114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1115. }
  1116. // Do executes the "alertcenter.alerts.delete" call.
  1117. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1118. // code is an error. Response headers are in either
  1119. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1120. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1121. // check whether the returned error was because http.StatusNotModified
  1122. // was returned.
  1123. func (c *AlertsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1124. gensupport.SetOptions(c.urlParams_, opts...)
  1125. res, err := c.doRequest("json")
  1126. if res != nil && res.StatusCode == http.StatusNotModified {
  1127. if res.Body != nil {
  1128. res.Body.Close()
  1129. }
  1130. return nil, &googleapi.Error{
  1131. Code: res.StatusCode,
  1132. Header: res.Header,
  1133. }
  1134. }
  1135. if err != nil {
  1136. return nil, err
  1137. }
  1138. defer googleapi.CloseBody(res)
  1139. if err := googleapi.CheckResponse(res); err != nil {
  1140. return nil, err
  1141. }
  1142. ret := &Empty{
  1143. ServerResponse: googleapi.ServerResponse{
  1144. Header: res.Header,
  1145. HTTPStatusCode: res.StatusCode,
  1146. },
  1147. }
  1148. target := &ret
  1149. if err := gensupport.DecodeResponse(target, res); err != nil {
  1150. return nil, err
  1151. }
  1152. return ret, nil
  1153. // {
  1154. // "description": "Marks the specified alert for deletion. An alert that has been marked for\ndeletion is removed from Alert Center after 30 days.\nMarking an alert for deletion has no effect on an alert which has\nalready been marked for deletion. Attempting to mark a nonexistent alert\nfor deletion results in a `NOT_FOUND` error.",
  1155. // "flatPath": "v1beta1/alerts/{alertId}",
  1156. // "httpMethod": "DELETE",
  1157. // "id": "alertcenter.alerts.delete",
  1158. // "parameterOrder": [
  1159. // "alertId"
  1160. // ],
  1161. // "parameters": {
  1162. // "alertId": {
  1163. // "description": "Required. The identifier of the alert to delete.",
  1164. // "location": "path",
  1165. // "required": true,
  1166. // "type": "string"
  1167. // },
  1168. // "customerId": {
  1169. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert is associated with.\nInferred from the caller identity if not provided.",
  1170. // "location": "query",
  1171. // "type": "string"
  1172. // }
  1173. // },
  1174. // "path": "v1beta1/alerts/{alertId}",
  1175. // "response": {
  1176. // "$ref": "Empty"
  1177. // },
  1178. // "scopes": [
  1179. // "https://www.googleapis.com/auth/apps.alerts"
  1180. // ]
  1181. // }
  1182. }
  1183. // method id "alertcenter.alerts.get":
  1184. type AlertsGetCall struct {
  1185. s *Service
  1186. alertId string
  1187. urlParams_ gensupport.URLParams
  1188. ifNoneMatch_ string
  1189. ctx_ context.Context
  1190. header_ http.Header
  1191. }
  1192. // Get: Gets the specified alert. Attempting to get a nonexistent alert
  1193. // returns
  1194. // `NOT_FOUND` error.
  1195. func (r *AlertsService) Get(alertId string) *AlertsGetCall {
  1196. c := &AlertsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1197. c.alertId = alertId
  1198. return c
  1199. }
  1200. // CustomerId sets the optional parameter "customerId": The unique
  1201. // identifier of the G Suite organization account of the
  1202. // customer the alert is associated with.
  1203. // Inferred from the caller identity if not provided.
  1204. func (c *AlertsGetCall) CustomerId(customerId string) *AlertsGetCall {
  1205. c.urlParams_.Set("customerId", customerId)
  1206. return c
  1207. }
  1208. // Fields allows partial responses to be retrieved. See
  1209. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1210. // for more information.
  1211. func (c *AlertsGetCall) Fields(s ...googleapi.Field) *AlertsGetCall {
  1212. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1213. return c
  1214. }
  1215. // IfNoneMatch sets the optional parameter which makes the operation
  1216. // fail if the object's ETag matches the given value. This is useful for
  1217. // getting updates only after the object has changed since the last
  1218. // request. Use googleapi.IsNotModified to check whether the response
  1219. // error from Do is the result of In-None-Match.
  1220. func (c *AlertsGetCall) IfNoneMatch(entityTag string) *AlertsGetCall {
  1221. c.ifNoneMatch_ = entityTag
  1222. return c
  1223. }
  1224. // Context sets the context to be used in this call's Do method. Any
  1225. // pending HTTP request will be aborted if the provided context is
  1226. // canceled.
  1227. func (c *AlertsGetCall) Context(ctx context.Context) *AlertsGetCall {
  1228. c.ctx_ = ctx
  1229. return c
  1230. }
  1231. // Header returns an http.Header that can be modified by the caller to
  1232. // add HTTP headers to the request.
  1233. func (c *AlertsGetCall) Header() http.Header {
  1234. if c.header_ == nil {
  1235. c.header_ = make(http.Header)
  1236. }
  1237. return c.header_
  1238. }
  1239. func (c *AlertsGetCall) doRequest(alt string) (*http.Response, error) {
  1240. reqHeaders := make(http.Header)
  1241. for k, v := range c.header_ {
  1242. reqHeaders[k] = v
  1243. }
  1244. reqHeaders.Set("User-Agent", c.s.userAgent())
  1245. if c.ifNoneMatch_ != "" {
  1246. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1247. }
  1248. var body io.Reader = nil
  1249. c.urlParams_.Set("alt", alt)
  1250. c.urlParams_.Set("prettyPrint", "false")
  1251. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts/{alertId}")
  1252. urls += "?" + c.urlParams_.Encode()
  1253. req, err := http.NewRequest("GET", urls, body)
  1254. if err != nil {
  1255. return nil, err
  1256. }
  1257. req.Header = reqHeaders
  1258. googleapi.Expand(req.URL, map[string]string{
  1259. "alertId": c.alertId,
  1260. })
  1261. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1262. }
  1263. // Do executes the "alertcenter.alerts.get" call.
  1264. // Exactly one of *Alert or error will be non-nil. Any non-2xx status
  1265. // code is an error. Response headers are in either
  1266. // *Alert.ServerResponse.Header or (if a response was returned at all)
  1267. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1268. // check whether the returned error was because http.StatusNotModified
  1269. // was returned.
  1270. func (c *AlertsGetCall) Do(opts ...googleapi.CallOption) (*Alert, error) {
  1271. gensupport.SetOptions(c.urlParams_, opts...)
  1272. res, err := c.doRequest("json")
  1273. if res != nil && res.StatusCode == http.StatusNotModified {
  1274. if res.Body != nil {
  1275. res.Body.Close()
  1276. }
  1277. return nil, &googleapi.Error{
  1278. Code: res.StatusCode,
  1279. Header: res.Header,
  1280. }
  1281. }
  1282. if err != nil {
  1283. return nil, err
  1284. }
  1285. defer googleapi.CloseBody(res)
  1286. if err := googleapi.CheckResponse(res); err != nil {
  1287. return nil, err
  1288. }
  1289. ret := &Alert{
  1290. ServerResponse: googleapi.ServerResponse{
  1291. Header: res.Header,
  1292. HTTPStatusCode: res.StatusCode,
  1293. },
  1294. }
  1295. target := &ret
  1296. if err := gensupport.DecodeResponse(target, res); err != nil {
  1297. return nil, err
  1298. }
  1299. return ret, nil
  1300. // {
  1301. // "description": "Gets the specified alert. Attempting to get a nonexistent alert returns\n`NOT_FOUND` error.",
  1302. // "flatPath": "v1beta1/alerts/{alertId}",
  1303. // "httpMethod": "GET",
  1304. // "id": "alertcenter.alerts.get",
  1305. // "parameterOrder": [
  1306. // "alertId"
  1307. // ],
  1308. // "parameters": {
  1309. // "alertId": {
  1310. // "description": "Required. The identifier of the alert to retrieve.",
  1311. // "location": "path",
  1312. // "required": true,
  1313. // "type": "string"
  1314. // },
  1315. // "customerId": {
  1316. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert is associated with.\nInferred from the caller identity if not provided.",
  1317. // "location": "query",
  1318. // "type": "string"
  1319. // }
  1320. // },
  1321. // "path": "v1beta1/alerts/{alertId}",
  1322. // "response": {
  1323. // "$ref": "Alert"
  1324. // },
  1325. // "scopes": [
  1326. // "https://www.googleapis.com/auth/apps.alerts"
  1327. // ]
  1328. // }
  1329. }
  1330. // method id "alertcenter.alerts.list":
  1331. type AlertsListCall struct {
  1332. s *Service
  1333. urlParams_ gensupport.URLParams
  1334. ifNoneMatch_ string
  1335. ctx_ context.Context
  1336. header_ http.Header
  1337. }
  1338. // List: Lists the alerts.
  1339. func (r *AlertsService) List() *AlertsListCall {
  1340. c := &AlertsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1341. return c
  1342. }
  1343. // CustomerId sets the optional parameter "customerId": The unique
  1344. // identifier of the G Suite organization account of the
  1345. // customer the alerts are associated with.
  1346. // Inferred from the caller identity if not provided.
  1347. func (c *AlertsListCall) CustomerId(customerId string) *AlertsListCall {
  1348. c.urlParams_.Set("customerId", customerId)
  1349. return c
  1350. }
  1351. // Filter sets the optional parameter "filter": A query string for
  1352. // filtering alert results.
  1353. // For more details, see
  1354. // [Query
  1355. // filters](/admin-sdk/alertcenter/guides/query-filters) and
  1356. // [Supported
  1357. // query
  1358. // filter
  1359. // fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.l
  1360. // ist).
  1361. func (c *AlertsListCall) Filter(filter string) *AlertsListCall {
  1362. c.urlParams_.Set("filter", filter)
  1363. return c
  1364. }
  1365. // OrderBy sets the optional parameter "orderBy": The sort order of the
  1366. // list results.
  1367. // If not specified results may be returned in arbitrary order.
  1368. // You can sort the results in descending order based on the
  1369. // creation
  1370. // timestamp using `order_by="create_time desc".
  1371. // Currently, only sorting by `create_time desc` is supported.
  1372. func (c *AlertsListCall) OrderBy(orderBy string) *AlertsListCall {
  1373. c.urlParams_.Set("orderBy", orderBy)
  1374. return c
  1375. }
  1376. // PageSize sets the optional parameter "pageSize": The requested page
  1377. // size. Server may return fewer items than
  1378. // requested. If unspecified, server picks an appropriate default.
  1379. func (c *AlertsListCall) PageSize(pageSize int64) *AlertsListCall {
  1380. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1381. return c
  1382. }
  1383. // PageToken sets the optional parameter "pageToken": A token
  1384. // identifying a page of results the server should return.
  1385. // If empty, a new iteration is started. To continue an iteration, pass
  1386. // in
  1387. // the value from the previous ListAlertsResponse's
  1388. // next_page_token field.
  1389. func (c *AlertsListCall) PageToken(pageToken string) *AlertsListCall {
  1390. c.urlParams_.Set("pageToken", pageToken)
  1391. return c
  1392. }
  1393. // Fields allows partial responses to be retrieved. See
  1394. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1395. // for more information.
  1396. func (c *AlertsListCall) Fields(s ...googleapi.Field) *AlertsListCall {
  1397. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1398. return c
  1399. }
  1400. // IfNoneMatch sets the optional parameter which makes the operation
  1401. // fail if the object's ETag matches the given value. This is useful for
  1402. // getting updates only after the object has changed since the last
  1403. // request. Use googleapi.IsNotModified to check whether the response
  1404. // error from Do is the result of In-None-Match.
  1405. func (c *AlertsListCall) IfNoneMatch(entityTag string) *AlertsListCall {
  1406. c.ifNoneMatch_ = entityTag
  1407. return c
  1408. }
  1409. // Context sets the context to be used in this call's Do method. Any
  1410. // pending HTTP request will be aborted if the provided context is
  1411. // canceled.
  1412. func (c *AlertsListCall) Context(ctx context.Context) *AlertsListCall {
  1413. c.ctx_ = ctx
  1414. return c
  1415. }
  1416. // Header returns an http.Header that can be modified by the caller to
  1417. // add HTTP headers to the request.
  1418. func (c *AlertsListCall) Header() http.Header {
  1419. if c.header_ == nil {
  1420. c.header_ = make(http.Header)
  1421. }
  1422. return c.header_
  1423. }
  1424. func (c *AlertsListCall) doRequest(alt string) (*http.Response, error) {
  1425. reqHeaders := make(http.Header)
  1426. for k, v := range c.header_ {
  1427. reqHeaders[k] = v
  1428. }
  1429. reqHeaders.Set("User-Agent", c.s.userAgent())
  1430. if c.ifNoneMatch_ != "" {
  1431. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1432. }
  1433. var body io.Reader = nil
  1434. c.urlParams_.Set("alt", alt)
  1435. c.urlParams_.Set("prettyPrint", "false")
  1436. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts")
  1437. urls += "?" + c.urlParams_.Encode()
  1438. req, err := http.NewRequest("GET", urls, body)
  1439. if err != nil {
  1440. return nil, err
  1441. }
  1442. req.Header = reqHeaders
  1443. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1444. }
  1445. // Do executes the "alertcenter.alerts.list" call.
  1446. // Exactly one of *ListAlertsResponse or error will be non-nil. Any
  1447. // non-2xx status code is an error. Response headers are in either
  1448. // *ListAlertsResponse.ServerResponse.Header or (if a response was
  1449. // returned at all) in error.(*googleapi.Error).Header. Use
  1450. // googleapi.IsNotModified to check whether the returned error was
  1451. // because http.StatusNotModified was returned.
  1452. func (c *AlertsListCall) Do(opts ...googleapi.CallOption) (*ListAlertsResponse, error) {
  1453. gensupport.SetOptions(c.urlParams_, opts...)
  1454. res, err := c.doRequest("json")
  1455. if res != nil && res.StatusCode == http.StatusNotModified {
  1456. if res.Body != nil {
  1457. res.Body.Close()
  1458. }
  1459. return nil, &googleapi.Error{
  1460. Code: res.StatusCode,
  1461. Header: res.Header,
  1462. }
  1463. }
  1464. if err != nil {
  1465. return nil, err
  1466. }
  1467. defer googleapi.CloseBody(res)
  1468. if err := googleapi.CheckResponse(res); err != nil {
  1469. return nil, err
  1470. }
  1471. ret := &ListAlertsResponse{
  1472. ServerResponse: googleapi.ServerResponse{
  1473. Header: res.Header,
  1474. HTTPStatusCode: res.StatusCode,
  1475. },
  1476. }
  1477. target := &ret
  1478. if err := gensupport.DecodeResponse(target, res); err != nil {
  1479. return nil, err
  1480. }
  1481. return ret, nil
  1482. // {
  1483. // "description": "Lists the alerts.",
  1484. // "flatPath": "v1beta1/alerts",
  1485. // "httpMethod": "GET",
  1486. // "id": "alertcenter.alerts.list",
  1487. // "parameterOrder": [],
  1488. // "parameters": {
  1489. // "customerId": {
  1490. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alerts are associated with.\nInferred from the caller identity if not provided.",
  1491. // "location": "query",
  1492. // "type": "string"
  1493. // },
  1494. // "filter": {
  1495. // "description": "Optional. A query string for filtering alert results.\nFor more details, see [Query\nfilters](/admin-sdk/alertcenter/guides/query-filters) and [Supported\nquery filter\nfields](/admin-sdk/alertcenter/reference/filter-fields#alerts.list).",
  1496. // "location": "query",
  1497. // "type": "string"
  1498. // },
  1499. // "orderBy": {
  1500. // "description": "Optional. The sort order of the list results.\nIf not specified results may be returned in arbitrary order.\nYou can sort the results in descending order based on the creation\ntimestamp using `order_by=\"create_time desc\"`.\nCurrently, only sorting by `create_time desc` is supported.",
  1501. // "location": "query",
  1502. // "type": "string"
  1503. // },
  1504. // "pageSize": {
  1505. // "description": "Optional. The requested page size. Server may return fewer items than\nrequested. If unspecified, server picks an appropriate default.",
  1506. // "format": "int32",
  1507. // "location": "query",
  1508. // "type": "integer"
  1509. // },
  1510. // "pageToken": {
  1511. // "description": "Optional. A token identifying a page of results the server should return.\nIf empty, a new iteration is started. To continue an iteration, pass in\nthe value from the previous ListAlertsResponse's\nnext_page_token field.",
  1512. // "location": "query",
  1513. // "type": "string"
  1514. // }
  1515. // },
  1516. // "path": "v1beta1/alerts",
  1517. // "response": {
  1518. // "$ref": "ListAlertsResponse"
  1519. // },
  1520. // "scopes": [
  1521. // "https://www.googleapis.com/auth/apps.alerts"
  1522. // ]
  1523. // }
  1524. }
  1525. // Pages invokes f for each page of results.
  1526. // A non-nil error returned from f will halt the iteration.
  1527. // The provided context supersedes any context provided to the Context method.
  1528. func (c *AlertsListCall) Pages(ctx context.Context, f func(*ListAlertsResponse) error) error {
  1529. c.ctx_ = ctx
  1530. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1531. for {
  1532. x, err := c.Do()
  1533. if err != nil {
  1534. return err
  1535. }
  1536. if err := f(x); err != nil {
  1537. return err
  1538. }
  1539. if x.NextPageToken == "" {
  1540. return nil
  1541. }
  1542. c.PageToken(x.NextPageToken)
  1543. }
  1544. }
  1545. // method id "alertcenter.alerts.undelete":
  1546. type AlertsUndeleteCall struct {
  1547. s *Service
  1548. alertId string
  1549. undeletealertrequest *UndeleteAlertRequest
  1550. urlParams_ gensupport.URLParams
  1551. ctx_ context.Context
  1552. header_ http.Header
  1553. }
  1554. // Undelete: Restores, or "undeletes", an alert that was marked for
  1555. // deletion within the
  1556. // past 30 days. Attempting to undelete an alert which was marked for
  1557. // deletion
  1558. // over 30 days ago (which has been removed from the Alert Center
  1559. // database) or
  1560. // a nonexistent alert returns a `NOT_FOUND` error. Attempting
  1561. // to
  1562. // undelete an alert which has not been marked for deletion has no
  1563. // effect.
  1564. func (r *AlertsService) Undelete(alertId string, undeletealertrequest *UndeleteAlertRequest) *AlertsUndeleteCall {
  1565. c := &AlertsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1566. c.alertId = alertId
  1567. c.undeletealertrequest = undeletealertrequest
  1568. return c
  1569. }
  1570. // Fields allows partial responses to be retrieved. See
  1571. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1572. // for more information.
  1573. func (c *AlertsUndeleteCall) Fields(s ...googleapi.Field) *AlertsUndeleteCall {
  1574. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1575. return c
  1576. }
  1577. // Context sets the context to be used in this call's Do method. Any
  1578. // pending HTTP request will be aborted if the provided context is
  1579. // canceled.
  1580. func (c *AlertsUndeleteCall) Context(ctx context.Context) *AlertsUndeleteCall {
  1581. c.ctx_ = ctx
  1582. return c
  1583. }
  1584. // Header returns an http.Header that can be modified by the caller to
  1585. // add HTTP headers to the request.
  1586. func (c *AlertsUndeleteCall) Header() http.Header {
  1587. if c.header_ == nil {
  1588. c.header_ = make(http.Header)
  1589. }
  1590. return c.header_
  1591. }
  1592. func (c *AlertsUndeleteCall) doRequest(alt string) (*http.Response, error) {
  1593. reqHeaders := make(http.Header)
  1594. for k, v := range c.header_ {
  1595. reqHeaders[k] = v
  1596. }
  1597. reqHeaders.Set("User-Agent", c.s.userAgent())
  1598. var body io.Reader = nil
  1599. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeletealertrequest)
  1600. if err != nil {
  1601. return nil, err
  1602. }
  1603. reqHeaders.Set("Content-Type", "application/json")
  1604. c.urlParams_.Set("alt", alt)
  1605. c.urlParams_.Set("prettyPrint", "false")
  1606. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts/{alertId}:undelete")
  1607. urls += "?" + c.urlParams_.Encode()
  1608. req, err := http.NewRequest("POST", urls, body)
  1609. if err != nil {
  1610. return nil, err
  1611. }
  1612. req.Header = reqHeaders
  1613. googleapi.Expand(req.URL, map[string]string{
  1614. "alertId": c.alertId,
  1615. })
  1616. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1617. }
  1618. // Do executes the "alertcenter.alerts.undelete" call.
  1619. // Exactly one of *Alert or error will be non-nil. Any non-2xx status
  1620. // code is an error. Response headers are in either
  1621. // *Alert.ServerResponse.Header or (if a response was returned at all)
  1622. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1623. // check whether the returned error was because http.StatusNotModified
  1624. // was returned.
  1625. func (c *AlertsUndeleteCall) Do(opts ...googleapi.CallOption) (*Alert, error) {
  1626. gensupport.SetOptions(c.urlParams_, opts...)
  1627. res, err := c.doRequest("json")
  1628. if res != nil && res.StatusCode == http.StatusNotModified {
  1629. if res.Body != nil {
  1630. res.Body.Close()
  1631. }
  1632. return nil, &googleapi.Error{
  1633. Code: res.StatusCode,
  1634. Header: res.Header,
  1635. }
  1636. }
  1637. if err != nil {
  1638. return nil, err
  1639. }
  1640. defer googleapi.CloseBody(res)
  1641. if err := googleapi.CheckResponse(res); err != nil {
  1642. return nil, err
  1643. }
  1644. ret := &Alert{
  1645. ServerResponse: googleapi.ServerResponse{
  1646. Header: res.Header,
  1647. HTTPStatusCode: res.StatusCode,
  1648. },
  1649. }
  1650. target := &ret
  1651. if err := gensupport.DecodeResponse(target, res); err != nil {
  1652. return nil, err
  1653. }
  1654. return ret, nil
  1655. // {
  1656. // "description": "Restores, or \"undeletes\", an alert that was marked for deletion within the\npast 30 days. Attempting to undelete an alert which was marked for deletion\nover 30 days ago (which has been removed from the Alert Center database) or\na nonexistent alert returns a `NOT_FOUND` error. Attempting to\nundelete an alert which has not been marked for deletion has no effect.",
  1657. // "flatPath": "v1beta1/alerts/{alertId}:undelete",
  1658. // "httpMethod": "POST",
  1659. // "id": "alertcenter.alerts.undelete",
  1660. // "parameterOrder": [
  1661. // "alertId"
  1662. // ],
  1663. // "parameters": {
  1664. // "alertId": {
  1665. // "description": "Required. The identifier of the alert to undelete.",
  1666. // "location": "path",
  1667. // "required": true,
  1668. // "type": "string"
  1669. // }
  1670. // },
  1671. // "path": "v1beta1/alerts/{alertId}:undelete",
  1672. // "request": {
  1673. // "$ref": "UndeleteAlertRequest"
  1674. // },
  1675. // "response": {
  1676. // "$ref": "Alert"
  1677. // },
  1678. // "scopes": [
  1679. // "https://www.googleapis.com/auth/apps.alerts"
  1680. // ]
  1681. // }
  1682. }
  1683. // method id "alertcenter.alerts.feedback.create":
  1684. type AlertsFeedbackCreateCall struct {
  1685. s *Service
  1686. alertId string
  1687. alertfeedback *AlertFeedback
  1688. urlParams_ gensupport.URLParams
  1689. ctx_ context.Context
  1690. header_ http.Header
  1691. }
  1692. // Create: Creates new feedback for an alert. Attempting to create a
  1693. // feedback for
  1694. // a non-existent alert returns `NOT_FOUND` error.
  1695. func (r *AlertsFeedbackService) Create(alertId string, alertfeedback *AlertFeedback) *AlertsFeedbackCreateCall {
  1696. c := &AlertsFeedbackCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1697. c.alertId = alertId
  1698. c.alertfeedback = alertfeedback
  1699. return c
  1700. }
  1701. // CustomerId sets the optional parameter "customerId": The unique
  1702. // identifier of the G Suite organization account of the
  1703. // customer the alert is associated with.
  1704. // Inferred from the caller identity if not provided.
  1705. func (c *AlertsFeedbackCreateCall) CustomerId(customerId string) *AlertsFeedbackCreateCall {
  1706. c.urlParams_.Set("customerId", customerId)
  1707. return c
  1708. }
  1709. // Fields allows partial responses to be retrieved. See
  1710. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1711. // for more information.
  1712. func (c *AlertsFeedbackCreateCall) Fields(s ...googleapi.Field) *AlertsFeedbackCreateCall {
  1713. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1714. return c
  1715. }
  1716. // Context sets the context to be used in this call's Do method. Any
  1717. // pending HTTP request will be aborted if the provided context is
  1718. // canceled.
  1719. func (c *AlertsFeedbackCreateCall) Context(ctx context.Context) *AlertsFeedbackCreateCall {
  1720. c.ctx_ = ctx
  1721. return c
  1722. }
  1723. // Header returns an http.Header that can be modified by the caller to
  1724. // add HTTP headers to the request.
  1725. func (c *AlertsFeedbackCreateCall) Header() http.Header {
  1726. if c.header_ == nil {
  1727. c.header_ = make(http.Header)
  1728. }
  1729. return c.header_
  1730. }
  1731. func (c *AlertsFeedbackCreateCall) doRequest(alt string) (*http.Response, error) {
  1732. reqHeaders := make(http.Header)
  1733. for k, v := range c.header_ {
  1734. reqHeaders[k] = v
  1735. }
  1736. reqHeaders.Set("User-Agent", c.s.userAgent())
  1737. var body io.Reader = nil
  1738. body, err := googleapi.WithoutDataWrapper.JSONReader(c.alertfeedback)
  1739. if err != nil {
  1740. return nil, err
  1741. }
  1742. reqHeaders.Set("Content-Type", "application/json")
  1743. c.urlParams_.Set("alt", alt)
  1744. c.urlParams_.Set("prettyPrint", "false")
  1745. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts/{alertId}/feedback")
  1746. urls += "?" + c.urlParams_.Encode()
  1747. req, err := http.NewRequest("POST", urls, body)
  1748. if err != nil {
  1749. return nil, err
  1750. }
  1751. req.Header = reqHeaders
  1752. googleapi.Expand(req.URL, map[string]string{
  1753. "alertId": c.alertId,
  1754. })
  1755. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1756. }
  1757. // Do executes the "alertcenter.alerts.feedback.create" call.
  1758. // Exactly one of *AlertFeedback or error will be non-nil. Any non-2xx
  1759. // status code is an error. Response headers are in either
  1760. // *AlertFeedback.ServerResponse.Header or (if a response was returned
  1761. // at all) in error.(*googleapi.Error).Header. Use
  1762. // googleapi.IsNotModified to check whether the returned error was
  1763. // because http.StatusNotModified was returned.
  1764. func (c *AlertsFeedbackCreateCall) Do(opts ...googleapi.CallOption) (*AlertFeedback, error) {
  1765. gensupport.SetOptions(c.urlParams_, opts...)
  1766. res, err := c.doRequest("json")
  1767. if res != nil && res.StatusCode == http.StatusNotModified {
  1768. if res.Body != nil {
  1769. res.Body.Close()
  1770. }
  1771. return nil, &googleapi.Error{
  1772. Code: res.StatusCode,
  1773. Header: res.Header,
  1774. }
  1775. }
  1776. if err != nil {
  1777. return nil, err
  1778. }
  1779. defer googleapi.CloseBody(res)
  1780. if err := googleapi.CheckResponse(res); err != nil {
  1781. return nil, err
  1782. }
  1783. ret := &AlertFeedback{
  1784. ServerResponse: googleapi.ServerResponse{
  1785. Header: res.Header,
  1786. HTTPStatusCode: res.StatusCode,
  1787. },
  1788. }
  1789. target := &ret
  1790. if err := gensupport.DecodeResponse(target, res); err != nil {
  1791. return nil, err
  1792. }
  1793. return ret, nil
  1794. // {
  1795. // "description": "Creates new feedback for an alert. Attempting to create a feedback for\na non-existent alert returns `NOT_FOUND` error.",
  1796. // "flatPath": "v1beta1/alerts/{alertId}/feedback",
  1797. // "httpMethod": "POST",
  1798. // "id": "alertcenter.alerts.feedback.create",
  1799. // "parameterOrder": [
  1800. // "alertId"
  1801. // ],
  1802. // "parameters": {
  1803. // "alertId": {
  1804. // "description": "Required. The identifier of the alert this feedback belongs to.",
  1805. // "location": "path",
  1806. // "required": true,
  1807. // "type": "string"
  1808. // },
  1809. // "customerId": {
  1810. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert is associated with.\nInferred from the caller identity if not provided.",
  1811. // "location": "query",
  1812. // "type": "string"
  1813. // }
  1814. // },
  1815. // "path": "v1beta1/alerts/{alertId}/feedback",
  1816. // "request": {
  1817. // "$ref": "AlertFeedback"
  1818. // },
  1819. // "response": {
  1820. // "$ref": "AlertFeedback"
  1821. // },
  1822. // "scopes": [
  1823. // "https://www.googleapis.com/auth/apps.alerts"
  1824. // ]
  1825. // }
  1826. }
  1827. // method id "alertcenter.alerts.feedback.list":
  1828. type AlertsFeedbackListCall struct {
  1829. s *Service
  1830. alertId string
  1831. urlParams_ gensupport.URLParams
  1832. ifNoneMatch_ string
  1833. ctx_ context.Context
  1834. header_ http.Header
  1835. }
  1836. // List: Lists all the feedback for an alert. Attempting to list
  1837. // feedbacks for
  1838. // a non-existent alert returns `NOT_FOUND` error.
  1839. func (r *AlertsFeedbackService) List(alertId string) *AlertsFeedbackListCall {
  1840. c := &AlertsFeedbackListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1841. c.alertId = alertId
  1842. return c
  1843. }
  1844. // CustomerId sets the optional parameter "customerId": The unique
  1845. // identifier of the G Suite organization account of the
  1846. // customer the alert feedback are associated with.
  1847. // Inferred from the caller identity if not provided.
  1848. func (c *AlertsFeedbackListCall) CustomerId(customerId string) *AlertsFeedbackListCall {
  1849. c.urlParams_.Set("customerId", customerId)
  1850. return c
  1851. }
  1852. // Filter sets the optional parameter "filter": A query string for
  1853. // filtering alert feedback results.
  1854. // For more details, see
  1855. // [Query
  1856. // filters](/admin-sdk/alertcenter/guides/query-filters) and
  1857. // [Supported
  1858. // query
  1859. // filter
  1860. // fields](/admin-sdk/alertcenter/reference/filter-fields#alerts.f
  1861. // eedback.list).
  1862. func (c *AlertsFeedbackListCall) Filter(filter string) *AlertsFeedbackListCall {
  1863. c.urlParams_.Set("filter", filter)
  1864. return c
  1865. }
  1866. // Fields allows partial responses to be retrieved. See
  1867. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1868. // for more information.
  1869. func (c *AlertsFeedbackListCall) Fields(s ...googleapi.Field) *AlertsFeedbackListCall {
  1870. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1871. return c
  1872. }
  1873. // IfNoneMatch sets the optional parameter which makes the operation
  1874. // fail if the object's ETag matches the given value. This is useful for
  1875. // getting updates only after the object has changed since the last
  1876. // request. Use googleapi.IsNotModified to check whether the response
  1877. // error from Do is the result of In-None-Match.
  1878. func (c *AlertsFeedbackListCall) IfNoneMatch(entityTag string) *AlertsFeedbackListCall {
  1879. c.ifNoneMatch_ = entityTag
  1880. return c
  1881. }
  1882. // Context sets the context to be used in this call's Do method. Any
  1883. // pending HTTP request will be aborted if the provided context is
  1884. // canceled.
  1885. func (c *AlertsFeedbackListCall) Context(ctx context.Context) *AlertsFeedbackListCall {
  1886. c.ctx_ = ctx
  1887. return c
  1888. }
  1889. // Header returns an http.Header that can be modified by the caller to
  1890. // add HTTP headers to the request.
  1891. func (c *AlertsFeedbackListCall) Header() http.Header {
  1892. if c.header_ == nil {
  1893. c.header_ = make(http.Header)
  1894. }
  1895. return c.header_
  1896. }
  1897. func (c *AlertsFeedbackListCall) doRequest(alt string) (*http.Response, error) {
  1898. reqHeaders := make(http.Header)
  1899. for k, v := range c.header_ {
  1900. reqHeaders[k] = v
  1901. }
  1902. reqHeaders.Set("User-Agent", c.s.userAgent())
  1903. if c.ifNoneMatch_ != "" {
  1904. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1905. }
  1906. var body io.Reader = nil
  1907. c.urlParams_.Set("alt", alt)
  1908. c.urlParams_.Set("prettyPrint", "false")
  1909. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/alerts/{alertId}/feedback")
  1910. urls += "?" + c.urlParams_.Encode()
  1911. req, err := http.NewRequest("GET", urls, body)
  1912. if err != nil {
  1913. return nil, err
  1914. }
  1915. req.Header = reqHeaders
  1916. googleapi.Expand(req.URL, map[string]string{
  1917. "alertId": c.alertId,
  1918. })
  1919. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1920. }
  1921. // Do executes the "alertcenter.alerts.feedback.list" call.
  1922. // Exactly one of *ListAlertFeedbackResponse or error will be non-nil.
  1923. // Any non-2xx status code is an error. Response headers are in either
  1924. // *ListAlertFeedbackResponse.ServerResponse.Header or (if a response
  1925. // was returned at all) in error.(*googleapi.Error).Header. Use
  1926. // googleapi.IsNotModified to check whether the returned error was
  1927. // because http.StatusNotModified was returned.
  1928. func (c *AlertsFeedbackListCall) Do(opts ...googleapi.CallOption) (*ListAlertFeedbackResponse, error) {
  1929. gensupport.SetOptions(c.urlParams_, opts...)
  1930. res, err := c.doRequest("json")
  1931. if res != nil && res.StatusCode == http.StatusNotModified {
  1932. if res.Body != nil {
  1933. res.Body.Close()
  1934. }
  1935. return nil, &googleapi.Error{
  1936. Code: res.StatusCode,
  1937. Header: res.Header,
  1938. }
  1939. }
  1940. if err != nil {
  1941. return nil, err
  1942. }
  1943. defer googleapi.CloseBody(res)
  1944. if err := googleapi.CheckResponse(res); err != nil {
  1945. return nil, err
  1946. }
  1947. ret := &ListAlertFeedbackResponse{
  1948. ServerResponse: googleapi.ServerResponse{
  1949. Header: res.Header,
  1950. HTTPStatusCode: res.StatusCode,
  1951. },
  1952. }
  1953. target := &ret
  1954. if err := gensupport.DecodeResponse(target, res); err != nil {
  1955. return nil, err
  1956. }
  1957. return ret, nil
  1958. // {
  1959. // "description": "Lists all the feedback for an alert. Attempting to list feedbacks for\na non-existent alert returns `NOT_FOUND` error.",
  1960. // "flatPath": "v1beta1/alerts/{alertId}/feedback",
  1961. // "httpMethod": "GET",
  1962. // "id": "alertcenter.alerts.feedback.list",
  1963. // "parameterOrder": [
  1964. // "alertId"
  1965. // ],
  1966. // "parameters": {
  1967. // "alertId": {
  1968. // "description": "Required. The alert identifier.\nThe \"-\" wildcard could be used to represent all alerts.",
  1969. // "location": "path",
  1970. // "required": true,
  1971. // "type": "string"
  1972. // },
  1973. // "customerId": {
  1974. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert feedback are associated with.\nInferred from the caller identity if not provided.",
  1975. // "location": "query",
  1976. // "type": "string"
  1977. // },
  1978. // "filter": {
  1979. // "description": "Optional. A query string for filtering alert feedback results.\nFor more details, see [Query\nfilters](/admin-sdk/alertcenter/guides/query-filters) and [Supported\nquery filter\nfields](/admin-sdk/alertcenter/reference/filter-fields#alerts.feedback.list).",
  1980. // "location": "query",
  1981. // "type": "string"
  1982. // }
  1983. // },
  1984. // "path": "v1beta1/alerts/{alertId}/feedback",
  1985. // "response": {
  1986. // "$ref": "ListAlertFeedbackResponse"
  1987. // },
  1988. // "scopes": [
  1989. // "https://www.googleapis.com/auth/apps.alerts"
  1990. // ]
  1991. // }
  1992. }
  1993. // method id "alertcenter.getSettings":
  1994. type V1beta1GetSettingsCall struct {
  1995. s *Service
  1996. urlParams_ gensupport.URLParams
  1997. ifNoneMatch_ string
  1998. ctx_ context.Context
  1999. header_ http.Header
  2000. }
  2001. // GetSettings: Returns customer-level settings.
  2002. func (r *V1beta1Service) GetSettings() *V1beta1GetSettingsCall {
  2003. c := &V1beta1GetSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2004. return c
  2005. }
  2006. // CustomerId sets the optional parameter "customerId": The unique
  2007. // identifier of the G Suite organization account of the
  2008. // customer the alert settings are associated with.
  2009. // Inferred from the caller identity if not provided.
  2010. func (c *V1beta1GetSettingsCall) CustomerId(customerId string) *V1beta1GetSettingsCall {
  2011. c.urlParams_.Set("customerId", customerId)
  2012. return c
  2013. }
  2014. // Fields allows partial responses to be retrieved. See
  2015. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2016. // for more information.
  2017. func (c *V1beta1GetSettingsCall) Fields(s ...googleapi.Field) *V1beta1GetSettingsCall {
  2018. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2019. return c
  2020. }
  2021. // IfNoneMatch sets the optional parameter which makes the operation
  2022. // fail if the object's ETag matches the given value. This is useful for
  2023. // getting updates only after the object has changed since the last
  2024. // request. Use googleapi.IsNotModified to check whether the response
  2025. // error from Do is the result of In-None-Match.
  2026. func (c *V1beta1GetSettingsCall) IfNoneMatch(entityTag string) *V1beta1GetSettingsCall {
  2027. c.ifNoneMatch_ = entityTag
  2028. return c
  2029. }
  2030. // Context sets the context to be used in this call's Do method. Any
  2031. // pending HTTP request will be aborted if the provided context is
  2032. // canceled.
  2033. func (c *V1beta1GetSettingsCall) Context(ctx context.Context) *V1beta1GetSettingsCall {
  2034. c.ctx_ = ctx
  2035. return c
  2036. }
  2037. // Header returns an http.Header that can be modified by the caller to
  2038. // add HTTP headers to the request.
  2039. func (c *V1beta1GetSettingsCall) Header() http.Header {
  2040. if c.header_ == nil {
  2041. c.header_ = make(http.Header)
  2042. }
  2043. return c.header_
  2044. }
  2045. func (c *V1beta1GetSettingsCall) doRequest(alt string) (*http.Response, error) {
  2046. reqHeaders := make(http.Header)
  2047. for k, v := range c.header_ {
  2048. reqHeaders[k] = v
  2049. }
  2050. reqHeaders.Set("User-Agent", c.s.userAgent())
  2051. if c.ifNoneMatch_ != "" {
  2052. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2053. }
  2054. var body io.Reader = nil
  2055. c.urlParams_.Set("alt", alt)
  2056. c.urlParams_.Set("prettyPrint", "false")
  2057. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/settings")
  2058. urls += "?" + c.urlParams_.Encode()
  2059. req, err := http.NewRequest("GET", urls, body)
  2060. if err != nil {
  2061. return nil, err
  2062. }
  2063. req.Header = reqHeaders
  2064. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2065. }
  2066. // Do executes the "alertcenter.getSettings" call.
  2067. // Exactly one of *Settings or error will be non-nil. Any non-2xx status
  2068. // code is an error. Response headers are in either
  2069. // *Settings.ServerResponse.Header or (if a response was returned at
  2070. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2071. // to check whether the returned error was because
  2072. // http.StatusNotModified was returned.
  2073. func (c *V1beta1GetSettingsCall) Do(opts ...googleapi.CallOption) (*Settings, error) {
  2074. gensupport.SetOptions(c.urlParams_, opts...)
  2075. res, err := c.doRequest("json")
  2076. if res != nil && res.StatusCode == http.StatusNotModified {
  2077. if res.Body != nil {
  2078. res.Body.Close()
  2079. }
  2080. return nil, &googleapi.Error{
  2081. Code: res.StatusCode,
  2082. Header: res.Header,
  2083. }
  2084. }
  2085. if err != nil {
  2086. return nil, err
  2087. }
  2088. defer googleapi.CloseBody(res)
  2089. if err := googleapi.CheckResponse(res); err != nil {
  2090. return nil, err
  2091. }
  2092. ret := &Settings{
  2093. ServerResponse: googleapi.ServerResponse{
  2094. Header: res.Header,
  2095. HTTPStatusCode: res.StatusCode,
  2096. },
  2097. }
  2098. target := &ret
  2099. if err := gensupport.DecodeResponse(target, res); err != nil {
  2100. return nil, err
  2101. }
  2102. return ret, nil
  2103. // {
  2104. // "description": "Returns customer-level settings.",
  2105. // "flatPath": "v1beta1/settings",
  2106. // "httpMethod": "GET",
  2107. // "id": "alertcenter.getSettings",
  2108. // "parameterOrder": [],
  2109. // "parameters": {
  2110. // "customerId": {
  2111. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert settings are associated with.\nInferred from the caller identity if not provided.",
  2112. // "location": "query",
  2113. // "type": "string"
  2114. // }
  2115. // },
  2116. // "path": "v1beta1/settings",
  2117. // "response": {
  2118. // "$ref": "Settings"
  2119. // },
  2120. // "scopes": [
  2121. // "https://www.googleapis.com/auth/apps.alerts"
  2122. // ]
  2123. // }
  2124. }
  2125. // method id "alertcenter.updateSettings":
  2126. type V1beta1UpdateSettingsCall struct {
  2127. s *Service
  2128. settings *Settings
  2129. urlParams_ gensupport.URLParams
  2130. ctx_ context.Context
  2131. header_ http.Header
  2132. }
  2133. // UpdateSettings: Updates the customer-level settings.
  2134. func (r *V1beta1Service) UpdateSettings(settings *Settings) *V1beta1UpdateSettingsCall {
  2135. c := &V1beta1UpdateSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2136. c.settings = settings
  2137. return c
  2138. }
  2139. // CustomerId sets the optional parameter "customerId": The unique
  2140. // identifier of the G Suite organization account of the
  2141. // customer the alert settings are associated with.
  2142. // Inferred from the caller identity if not provided.
  2143. func (c *V1beta1UpdateSettingsCall) CustomerId(customerId string) *V1beta1UpdateSettingsCall {
  2144. c.urlParams_.Set("customerId", customerId)
  2145. return c
  2146. }
  2147. // Fields allows partial responses to be retrieved. See
  2148. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2149. // for more information.
  2150. func (c *V1beta1UpdateSettingsCall) Fields(s ...googleapi.Field) *V1beta1UpdateSettingsCall {
  2151. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2152. return c
  2153. }
  2154. // Context sets the context to be used in this call's Do method. Any
  2155. // pending HTTP request will be aborted if the provided context is
  2156. // canceled.
  2157. func (c *V1beta1UpdateSettingsCall) Context(ctx context.Context) *V1beta1UpdateSettingsCall {
  2158. c.ctx_ = ctx
  2159. return c
  2160. }
  2161. // Header returns an http.Header that can be modified by the caller to
  2162. // add HTTP headers to the request.
  2163. func (c *V1beta1UpdateSettingsCall) Header() http.Header {
  2164. if c.header_ == nil {
  2165. c.header_ = make(http.Header)
  2166. }
  2167. return c.header_
  2168. }
  2169. func (c *V1beta1UpdateSettingsCall) doRequest(alt string) (*http.Response, error) {
  2170. reqHeaders := make(http.Header)
  2171. for k, v := range c.header_ {
  2172. reqHeaders[k] = v
  2173. }
  2174. reqHeaders.Set("User-Agent", c.s.userAgent())
  2175. var body io.Reader = nil
  2176. body, err := googleapi.WithoutDataWrapper.JSONReader(c.settings)
  2177. if err != nil {
  2178. return nil, err
  2179. }
  2180. reqHeaders.Set("Content-Type", "application/json")
  2181. c.urlParams_.Set("alt", alt)
  2182. c.urlParams_.Set("prettyPrint", "false")
  2183. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/settings")
  2184. urls += "?" + c.urlParams_.Encode()
  2185. req, err := http.NewRequest("PATCH", urls, body)
  2186. if err != nil {
  2187. return nil, err
  2188. }
  2189. req.Header = reqHeaders
  2190. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2191. }
  2192. // Do executes the "alertcenter.updateSettings" call.
  2193. // Exactly one of *Settings or error will be non-nil. Any non-2xx status
  2194. // code is an error. Response headers are in either
  2195. // *Settings.ServerResponse.Header or (if a response was returned at
  2196. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2197. // to check whether the returned error was because
  2198. // http.StatusNotModified was returned.
  2199. func (c *V1beta1UpdateSettingsCall) Do(opts ...googleapi.CallOption) (*Settings, error) {
  2200. gensupport.SetOptions(c.urlParams_, opts...)
  2201. res, err := c.doRequest("json")
  2202. if res != nil && res.StatusCode == http.StatusNotModified {
  2203. if res.Body != nil {
  2204. res.Body.Close()
  2205. }
  2206. return nil, &googleapi.Error{
  2207. Code: res.StatusCode,
  2208. Header: res.Header,
  2209. }
  2210. }
  2211. if err != nil {
  2212. return nil, err
  2213. }
  2214. defer googleapi.CloseBody(res)
  2215. if err := googleapi.CheckResponse(res); err != nil {
  2216. return nil, err
  2217. }
  2218. ret := &Settings{
  2219. ServerResponse: googleapi.ServerResponse{
  2220. Header: res.Header,
  2221. HTTPStatusCode: res.StatusCode,
  2222. },
  2223. }
  2224. target := &ret
  2225. if err := gensupport.DecodeResponse(target, res); err != nil {
  2226. return nil, err
  2227. }
  2228. return ret, nil
  2229. // {
  2230. // "description": "Updates the customer-level settings.",
  2231. // "flatPath": "v1beta1/settings",
  2232. // "httpMethod": "PATCH",
  2233. // "id": "alertcenter.updateSettings",
  2234. // "parameterOrder": [],
  2235. // "parameters": {
  2236. // "customerId": {
  2237. // "description": "Optional. The unique identifier of the G Suite organization account of the\ncustomer the alert settings are associated with.\nInferred from the caller identity if not provided.",
  2238. // "location": "query",
  2239. // "type": "string"
  2240. // }
  2241. // },
  2242. // "path": "v1beta1/settings",
  2243. // "request": {
  2244. // "$ref": "Settings"
  2245. // },
  2246. // "response": {
  2247. // "$ref": "Settings"
  2248. // },
  2249. // "scopes": [
  2250. // "https://www.googleapis.com/auth/apps.alerts"
  2251. // ]
  2252. // }
  2253. }