...

Source file src/google.golang.org/api/advisorynotifications/v1/advisorynotifications-gen.go

Documentation: google.golang.org/api/advisorynotifications/v1

     1  // Copyright 2024 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  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package advisorynotifications provides access to the Advisory Notifications API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/advisory-notifications
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/advisorynotifications/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	advisorynotificationsService, err := advisorynotifications.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	advisorynotificationsService, err := advisorynotifications.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	advisorynotificationsService, err := advisorynotifications.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package advisorynotifications // import "google.golang.org/api/advisorynotifications/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "advisorynotifications:v1"
    90  const apiName = "advisorynotifications"
    91  const apiVersion = "v1"
    92  const basePath = "https://advisorynotifications.googleapis.com/"
    93  const basePathTemplate = "https://advisorynotifications.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://advisorynotifications.mtls.googleapis.com/"
    95  
    96  // OAuth2 scopes used by this API.
    97  const (
    98  	// See, edit, configure, and delete your Google Cloud data and see the email
    99  	// address for your Google Account.
   100  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   101  )
   102  
   103  // NewService creates a new Service.
   104  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   105  	scopesOption := internaloption.WithDefaultScopes(
   106  		"https://www.googleapis.com/auth/cloud-platform",
   107  	)
   108  	// NOTE: prepend, so we don't override user-specified scopes.
   109  	opts = append([]option.ClientOption{scopesOption}, opts...)
   110  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   111  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   112  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   113  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   114  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	s, err := New(client)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	if endpoint != "" {
   123  		s.BasePath = endpoint
   124  	}
   125  	return s, nil
   126  }
   127  
   128  // New creates a new Service. It uses the provided http.Client for requests.
   129  //
   130  // Deprecated: please use NewService instead.
   131  // To provide a custom HTTP client, use option.WithHTTPClient.
   132  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   133  func New(client *http.Client) (*Service, error) {
   134  	if client == nil {
   135  		return nil, errors.New("client is nil")
   136  	}
   137  	s := &Service{client: client, BasePath: basePath}
   138  	s.Organizations = NewOrganizationsService(s)
   139  	s.Projects = NewProjectsService(s)
   140  	return s, nil
   141  }
   142  
   143  type Service struct {
   144  	client    *http.Client
   145  	BasePath  string // API endpoint base URL
   146  	UserAgent string // optional additional User-Agent fragment
   147  
   148  	Organizations *OrganizationsService
   149  
   150  	Projects *ProjectsService
   151  }
   152  
   153  func (s *Service) userAgent() string {
   154  	if s.UserAgent == "" {
   155  		return googleapi.UserAgent
   156  	}
   157  	return googleapi.UserAgent + " " + s.UserAgent
   158  }
   159  
   160  func NewOrganizationsService(s *Service) *OrganizationsService {
   161  	rs := &OrganizationsService{s: s}
   162  	rs.Locations = NewOrganizationsLocationsService(s)
   163  	return rs
   164  }
   165  
   166  type OrganizationsService struct {
   167  	s *Service
   168  
   169  	Locations *OrganizationsLocationsService
   170  }
   171  
   172  func NewOrganizationsLocationsService(s *Service) *OrganizationsLocationsService {
   173  	rs := &OrganizationsLocationsService{s: s}
   174  	rs.Notifications = NewOrganizationsLocationsNotificationsService(s)
   175  	return rs
   176  }
   177  
   178  type OrganizationsLocationsService struct {
   179  	s *Service
   180  
   181  	Notifications *OrganizationsLocationsNotificationsService
   182  }
   183  
   184  func NewOrganizationsLocationsNotificationsService(s *Service) *OrganizationsLocationsNotificationsService {
   185  	rs := &OrganizationsLocationsNotificationsService{s: s}
   186  	return rs
   187  }
   188  
   189  type OrganizationsLocationsNotificationsService struct {
   190  	s *Service
   191  }
   192  
   193  func NewProjectsService(s *Service) *ProjectsService {
   194  	rs := &ProjectsService{s: s}
   195  	rs.Locations = NewProjectsLocationsService(s)
   196  	return rs
   197  }
   198  
   199  type ProjectsService struct {
   200  	s *Service
   201  
   202  	Locations *ProjectsLocationsService
   203  }
   204  
   205  func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
   206  	rs := &ProjectsLocationsService{s: s}
   207  	rs.Notifications = NewProjectsLocationsNotificationsService(s)
   208  	return rs
   209  }
   210  
   211  type ProjectsLocationsService struct {
   212  	s *Service
   213  
   214  	Notifications *ProjectsLocationsNotificationsService
   215  }
   216  
   217  func NewProjectsLocationsNotificationsService(s *Service) *ProjectsLocationsNotificationsService {
   218  	rs := &ProjectsLocationsNotificationsService{s: s}
   219  	return rs
   220  }
   221  
   222  type ProjectsLocationsNotificationsService struct {
   223  	s *Service
   224  }
   225  
   226  // GoogleCloudAdvisorynotificationsV1Attachment: Attachment with specific
   227  // information about the issue.
   228  type GoogleCloudAdvisorynotificationsV1Attachment struct {
   229  	// Csv: A CSV file attachment. Max size is 10 MB.
   230  	Csv *GoogleCloudAdvisorynotificationsV1Csv `json:"csv,omitempty"`
   231  	// DisplayName: The title of the attachment.
   232  	DisplayName string `json:"displayName,omitempty"`
   233  	// ForceSendFields is a list of field names (e.g. "Csv") to unconditionally
   234  	// include in API requests. By default, fields with empty or default values are
   235  	// omitted from API requests. See
   236  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   237  	// details.
   238  	ForceSendFields []string `json:"-"`
   239  	// NullFields is a list of field names (e.g. "Csv") to include in API requests
   240  	// with the JSON null value. By default, fields with empty values are omitted
   241  	// from API requests. See
   242  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   243  	NullFields []string `json:"-"`
   244  }
   245  
   246  func (s *GoogleCloudAdvisorynotificationsV1Attachment) MarshalJSON() ([]byte, error) {
   247  	type NoMethod GoogleCloudAdvisorynotificationsV1Attachment
   248  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   249  }
   250  
   251  // GoogleCloudAdvisorynotificationsV1Csv: A representation of a CSV file
   252  // attachment, as a list of column headers and a list of data rows.
   253  type GoogleCloudAdvisorynotificationsV1Csv struct {
   254  	// DataRows: The list of data rows in a CSV file, as string arrays rather than
   255  	// as a single comma-separated string.
   256  	DataRows []*GoogleCloudAdvisorynotificationsV1CsvCsvRow `json:"dataRows,omitempty"`
   257  	// Headers: The list of headers for data columns in a CSV file.
   258  	Headers []string `json:"headers,omitempty"`
   259  	// ForceSendFields is a list of field names (e.g. "DataRows") to
   260  	// unconditionally include in API requests. By default, fields with empty or
   261  	// default values are omitted from API requests. See
   262  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   263  	// details.
   264  	ForceSendFields []string `json:"-"`
   265  	// NullFields is a list of field names (e.g. "DataRows") to include in API
   266  	// requests with the JSON null value. By default, fields with empty values are
   267  	// omitted from API requests. See
   268  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   269  	NullFields []string `json:"-"`
   270  }
   271  
   272  func (s *GoogleCloudAdvisorynotificationsV1Csv) MarshalJSON() ([]byte, error) {
   273  	type NoMethod GoogleCloudAdvisorynotificationsV1Csv
   274  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   275  }
   276  
   277  // GoogleCloudAdvisorynotificationsV1CsvCsvRow: A representation of a single
   278  // data row in a CSV file.
   279  type GoogleCloudAdvisorynotificationsV1CsvCsvRow struct {
   280  	// Entries: The data entries in a CSV file row, as a string array rather than a
   281  	// single comma-separated string.
   282  	Entries []string `json:"entries,omitempty"`
   283  	// ForceSendFields is a list of field names (e.g. "Entries") to unconditionally
   284  	// include in API requests. By default, fields with empty or default values are
   285  	// omitted from API requests. See
   286  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   287  	// details.
   288  	ForceSendFields []string `json:"-"`
   289  	// NullFields is a list of field names (e.g. "Entries") to include in API
   290  	// requests with the JSON null value. By default, fields with empty values are
   291  	// omitted from API requests. See
   292  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   293  	NullFields []string `json:"-"`
   294  }
   295  
   296  func (s *GoogleCloudAdvisorynotificationsV1CsvCsvRow) MarshalJSON() ([]byte, error) {
   297  	type NoMethod GoogleCloudAdvisorynotificationsV1CsvCsvRow
   298  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   299  }
   300  
   301  // GoogleCloudAdvisorynotificationsV1ListNotificationsResponse: Response of
   302  // ListNotifications endpoint.
   303  type GoogleCloudAdvisorynotificationsV1ListNotificationsResponse struct {
   304  	// NextPageToken: A token, which can be sent as `page_token` to retrieve the
   305  	// next page. If this field is omitted, there are no subsequent pages.
   306  	NextPageToken string `json:"nextPageToken,omitempty"`
   307  	// Notifications: List of notifications under a given parent.
   308  	Notifications []*GoogleCloudAdvisorynotificationsV1Notification `json:"notifications,omitempty"`
   309  	// TotalSize: Estimation of a total number of notifications.
   310  	TotalSize int64 `json:"totalSize,omitempty"`
   311  
   312  	// ServerResponse contains the HTTP response code and headers from the server.
   313  	googleapi.ServerResponse `json:"-"`
   314  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   315  	// unconditionally include in API requests. By default, fields with empty or
   316  	// default values are omitted from API requests. See
   317  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   318  	// details.
   319  	ForceSendFields []string `json:"-"`
   320  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   321  	// requests with the JSON null value. By default, fields with empty values are
   322  	// omitted from API requests. See
   323  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   324  	NullFields []string `json:"-"`
   325  }
   326  
   327  func (s *GoogleCloudAdvisorynotificationsV1ListNotificationsResponse) MarshalJSON() ([]byte, error) {
   328  	type NoMethod GoogleCloudAdvisorynotificationsV1ListNotificationsResponse
   329  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   330  }
   331  
   332  // GoogleCloudAdvisorynotificationsV1Message: A message which contains
   333  // notification details.
   334  type GoogleCloudAdvisorynotificationsV1Message struct {
   335  	// Attachments: The attachments to download.
   336  	Attachments []*GoogleCloudAdvisorynotificationsV1Attachment `json:"attachments,omitempty"`
   337  	// Body: The message content.
   338  	Body *GoogleCloudAdvisorynotificationsV1MessageBody `json:"body,omitempty"`
   339  	// CreateTime: The Message creation timestamp.
   340  	CreateTime string `json:"createTime,omitempty"`
   341  	// LocalizationTime: Time when Message was localized
   342  	LocalizationTime string `json:"localizationTime,omitempty"`
   343  	// ForceSendFields is a list of field names (e.g. "Attachments") to
   344  	// unconditionally include in API requests. By default, fields with empty or
   345  	// default values are omitted from API requests. See
   346  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   347  	// details.
   348  	ForceSendFields []string `json:"-"`
   349  	// NullFields is a list of field names (e.g. "Attachments") to include in API
   350  	// requests with the JSON null value. By default, fields with empty values are
   351  	// omitted from API requests. See
   352  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   353  	NullFields []string `json:"-"`
   354  }
   355  
   356  func (s *GoogleCloudAdvisorynotificationsV1Message) MarshalJSON() ([]byte, error) {
   357  	type NoMethod GoogleCloudAdvisorynotificationsV1Message
   358  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   359  }
   360  
   361  // GoogleCloudAdvisorynotificationsV1MessageBody: A message body containing
   362  // text.
   363  type GoogleCloudAdvisorynotificationsV1MessageBody struct {
   364  	// Text: The text content of the message body.
   365  	Text *GoogleCloudAdvisorynotificationsV1Text `json:"text,omitempty"`
   366  	// ForceSendFields is a list of field names (e.g. "Text") to unconditionally
   367  	// include in API requests. By default, fields with empty or default values are
   368  	// omitted from API requests. See
   369  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   370  	// details.
   371  	ForceSendFields []string `json:"-"`
   372  	// NullFields is a list of field names (e.g. "Text") to include in API requests
   373  	// with the JSON null value. By default, fields with empty values are omitted
   374  	// from API requests. See
   375  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   376  	NullFields []string `json:"-"`
   377  }
   378  
   379  func (s *GoogleCloudAdvisorynotificationsV1MessageBody) MarshalJSON() ([]byte, error) {
   380  	type NoMethod GoogleCloudAdvisorynotificationsV1MessageBody
   381  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   382  }
   383  
   384  // GoogleCloudAdvisorynotificationsV1Notification: A notification object for
   385  // notifying customers about security and privacy issues.
   386  type GoogleCloudAdvisorynotificationsV1Notification struct {
   387  	// CreateTime: Output only. Time the notification was created.
   388  	CreateTime string `json:"createTime,omitempty"`
   389  	// Messages: A list of messages in the notification.
   390  	Messages []*GoogleCloudAdvisorynotificationsV1Message `json:"messages,omitempty"`
   391  	// Name: The resource name of the notification. Format:
   392  	// organizations/{organization}/locations/{location}/notifications/{notification
   393  	// } or projects/{project}/locations/{location}/notifications/{notification}.
   394  	Name string `json:"name,omitempty"`
   395  	// NotificationType: Type of notification
   396  	//
   397  	// Possible values:
   398  	//   "NOTIFICATION_TYPE_UNSPECIFIED" - Default type
   399  	//   "NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY" - Security and privacy
   400  	// advisory notifications
   401  	//   "NOTIFICATION_TYPE_SENSITIVE_ACTIONS" - Sensitive action notifications
   402  	//   "NOTIFICATION_TYPE_SECURITY_MSA" - General security MSA
   403  	//   "NOTIFICATION_TYPE_THREAT_HORIZONS" - Threat horizons MSA
   404  	NotificationType string `json:"notificationType,omitempty"`
   405  	// Subject: The subject line of the notification.
   406  	Subject *GoogleCloudAdvisorynotificationsV1Subject `json:"subject,omitempty"`
   407  
   408  	// ServerResponse contains the HTTP response code and headers from the server.
   409  	googleapi.ServerResponse `json:"-"`
   410  	// ForceSendFields is a list of field names (e.g. "CreateTime") to
   411  	// unconditionally include in API requests. By default, fields with empty or
   412  	// default values are omitted from API requests. See
   413  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   414  	// details.
   415  	ForceSendFields []string `json:"-"`
   416  	// NullFields is a list of field names (e.g. "CreateTime") to include in API
   417  	// requests with the JSON null value. By default, fields with empty values are
   418  	// omitted from API requests. See
   419  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   420  	NullFields []string `json:"-"`
   421  }
   422  
   423  func (s *GoogleCloudAdvisorynotificationsV1Notification) MarshalJSON() ([]byte, error) {
   424  	type NoMethod GoogleCloudAdvisorynotificationsV1Notification
   425  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   426  }
   427  
   428  // GoogleCloudAdvisorynotificationsV1NotificationSettings: Settings for each
   429  // NotificationType.
   430  type GoogleCloudAdvisorynotificationsV1NotificationSettings struct {
   431  	// Enabled: Whether the associated NotificationType is enabled.
   432  	Enabled bool `json:"enabled,omitempty"`
   433  	// ForceSendFields is a list of field names (e.g. "Enabled") to unconditionally
   434  	// include in API requests. By default, fields with empty or default values are
   435  	// omitted from API requests. See
   436  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   437  	// details.
   438  	ForceSendFields []string `json:"-"`
   439  	// NullFields is a list of field names (e.g. "Enabled") to include in API
   440  	// requests with the JSON null value. By default, fields with empty values are
   441  	// omitted from API requests. See
   442  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   443  	NullFields []string `json:"-"`
   444  }
   445  
   446  func (s *GoogleCloudAdvisorynotificationsV1NotificationSettings) MarshalJSON() ([]byte, error) {
   447  	type NoMethod GoogleCloudAdvisorynotificationsV1NotificationSettings
   448  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   449  }
   450  
   451  // GoogleCloudAdvisorynotificationsV1Settings: Settings for Advisory
   452  // Notifications.
   453  type GoogleCloudAdvisorynotificationsV1Settings struct {
   454  	// Etag: Required. Fingerprint for optimistic concurrency returned in Get
   455  	// requests. Must be provided for Update requests. If the value provided does
   456  	// not match the value known to the server, ABORTED will be thrown, and the
   457  	// client should retry the read-modify-write cycle.
   458  	Etag string `json:"etag,omitempty"`
   459  	// Name: Identifier. The resource name of the settings to retrieve. Format:
   460  	// organizations/{organization}/locations/{location}/settings or
   461  	// projects/{projects}/locations/{location}/settings.
   462  	Name string `json:"name,omitempty"`
   463  	// NotificationSettings: Required. Map of each notification type and its
   464  	// settings to get/set all settings at once. The server will validate the value
   465  	// for each notification type.
   466  	NotificationSettings map[string]GoogleCloudAdvisorynotificationsV1NotificationSettings `json:"notificationSettings,omitempty"`
   467  
   468  	// ServerResponse contains the HTTP response code and headers from the server.
   469  	googleapi.ServerResponse `json:"-"`
   470  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   471  	// include in API requests. By default, fields with empty or default values are
   472  	// omitted from API requests. See
   473  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   474  	// details.
   475  	ForceSendFields []string `json:"-"`
   476  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   477  	// with the JSON null value. By default, fields with empty values are omitted
   478  	// from API requests. See
   479  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   480  	NullFields []string `json:"-"`
   481  }
   482  
   483  func (s *GoogleCloudAdvisorynotificationsV1Settings) MarshalJSON() ([]byte, error) {
   484  	type NoMethod GoogleCloudAdvisorynotificationsV1Settings
   485  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   486  }
   487  
   488  // GoogleCloudAdvisorynotificationsV1Subject: A subject line of a notification.
   489  type GoogleCloudAdvisorynotificationsV1Subject struct {
   490  	// Text: The text content.
   491  	Text *GoogleCloudAdvisorynotificationsV1Text `json:"text,omitempty"`
   492  	// ForceSendFields is a list of field names (e.g. "Text") to unconditionally
   493  	// include in API requests. By default, fields with empty or default values are
   494  	// omitted from API requests. See
   495  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   496  	// details.
   497  	ForceSendFields []string `json:"-"`
   498  	// NullFields is a list of field names (e.g. "Text") to include in API requests
   499  	// with the JSON null value. By default, fields with empty values are omitted
   500  	// from API requests. See
   501  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   502  	NullFields []string `json:"-"`
   503  }
   504  
   505  func (s *GoogleCloudAdvisorynotificationsV1Subject) MarshalJSON() ([]byte, error) {
   506  	type NoMethod GoogleCloudAdvisorynotificationsV1Subject
   507  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   508  }
   509  
   510  // GoogleCloudAdvisorynotificationsV1Text: A text object containing the English
   511  // text and its localized copies.
   512  type GoogleCloudAdvisorynotificationsV1Text struct {
   513  	// EnText: The English copy.
   514  	EnText string `json:"enText,omitempty"`
   515  	// LocalizationState: Status of the localization.
   516  	//
   517  	// Possible values:
   518  	//   "LOCALIZATION_STATE_UNSPECIFIED" - Not used.
   519  	//   "LOCALIZATION_STATE_NOT_APPLICABLE" - Localization is not applicable for
   520  	// requested language. This can happen when: - The requested language was not
   521  	// supported by Advisory Notifications at the time of localization (including
   522  	// notifications created before the localization feature was launched). - The
   523  	// requested language is English, so only the English text is returned.
   524  	//   "LOCALIZATION_STATE_PENDING" - Localization for requested language is in
   525  	// progress, and not ready yet.
   526  	//   "LOCALIZATION_STATE_COMPLETED" - Localization for requested language is
   527  	// completed.
   528  	LocalizationState string `json:"localizationState,omitempty"`
   529  	// LocalizedText: The requested localized copy (if applicable).
   530  	LocalizedText string `json:"localizedText,omitempty"`
   531  	// ForceSendFields is a list of field names (e.g. "EnText") to unconditionally
   532  	// include in API requests. By default, fields with empty or default values are
   533  	// omitted from API requests. See
   534  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   535  	// details.
   536  	ForceSendFields []string `json:"-"`
   537  	// NullFields is a list of field names (e.g. "EnText") to include in API
   538  	// requests with the JSON null value. By default, fields with empty values are
   539  	// omitted from API requests. See
   540  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   541  	NullFields []string `json:"-"`
   542  }
   543  
   544  func (s *GoogleCloudAdvisorynotificationsV1Text) MarshalJSON() ([]byte, error) {
   545  	type NoMethod GoogleCloudAdvisorynotificationsV1Text
   546  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   547  }
   548  
   549  type OrganizationsLocationsGetSettingsCall struct {
   550  	s            *Service
   551  	name         string
   552  	urlParams_   gensupport.URLParams
   553  	ifNoneMatch_ string
   554  	ctx_         context.Context
   555  	header_      http.Header
   556  }
   557  
   558  // GetSettings: Get notification settings.
   559  //
   560  //   - name: The resource name of the settings to retrieve. Format:
   561  //     organizations/{organization}/locations/{location}/settings or
   562  //     projects/{projects}/locations/{location}/settings.
   563  func (r *OrganizationsLocationsService) GetSettings(name string) *OrganizationsLocationsGetSettingsCall {
   564  	c := &OrganizationsLocationsGetSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   565  	c.name = name
   566  	return c
   567  }
   568  
   569  // Fields allows partial responses to be retrieved. See
   570  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   571  // details.
   572  func (c *OrganizationsLocationsGetSettingsCall) Fields(s ...googleapi.Field) *OrganizationsLocationsGetSettingsCall {
   573  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   574  	return c
   575  }
   576  
   577  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   578  // object's ETag matches the given value. This is useful for getting updates
   579  // only after the object has changed since the last request.
   580  func (c *OrganizationsLocationsGetSettingsCall) IfNoneMatch(entityTag string) *OrganizationsLocationsGetSettingsCall {
   581  	c.ifNoneMatch_ = entityTag
   582  	return c
   583  }
   584  
   585  // Context sets the context to be used in this call's Do method.
   586  func (c *OrganizationsLocationsGetSettingsCall) Context(ctx context.Context) *OrganizationsLocationsGetSettingsCall {
   587  	c.ctx_ = ctx
   588  	return c
   589  }
   590  
   591  // Header returns a http.Header that can be modified by the caller to add
   592  // headers to the request.
   593  func (c *OrganizationsLocationsGetSettingsCall) Header() http.Header {
   594  	if c.header_ == nil {
   595  		c.header_ = make(http.Header)
   596  	}
   597  	return c.header_
   598  }
   599  
   600  func (c *OrganizationsLocationsGetSettingsCall) doRequest(alt string) (*http.Response, error) {
   601  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   602  	if c.ifNoneMatch_ != "" {
   603  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   604  	}
   605  	var body io.Reader = nil
   606  	c.urlParams_.Set("alt", alt)
   607  	c.urlParams_.Set("prettyPrint", "false")
   608  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   609  	urls += "?" + c.urlParams_.Encode()
   610  	req, err := http.NewRequest("GET", urls, body)
   611  	if err != nil {
   612  		return nil, err
   613  	}
   614  	req.Header = reqHeaders
   615  	googleapi.Expand(req.URL, map[string]string{
   616  		"name": c.name,
   617  	})
   618  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   619  }
   620  
   621  // Do executes the "advisorynotifications.organizations.locations.getSettings" call.
   622  // Any non-2xx status code is an error. Response headers are in either
   623  // *GoogleCloudAdvisorynotificationsV1Settings.ServerResponse.Header or (if a
   624  // response was returned at all) in error.(*googleapi.Error).Header. Use
   625  // googleapi.IsNotModified to check whether the returned error was because
   626  // http.StatusNotModified was returned.
   627  func (c *OrganizationsLocationsGetSettingsCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Settings, error) {
   628  	gensupport.SetOptions(c.urlParams_, opts...)
   629  	res, err := c.doRequest("json")
   630  	if res != nil && res.StatusCode == http.StatusNotModified {
   631  		if res.Body != nil {
   632  			res.Body.Close()
   633  		}
   634  		return nil, gensupport.WrapError(&googleapi.Error{
   635  			Code:   res.StatusCode,
   636  			Header: res.Header,
   637  		})
   638  	}
   639  	if err != nil {
   640  		return nil, err
   641  	}
   642  	defer googleapi.CloseBody(res)
   643  	if err := googleapi.CheckResponse(res); err != nil {
   644  		return nil, gensupport.WrapError(err)
   645  	}
   646  	ret := &GoogleCloudAdvisorynotificationsV1Settings{
   647  		ServerResponse: googleapi.ServerResponse{
   648  			Header:         res.Header,
   649  			HTTPStatusCode: res.StatusCode,
   650  		},
   651  	}
   652  	target := &ret
   653  	if err := gensupport.DecodeResponse(target, res); err != nil {
   654  		return nil, err
   655  	}
   656  	return ret, nil
   657  }
   658  
   659  type OrganizationsLocationsUpdateSettingsCall struct {
   660  	s                                          *Service
   661  	name                                       string
   662  	googlecloudadvisorynotificationsv1settings *GoogleCloudAdvisorynotificationsV1Settings
   663  	urlParams_                                 gensupport.URLParams
   664  	ctx_                                       context.Context
   665  	header_                                    http.Header
   666  }
   667  
   668  // UpdateSettings: Update notification settings.
   669  //
   670  //   - name: Identifier. The resource name of the settings to retrieve. Format:
   671  //     organizations/{organization}/locations/{location}/settings or
   672  //     projects/{projects}/locations/{location}/settings.
   673  func (r *OrganizationsLocationsService) UpdateSettings(name string, googlecloudadvisorynotificationsv1settings *GoogleCloudAdvisorynotificationsV1Settings) *OrganizationsLocationsUpdateSettingsCall {
   674  	c := &OrganizationsLocationsUpdateSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   675  	c.name = name
   676  	c.googlecloudadvisorynotificationsv1settings = googlecloudadvisorynotificationsv1settings
   677  	return c
   678  }
   679  
   680  // Fields allows partial responses to be retrieved. See
   681  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   682  // details.
   683  func (c *OrganizationsLocationsUpdateSettingsCall) Fields(s ...googleapi.Field) *OrganizationsLocationsUpdateSettingsCall {
   684  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   685  	return c
   686  }
   687  
   688  // Context sets the context to be used in this call's Do method.
   689  func (c *OrganizationsLocationsUpdateSettingsCall) Context(ctx context.Context) *OrganizationsLocationsUpdateSettingsCall {
   690  	c.ctx_ = ctx
   691  	return c
   692  }
   693  
   694  // Header returns a http.Header that can be modified by the caller to add
   695  // headers to the request.
   696  func (c *OrganizationsLocationsUpdateSettingsCall) Header() http.Header {
   697  	if c.header_ == nil {
   698  		c.header_ = make(http.Header)
   699  	}
   700  	return c.header_
   701  }
   702  
   703  func (c *OrganizationsLocationsUpdateSettingsCall) doRequest(alt string) (*http.Response, error) {
   704  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   705  	var body io.Reader = nil
   706  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudadvisorynotificationsv1settings)
   707  	if err != nil {
   708  		return nil, err
   709  	}
   710  	c.urlParams_.Set("alt", alt)
   711  	c.urlParams_.Set("prettyPrint", "false")
   712  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   713  	urls += "?" + c.urlParams_.Encode()
   714  	req, err := http.NewRequest("PATCH", urls, body)
   715  	if err != nil {
   716  		return nil, err
   717  	}
   718  	req.Header = reqHeaders
   719  	googleapi.Expand(req.URL, map[string]string{
   720  		"name": c.name,
   721  	})
   722  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   723  }
   724  
   725  // Do executes the "advisorynotifications.organizations.locations.updateSettings" call.
   726  // Any non-2xx status code is an error. Response headers are in either
   727  // *GoogleCloudAdvisorynotificationsV1Settings.ServerResponse.Header or (if a
   728  // response was returned at all) in error.(*googleapi.Error).Header. Use
   729  // googleapi.IsNotModified to check whether the returned error was because
   730  // http.StatusNotModified was returned.
   731  func (c *OrganizationsLocationsUpdateSettingsCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Settings, error) {
   732  	gensupport.SetOptions(c.urlParams_, opts...)
   733  	res, err := c.doRequest("json")
   734  	if res != nil && res.StatusCode == http.StatusNotModified {
   735  		if res.Body != nil {
   736  			res.Body.Close()
   737  		}
   738  		return nil, gensupport.WrapError(&googleapi.Error{
   739  			Code:   res.StatusCode,
   740  			Header: res.Header,
   741  		})
   742  	}
   743  	if err != nil {
   744  		return nil, err
   745  	}
   746  	defer googleapi.CloseBody(res)
   747  	if err := googleapi.CheckResponse(res); err != nil {
   748  		return nil, gensupport.WrapError(err)
   749  	}
   750  	ret := &GoogleCloudAdvisorynotificationsV1Settings{
   751  		ServerResponse: googleapi.ServerResponse{
   752  			Header:         res.Header,
   753  			HTTPStatusCode: res.StatusCode,
   754  		},
   755  	}
   756  	target := &ret
   757  	if err := gensupport.DecodeResponse(target, res); err != nil {
   758  		return nil, err
   759  	}
   760  	return ret, nil
   761  }
   762  
   763  type OrganizationsLocationsNotificationsGetCall struct {
   764  	s            *Service
   765  	name         string
   766  	urlParams_   gensupport.URLParams
   767  	ifNoneMatch_ string
   768  	ctx_         context.Context
   769  	header_      http.Header
   770  }
   771  
   772  // Get: Gets a notification.
   773  //
   774  //   - name: A name of the notification to retrieve. Format:
   775  //     organizations/{organization}/locations/{location}/notifications/{notificati
   776  //     on} or
   777  //     projects/{projects}/locations/{location}/notifications/{notification}.
   778  func (r *OrganizationsLocationsNotificationsService) Get(name string) *OrganizationsLocationsNotificationsGetCall {
   779  	c := &OrganizationsLocationsNotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   780  	c.name = name
   781  	return c
   782  }
   783  
   784  // LanguageCode sets the optional parameter "languageCode": ISO code for
   785  // requested localization language. If unset, will be interpereted as "en". If
   786  // the requested language is valid, but not supported for this notification,
   787  // English will be returned with an "Not applicable" LocalizationState. If the
   788  // ISO code is invalid (i.e. not a real language), this RPC will throw an
   789  // error.
   790  func (c *OrganizationsLocationsNotificationsGetCall) LanguageCode(languageCode string) *OrganizationsLocationsNotificationsGetCall {
   791  	c.urlParams_.Set("languageCode", languageCode)
   792  	return c
   793  }
   794  
   795  // Fields allows partial responses to be retrieved. See
   796  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   797  // details.
   798  func (c *OrganizationsLocationsNotificationsGetCall) Fields(s ...googleapi.Field) *OrganizationsLocationsNotificationsGetCall {
   799  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   800  	return c
   801  }
   802  
   803  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   804  // object's ETag matches the given value. This is useful for getting updates
   805  // only after the object has changed since the last request.
   806  func (c *OrganizationsLocationsNotificationsGetCall) IfNoneMatch(entityTag string) *OrganizationsLocationsNotificationsGetCall {
   807  	c.ifNoneMatch_ = entityTag
   808  	return c
   809  }
   810  
   811  // Context sets the context to be used in this call's Do method.
   812  func (c *OrganizationsLocationsNotificationsGetCall) Context(ctx context.Context) *OrganizationsLocationsNotificationsGetCall {
   813  	c.ctx_ = ctx
   814  	return c
   815  }
   816  
   817  // Header returns a http.Header that can be modified by the caller to add
   818  // headers to the request.
   819  func (c *OrganizationsLocationsNotificationsGetCall) Header() http.Header {
   820  	if c.header_ == nil {
   821  		c.header_ = make(http.Header)
   822  	}
   823  	return c.header_
   824  }
   825  
   826  func (c *OrganizationsLocationsNotificationsGetCall) doRequest(alt string) (*http.Response, error) {
   827  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   828  	if c.ifNoneMatch_ != "" {
   829  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   830  	}
   831  	var body io.Reader = nil
   832  	c.urlParams_.Set("alt", alt)
   833  	c.urlParams_.Set("prettyPrint", "false")
   834  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   835  	urls += "?" + c.urlParams_.Encode()
   836  	req, err := http.NewRequest("GET", urls, body)
   837  	if err != nil {
   838  		return nil, err
   839  	}
   840  	req.Header = reqHeaders
   841  	googleapi.Expand(req.URL, map[string]string{
   842  		"name": c.name,
   843  	})
   844  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   845  }
   846  
   847  // Do executes the "advisorynotifications.organizations.locations.notifications.get" call.
   848  // Any non-2xx status code is an error. Response headers are in either
   849  // *GoogleCloudAdvisorynotificationsV1Notification.ServerResponse.Header or (if
   850  // a response was returned at all) in error.(*googleapi.Error).Header. Use
   851  // googleapi.IsNotModified to check whether the returned error was because
   852  // http.StatusNotModified was returned.
   853  func (c *OrganizationsLocationsNotificationsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Notification, error) {
   854  	gensupport.SetOptions(c.urlParams_, opts...)
   855  	res, err := c.doRequest("json")
   856  	if res != nil && res.StatusCode == http.StatusNotModified {
   857  		if res.Body != nil {
   858  			res.Body.Close()
   859  		}
   860  		return nil, gensupport.WrapError(&googleapi.Error{
   861  			Code:   res.StatusCode,
   862  			Header: res.Header,
   863  		})
   864  	}
   865  	if err != nil {
   866  		return nil, err
   867  	}
   868  	defer googleapi.CloseBody(res)
   869  	if err := googleapi.CheckResponse(res); err != nil {
   870  		return nil, gensupport.WrapError(err)
   871  	}
   872  	ret := &GoogleCloudAdvisorynotificationsV1Notification{
   873  		ServerResponse: googleapi.ServerResponse{
   874  			Header:         res.Header,
   875  			HTTPStatusCode: res.StatusCode,
   876  		},
   877  	}
   878  	target := &ret
   879  	if err := gensupport.DecodeResponse(target, res); err != nil {
   880  		return nil, err
   881  	}
   882  	return ret, nil
   883  }
   884  
   885  type OrganizationsLocationsNotificationsListCall struct {
   886  	s            *Service
   887  	parent       string
   888  	urlParams_   gensupport.URLParams
   889  	ifNoneMatch_ string
   890  	ctx_         context.Context
   891  	header_      http.Header
   892  }
   893  
   894  // List: Lists notifications under a given parent.
   895  //
   896  //   - parent: The parent, which owns this collection of notifications. Must be
   897  //     of the form "organizations/{organization}/locations/{location}" or
   898  //     "projects/{project}/locations/{location}".
   899  func (r *OrganizationsLocationsNotificationsService) List(parent string) *OrganizationsLocationsNotificationsListCall {
   900  	c := &OrganizationsLocationsNotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   901  	c.parent = parent
   902  	return c
   903  }
   904  
   905  // LanguageCode sets the optional parameter "languageCode": ISO code for
   906  // requested localization language. If unset, will be interpereted as "en". If
   907  // the requested language is valid, but not supported for this notification,
   908  // English will be returned with an "Not applicable" LocalizationState. If the
   909  // ISO code is invalid (i.e. not a real language), this RPC will throw an
   910  // error.
   911  func (c *OrganizationsLocationsNotificationsListCall) LanguageCode(languageCode string) *OrganizationsLocationsNotificationsListCall {
   912  	c.urlParams_.Set("languageCode", languageCode)
   913  	return c
   914  }
   915  
   916  // PageSize sets the optional parameter "pageSize": The maximum number of
   917  // notifications to return. The service may return fewer than this value. If
   918  // unspecified or equal to 0, at most 50 notifications will be returned. The
   919  // maximum value is 50; values above 50 will be coerced to 50.
   920  func (c *OrganizationsLocationsNotificationsListCall) PageSize(pageSize int64) *OrganizationsLocationsNotificationsListCall {
   921  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   922  	return c
   923  }
   924  
   925  // PageToken sets the optional parameter "pageToken": A page token returned
   926  // from a previous request. When paginating, all other parameters provided in
   927  // the request must match the call that returned the page token.
   928  func (c *OrganizationsLocationsNotificationsListCall) PageToken(pageToken string) *OrganizationsLocationsNotificationsListCall {
   929  	c.urlParams_.Set("pageToken", pageToken)
   930  	return c
   931  }
   932  
   933  // View sets the optional parameter "view": Specifies which parts of the
   934  // notification resource should be returned in the response.
   935  //
   936  // Possible values:
   937  //
   938  //	"NOTIFICATION_VIEW_UNSPECIFIED" - Not specified, equivalent to BASIC.
   939  //	"BASIC" - Server responses only include title, creation time and
   940  //
   941  // Notification ID. Note: for internal use responses also include the last
   942  // update time, the latest message text and whether notification has
   943  // attachments.
   944  //
   945  //	"FULL" - Include everything.
   946  func (c *OrganizationsLocationsNotificationsListCall) View(view string) *OrganizationsLocationsNotificationsListCall {
   947  	c.urlParams_.Set("view", view)
   948  	return c
   949  }
   950  
   951  // Fields allows partial responses to be retrieved. See
   952  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   953  // details.
   954  func (c *OrganizationsLocationsNotificationsListCall) Fields(s ...googleapi.Field) *OrganizationsLocationsNotificationsListCall {
   955  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   956  	return c
   957  }
   958  
   959  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   960  // object's ETag matches the given value. This is useful for getting updates
   961  // only after the object has changed since the last request.
   962  func (c *OrganizationsLocationsNotificationsListCall) IfNoneMatch(entityTag string) *OrganizationsLocationsNotificationsListCall {
   963  	c.ifNoneMatch_ = entityTag
   964  	return c
   965  }
   966  
   967  // Context sets the context to be used in this call's Do method.
   968  func (c *OrganizationsLocationsNotificationsListCall) Context(ctx context.Context) *OrganizationsLocationsNotificationsListCall {
   969  	c.ctx_ = ctx
   970  	return c
   971  }
   972  
   973  // Header returns a http.Header that can be modified by the caller to add
   974  // headers to the request.
   975  func (c *OrganizationsLocationsNotificationsListCall) Header() http.Header {
   976  	if c.header_ == nil {
   977  		c.header_ = make(http.Header)
   978  	}
   979  	return c.header_
   980  }
   981  
   982  func (c *OrganizationsLocationsNotificationsListCall) doRequest(alt string) (*http.Response, error) {
   983  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   984  	if c.ifNoneMatch_ != "" {
   985  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   986  	}
   987  	var body io.Reader = nil
   988  	c.urlParams_.Set("alt", alt)
   989  	c.urlParams_.Set("prettyPrint", "false")
   990  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/notifications")
   991  	urls += "?" + c.urlParams_.Encode()
   992  	req, err := http.NewRequest("GET", urls, body)
   993  	if err != nil {
   994  		return nil, err
   995  	}
   996  	req.Header = reqHeaders
   997  	googleapi.Expand(req.URL, map[string]string{
   998  		"parent": c.parent,
   999  	})
  1000  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1001  }
  1002  
  1003  // Do executes the "advisorynotifications.organizations.locations.notifications.list" call.
  1004  // Any non-2xx status code is an error. Response headers are in either
  1005  // *GoogleCloudAdvisorynotificationsV1ListNotificationsResponse.ServerResponse.H
  1006  // eader or (if a response was returned at all) in
  1007  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1008  // whether the returned error was because http.StatusNotModified was returned.
  1009  func (c *OrganizationsLocationsNotificationsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1ListNotificationsResponse, error) {
  1010  	gensupport.SetOptions(c.urlParams_, opts...)
  1011  	res, err := c.doRequest("json")
  1012  	if res != nil && res.StatusCode == http.StatusNotModified {
  1013  		if res.Body != nil {
  1014  			res.Body.Close()
  1015  		}
  1016  		return nil, gensupport.WrapError(&googleapi.Error{
  1017  			Code:   res.StatusCode,
  1018  			Header: res.Header,
  1019  		})
  1020  	}
  1021  	if err != nil {
  1022  		return nil, err
  1023  	}
  1024  	defer googleapi.CloseBody(res)
  1025  	if err := googleapi.CheckResponse(res); err != nil {
  1026  		return nil, gensupport.WrapError(err)
  1027  	}
  1028  	ret := &GoogleCloudAdvisorynotificationsV1ListNotificationsResponse{
  1029  		ServerResponse: googleapi.ServerResponse{
  1030  			Header:         res.Header,
  1031  			HTTPStatusCode: res.StatusCode,
  1032  		},
  1033  	}
  1034  	target := &ret
  1035  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1036  		return nil, err
  1037  	}
  1038  	return ret, nil
  1039  }
  1040  
  1041  // Pages invokes f for each page of results.
  1042  // A non-nil error returned from f will halt the iteration.
  1043  // The provided context supersedes any context provided to the Context method.
  1044  func (c *OrganizationsLocationsNotificationsListCall) Pages(ctx context.Context, f func(*GoogleCloudAdvisorynotificationsV1ListNotificationsResponse) error) error {
  1045  	c.ctx_ = ctx
  1046  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1047  	for {
  1048  		x, err := c.Do()
  1049  		if err != nil {
  1050  			return err
  1051  		}
  1052  		if err := f(x); err != nil {
  1053  			return err
  1054  		}
  1055  		if x.NextPageToken == "" {
  1056  			return nil
  1057  		}
  1058  		c.PageToken(x.NextPageToken)
  1059  	}
  1060  }
  1061  
  1062  type ProjectsLocationsGetSettingsCall struct {
  1063  	s            *Service
  1064  	name         string
  1065  	urlParams_   gensupport.URLParams
  1066  	ifNoneMatch_ string
  1067  	ctx_         context.Context
  1068  	header_      http.Header
  1069  }
  1070  
  1071  // GetSettings: Get notification settings.
  1072  //
  1073  //   - name: The resource name of the settings to retrieve. Format:
  1074  //     organizations/{organization}/locations/{location}/settings or
  1075  //     projects/{projects}/locations/{location}/settings.
  1076  func (r *ProjectsLocationsService) GetSettings(name string) *ProjectsLocationsGetSettingsCall {
  1077  	c := &ProjectsLocationsGetSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1078  	c.name = name
  1079  	return c
  1080  }
  1081  
  1082  // Fields allows partial responses to be retrieved. See
  1083  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1084  // details.
  1085  func (c *ProjectsLocationsGetSettingsCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetSettingsCall {
  1086  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1087  	return c
  1088  }
  1089  
  1090  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1091  // object's ETag matches the given value. This is useful for getting updates
  1092  // only after the object has changed since the last request.
  1093  func (c *ProjectsLocationsGetSettingsCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetSettingsCall {
  1094  	c.ifNoneMatch_ = entityTag
  1095  	return c
  1096  }
  1097  
  1098  // Context sets the context to be used in this call's Do method.
  1099  func (c *ProjectsLocationsGetSettingsCall) Context(ctx context.Context) *ProjectsLocationsGetSettingsCall {
  1100  	c.ctx_ = ctx
  1101  	return c
  1102  }
  1103  
  1104  // Header returns a http.Header that can be modified by the caller to add
  1105  // headers to the request.
  1106  func (c *ProjectsLocationsGetSettingsCall) Header() http.Header {
  1107  	if c.header_ == nil {
  1108  		c.header_ = make(http.Header)
  1109  	}
  1110  	return c.header_
  1111  }
  1112  
  1113  func (c *ProjectsLocationsGetSettingsCall) doRequest(alt string) (*http.Response, error) {
  1114  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1115  	if c.ifNoneMatch_ != "" {
  1116  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1117  	}
  1118  	var body io.Reader = nil
  1119  	c.urlParams_.Set("alt", alt)
  1120  	c.urlParams_.Set("prettyPrint", "false")
  1121  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1122  	urls += "?" + c.urlParams_.Encode()
  1123  	req, err := http.NewRequest("GET", urls, body)
  1124  	if err != nil {
  1125  		return nil, err
  1126  	}
  1127  	req.Header = reqHeaders
  1128  	googleapi.Expand(req.URL, map[string]string{
  1129  		"name": c.name,
  1130  	})
  1131  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1132  }
  1133  
  1134  // Do executes the "advisorynotifications.projects.locations.getSettings" call.
  1135  // Any non-2xx status code is an error. Response headers are in either
  1136  // *GoogleCloudAdvisorynotificationsV1Settings.ServerResponse.Header or (if a
  1137  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1138  // googleapi.IsNotModified to check whether the returned error was because
  1139  // http.StatusNotModified was returned.
  1140  func (c *ProjectsLocationsGetSettingsCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Settings, error) {
  1141  	gensupport.SetOptions(c.urlParams_, opts...)
  1142  	res, err := c.doRequest("json")
  1143  	if res != nil && res.StatusCode == http.StatusNotModified {
  1144  		if res.Body != nil {
  1145  			res.Body.Close()
  1146  		}
  1147  		return nil, gensupport.WrapError(&googleapi.Error{
  1148  			Code:   res.StatusCode,
  1149  			Header: res.Header,
  1150  		})
  1151  	}
  1152  	if err != nil {
  1153  		return nil, err
  1154  	}
  1155  	defer googleapi.CloseBody(res)
  1156  	if err := googleapi.CheckResponse(res); err != nil {
  1157  		return nil, gensupport.WrapError(err)
  1158  	}
  1159  	ret := &GoogleCloudAdvisorynotificationsV1Settings{
  1160  		ServerResponse: googleapi.ServerResponse{
  1161  			Header:         res.Header,
  1162  			HTTPStatusCode: res.StatusCode,
  1163  		},
  1164  	}
  1165  	target := &ret
  1166  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1167  		return nil, err
  1168  	}
  1169  	return ret, nil
  1170  }
  1171  
  1172  type ProjectsLocationsUpdateSettingsCall struct {
  1173  	s                                          *Service
  1174  	name                                       string
  1175  	googlecloudadvisorynotificationsv1settings *GoogleCloudAdvisorynotificationsV1Settings
  1176  	urlParams_                                 gensupport.URLParams
  1177  	ctx_                                       context.Context
  1178  	header_                                    http.Header
  1179  }
  1180  
  1181  // UpdateSettings: Update notification settings.
  1182  //
  1183  //   - name: Identifier. The resource name of the settings to retrieve. Format:
  1184  //     organizations/{organization}/locations/{location}/settings or
  1185  //     projects/{projects}/locations/{location}/settings.
  1186  func (r *ProjectsLocationsService) UpdateSettings(name string, googlecloudadvisorynotificationsv1settings *GoogleCloudAdvisorynotificationsV1Settings) *ProjectsLocationsUpdateSettingsCall {
  1187  	c := &ProjectsLocationsUpdateSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1188  	c.name = name
  1189  	c.googlecloudadvisorynotificationsv1settings = googlecloudadvisorynotificationsv1settings
  1190  	return c
  1191  }
  1192  
  1193  // Fields allows partial responses to be retrieved. See
  1194  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1195  // details.
  1196  func (c *ProjectsLocationsUpdateSettingsCall) Fields(s ...googleapi.Field) *ProjectsLocationsUpdateSettingsCall {
  1197  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1198  	return c
  1199  }
  1200  
  1201  // Context sets the context to be used in this call's Do method.
  1202  func (c *ProjectsLocationsUpdateSettingsCall) Context(ctx context.Context) *ProjectsLocationsUpdateSettingsCall {
  1203  	c.ctx_ = ctx
  1204  	return c
  1205  }
  1206  
  1207  // Header returns a http.Header that can be modified by the caller to add
  1208  // headers to the request.
  1209  func (c *ProjectsLocationsUpdateSettingsCall) Header() http.Header {
  1210  	if c.header_ == nil {
  1211  		c.header_ = make(http.Header)
  1212  	}
  1213  	return c.header_
  1214  }
  1215  
  1216  func (c *ProjectsLocationsUpdateSettingsCall) doRequest(alt string) (*http.Response, error) {
  1217  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1218  	var body io.Reader = nil
  1219  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudadvisorynotificationsv1settings)
  1220  	if err != nil {
  1221  		return nil, err
  1222  	}
  1223  	c.urlParams_.Set("alt", alt)
  1224  	c.urlParams_.Set("prettyPrint", "false")
  1225  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1226  	urls += "?" + c.urlParams_.Encode()
  1227  	req, err := http.NewRequest("PATCH", urls, body)
  1228  	if err != nil {
  1229  		return nil, err
  1230  	}
  1231  	req.Header = reqHeaders
  1232  	googleapi.Expand(req.URL, map[string]string{
  1233  		"name": c.name,
  1234  	})
  1235  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1236  }
  1237  
  1238  // Do executes the "advisorynotifications.projects.locations.updateSettings" call.
  1239  // Any non-2xx status code is an error. Response headers are in either
  1240  // *GoogleCloudAdvisorynotificationsV1Settings.ServerResponse.Header or (if a
  1241  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1242  // googleapi.IsNotModified to check whether the returned error was because
  1243  // http.StatusNotModified was returned.
  1244  func (c *ProjectsLocationsUpdateSettingsCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Settings, error) {
  1245  	gensupport.SetOptions(c.urlParams_, opts...)
  1246  	res, err := c.doRequest("json")
  1247  	if res != nil && res.StatusCode == http.StatusNotModified {
  1248  		if res.Body != nil {
  1249  			res.Body.Close()
  1250  		}
  1251  		return nil, gensupport.WrapError(&googleapi.Error{
  1252  			Code:   res.StatusCode,
  1253  			Header: res.Header,
  1254  		})
  1255  	}
  1256  	if err != nil {
  1257  		return nil, err
  1258  	}
  1259  	defer googleapi.CloseBody(res)
  1260  	if err := googleapi.CheckResponse(res); err != nil {
  1261  		return nil, gensupport.WrapError(err)
  1262  	}
  1263  	ret := &GoogleCloudAdvisorynotificationsV1Settings{
  1264  		ServerResponse: googleapi.ServerResponse{
  1265  			Header:         res.Header,
  1266  			HTTPStatusCode: res.StatusCode,
  1267  		},
  1268  	}
  1269  	target := &ret
  1270  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1271  		return nil, err
  1272  	}
  1273  	return ret, nil
  1274  }
  1275  
  1276  type ProjectsLocationsNotificationsGetCall struct {
  1277  	s            *Service
  1278  	name         string
  1279  	urlParams_   gensupport.URLParams
  1280  	ifNoneMatch_ string
  1281  	ctx_         context.Context
  1282  	header_      http.Header
  1283  }
  1284  
  1285  // Get: Gets a notification.
  1286  //
  1287  //   - name: A name of the notification to retrieve. Format:
  1288  //     organizations/{organization}/locations/{location}/notifications/{notificati
  1289  //     on} or
  1290  //     projects/{projects}/locations/{location}/notifications/{notification}.
  1291  func (r *ProjectsLocationsNotificationsService) Get(name string) *ProjectsLocationsNotificationsGetCall {
  1292  	c := &ProjectsLocationsNotificationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1293  	c.name = name
  1294  	return c
  1295  }
  1296  
  1297  // LanguageCode sets the optional parameter "languageCode": ISO code for
  1298  // requested localization language. If unset, will be interpereted as "en". If
  1299  // the requested language is valid, but not supported for this notification,
  1300  // English will be returned with an "Not applicable" LocalizationState. If the
  1301  // ISO code is invalid (i.e. not a real language), this RPC will throw an
  1302  // error.
  1303  func (c *ProjectsLocationsNotificationsGetCall) LanguageCode(languageCode string) *ProjectsLocationsNotificationsGetCall {
  1304  	c.urlParams_.Set("languageCode", languageCode)
  1305  	return c
  1306  }
  1307  
  1308  // Fields allows partial responses to be retrieved. See
  1309  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1310  // details.
  1311  func (c *ProjectsLocationsNotificationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsNotificationsGetCall {
  1312  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1313  	return c
  1314  }
  1315  
  1316  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1317  // object's ETag matches the given value. This is useful for getting updates
  1318  // only after the object has changed since the last request.
  1319  func (c *ProjectsLocationsNotificationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsNotificationsGetCall {
  1320  	c.ifNoneMatch_ = entityTag
  1321  	return c
  1322  }
  1323  
  1324  // Context sets the context to be used in this call's Do method.
  1325  func (c *ProjectsLocationsNotificationsGetCall) Context(ctx context.Context) *ProjectsLocationsNotificationsGetCall {
  1326  	c.ctx_ = ctx
  1327  	return c
  1328  }
  1329  
  1330  // Header returns a http.Header that can be modified by the caller to add
  1331  // headers to the request.
  1332  func (c *ProjectsLocationsNotificationsGetCall) Header() http.Header {
  1333  	if c.header_ == nil {
  1334  		c.header_ = make(http.Header)
  1335  	}
  1336  	return c.header_
  1337  }
  1338  
  1339  func (c *ProjectsLocationsNotificationsGetCall) doRequest(alt string) (*http.Response, error) {
  1340  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1341  	if c.ifNoneMatch_ != "" {
  1342  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1343  	}
  1344  	var body io.Reader = nil
  1345  	c.urlParams_.Set("alt", alt)
  1346  	c.urlParams_.Set("prettyPrint", "false")
  1347  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1348  	urls += "?" + c.urlParams_.Encode()
  1349  	req, err := http.NewRequest("GET", urls, body)
  1350  	if err != nil {
  1351  		return nil, err
  1352  	}
  1353  	req.Header = reqHeaders
  1354  	googleapi.Expand(req.URL, map[string]string{
  1355  		"name": c.name,
  1356  	})
  1357  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1358  }
  1359  
  1360  // Do executes the "advisorynotifications.projects.locations.notifications.get" call.
  1361  // Any non-2xx status code is an error. Response headers are in either
  1362  // *GoogleCloudAdvisorynotificationsV1Notification.ServerResponse.Header or (if
  1363  // a response was returned at all) in error.(*googleapi.Error).Header. Use
  1364  // googleapi.IsNotModified to check whether the returned error was because
  1365  // http.StatusNotModified was returned.
  1366  func (c *ProjectsLocationsNotificationsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1Notification, error) {
  1367  	gensupport.SetOptions(c.urlParams_, opts...)
  1368  	res, err := c.doRequest("json")
  1369  	if res != nil && res.StatusCode == http.StatusNotModified {
  1370  		if res.Body != nil {
  1371  			res.Body.Close()
  1372  		}
  1373  		return nil, gensupport.WrapError(&googleapi.Error{
  1374  			Code:   res.StatusCode,
  1375  			Header: res.Header,
  1376  		})
  1377  	}
  1378  	if err != nil {
  1379  		return nil, err
  1380  	}
  1381  	defer googleapi.CloseBody(res)
  1382  	if err := googleapi.CheckResponse(res); err != nil {
  1383  		return nil, gensupport.WrapError(err)
  1384  	}
  1385  	ret := &GoogleCloudAdvisorynotificationsV1Notification{
  1386  		ServerResponse: googleapi.ServerResponse{
  1387  			Header:         res.Header,
  1388  			HTTPStatusCode: res.StatusCode,
  1389  		},
  1390  	}
  1391  	target := &ret
  1392  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1393  		return nil, err
  1394  	}
  1395  	return ret, nil
  1396  }
  1397  
  1398  type ProjectsLocationsNotificationsListCall struct {
  1399  	s            *Service
  1400  	parent       string
  1401  	urlParams_   gensupport.URLParams
  1402  	ifNoneMatch_ string
  1403  	ctx_         context.Context
  1404  	header_      http.Header
  1405  }
  1406  
  1407  // List: Lists notifications under a given parent.
  1408  //
  1409  //   - parent: The parent, which owns this collection of notifications. Must be
  1410  //     of the form "organizations/{organization}/locations/{location}" or
  1411  //     "projects/{project}/locations/{location}".
  1412  func (r *ProjectsLocationsNotificationsService) List(parent string) *ProjectsLocationsNotificationsListCall {
  1413  	c := &ProjectsLocationsNotificationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1414  	c.parent = parent
  1415  	return c
  1416  }
  1417  
  1418  // LanguageCode sets the optional parameter "languageCode": ISO code for
  1419  // requested localization language. If unset, will be interpereted as "en". If
  1420  // the requested language is valid, but not supported for this notification,
  1421  // English will be returned with an "Not applicable" LocalizationState. If the
  1422  // ISO code is invalid (i.e. not a real language), this RPC will throw an
  1423  // error.
  1424  func (c *ProjectsLocationsNotificationsListCall) LanguageCode(languageCode string) *ProjectsLocationsNotificationsListCall {
  1425  	c.urlParams_.Set("languageCode", languageCode)
  1426  	return c
  1427  }
  1428  
  1429  // PageSize sets the optional parameter "pageSize": The maximum number of
  1430  // notifications to return. The service may return fewer than this value. If
  1431  // unspecified or equal to 0, at most 50 notifications will be returned. The
  1432  // maximum value is 50; values above 50 will be coerced to 50.
  1433  func (c *ProjectsLocationsNotificationsListCall) PageSize(pageSize int64) *ProjectsLocationsNotificationsListCall {
  1434  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1435  	return c
  1436  }
  1437  
  1438  // PageToken sets the optional parameter "pageToken": A page token returned
  1439  // from a previous request. When paginating, all other parameters provided in
  1440  // the request must match the call that returned the page token.
  1441  func (c *ProjectsLocationsNotificationsListCall) PageToken(pageToken string) *ProjectsLocationsNotificationsListCall {
  1442  	c.urlParams_.Set("pageToken", pageToken)
  1443  	return c
  1444  }
  1445  
  1446  // View sets the optional parameter "view": Specifies which parts of the
  1447  // notification resource should be returned in the response.
  1448  //
  1449  // Possible values:
  1450  //
  1451  //	"NOTIFICATION_VIEW_UNSPECIFIED" - Not specified, equivalent to BASIC.
  1452  //	"BASIC" - Server responses only include title, creation time and
  1453  //
  1454  // Notification ID. Note: for internal use responses also include the last
  1455  // update time, the latest message text and whether notification has
  1456  // attachments.
  1457  //
  1458  //	"FULL" - Include everything.
  1459  func (c *ProjectsLocationsNotificationsListCall) View(view string) *ProjectsLocationsNotificationsListCall {
  1460  	c.urlParams_.Set("view", view)
  1461  	return c
  1462  }
  1463  
  1464  // Fields allows partial responses to be retrieved. See
  1465  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1466  // details.
  1467  func (c *ProjectsLocationsNotificationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsNotificationsListCall {
  1468  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1469  	return c
  1470  }
  1471  
  1472  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1473  // object's ETag matches the given value. This is useful for getting updates
  1474  // only after the object has changed since the last request.
  1475  func (c *ProjectsLocationsNotificationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsNotificationsListCall {
  1476  	c.ifNoneMatch_ = entityTag
  1477  	return c
  1478  }
  1479  
  1480  // Context sets the context to be used in this call's Do method.
  1481  func (c *ProjectsLocationsNotificationsListCall) Context(ctx context.Context) *ProjectsLocationsNotificationsListCall {
  1482  	c.ctx_ = ctx
  1483  	return c
  1484  }
  1485  
  1486  // Header returns a http.Header that can be modified by the caller to add
  1487  // headers to the request.
  1488  func (c *ProjectsLocationsNotificationsListCall) Header() http.Header {
  1489  	if c.header_ == nil {
  1490  		c.header_ = make(http.Header)
  1491  	}
  1492  	return c.header_
  1493  }
  1494  
  1495  func (c *ProjectsLocationsNotificationsListCall) doRequest(alt string) (*http.Response, error) {
  1496  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1497  	if c.ifNoneMatch_ != "" {
  1498  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1499  	}
  1500  	var body io.Reader = nil
  1501  	c.urlParams_.Set("alt", alt)
  1502  	c.urlParams_.Set("prettyPrint", "false")
  1503  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/notifications")
  1504  	urls += "?" + c.urlParams_.Encode()
  1505  	req, err := http.NewRequest("GET", urls, body)
  1506  	if err != nil {
  1507  		return nil, err
  1508  	}
  1509  	req.Header = reqHeaders
  1510  	googleapi.Expand(req.URL, map[string]string{
  1511  		"parent": c.parent,
  1512  	})
  1513  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1514  }
  1515  
  1516  // Do executes the "advisorynotifications.projects.locations.notifications.list" call.
  1517  // Any non-2xx status code is an error. Response headers are in either
  1518  // *GoogleCloudAdvisorynotificationsV1ListNotificationsResponse.ServerResponse.H
  1519  // eader or (if a response was returned at all) in
  1520  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1521  // whether the returned error was because http.StatusNotModified was returned.
  1522  func (c *ProjectsLocationsNotificationsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudAdvisorynotificationsV1ListNotificationsResponse, error) {
  1523  	gensupport.SetOptions(c.urlParams_, opts...)
  1524  	res, err := c.doRequest("json")
  1525  	if res != nil && res.StatusCode == http.StatusNotModified {
  1526  		if res.Body != nil {
  1527  			res.Body.Close()
  1528  		}
  1529  		return nil, gensupport.WrapError(&googleapi.Error{
  1530  			Code:   res.StatusCode,
  1531  			Header: res.Header,
  1532  		})
  1533  	}
  1534  	if err != nil {
  1535  		return nil, err
  1536  	}
  1537  	defer googleapi.CloseBody(res)
  1538  	if err := googleapi.CheckResponse(res); err != nil {
  1539  		return nil, gensupport.WrapError(err)
  1540  	}
  1541  	ret := &GoogleCloudAdvisorynotificationsV1ListNotificationsResponse{
  1542  		ServerResponse: googleapi.ServerResponse{
  1543  			Header:         res.Header,
  1544  			HTTPStatusCode: res.StatusCode,
  1545  		},
  1546  	}
  1547  	target := &ret
  1548  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1549  		return nil, err
  1550  	}
  1551  	return ret, nil
  1552  }
  1553  
  1554  // Pages invokes f for each page of results.
  1555  // A non-nil error returned from f will halt the iteration.
  1556  // The provided context supersedes any context provided to the Context method.
  1557  func (c *ProjectsLocationsNotificationsListCall) Pages(ctx context.Context, f func(*GoogleCloudAdvisorynotificationsV1ListNotificationsResponse) error) error {
  1558  	c.ctx_ = ctx
  1559  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1560  	for {
  1561  		x, err := c.Do()
  1562  		if err != nil {
  1563  			return err
  1564  		}
  1565  		if err := f(x); err != nil {
  1566  			return err
  1567  		}
  1568  		if x.NextPageToken == "" {
  1569  			return nil
  1570  		}
  1571  		c.PageToken(x.NextPageToken)
  1572  	}
  1573  }
  1574  

View as plain text