...

Source file src/google.golang.org/api/clouderrorreporting/v1beta1/clouderrorreporting-gen.go

Documentation: google.golang.org/api/clouderrorreporting/v1beta1

     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 clouderrorreporting provides access to the Error Reporting API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/error-reporting/
    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/clouderrorreporting/v1beta1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	clouderrorreportingService, err := clouderrorreporting.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  //	clouderrorreportingService, err := clouderrorreporting.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  //	clouderrorreportingService, err := clouderrorreporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package clouderrorreporting // import "google.golang.org/api/clouderrorreporting/v1beta1"
    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 = "clouderrorreporting:v1beta1"
    90  const apiName = "clouderrorreporting"
    91  const apiVersion = "v1beta1"
    92  const basePath = "https://clouderrorreporting.googleapis.com/"
    93  const basePathTemplate = "https://clouderrorreporting.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://clouderrorreporting.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.Projects = NewProjectsService(s)
   139  	return s, nil
   140  }
   141  
   142  type Service struct {
   143  	client    *http.Client
   144  	BasePath  string // API endpoint base URL
   145  	UserAgent string // optional additional User-Agent fragment
   146  
   147  	Projects *ProjectsService
   148  }
   149  
   150  func (s *Service) userAgent() string {
   151  	if s.UserAgent == "" {
   152  		return googleapi.UserAgent
   153  	}
   154  	return googleapi.UserAgent + " " + s.UserAgent
   155  }
   156  
   157  func NewProjectsService(s *Service) *ProjectsService {
   158  	rs := &ProjectsService{s: s}
   159  	rs.Events = NewProjectsEventsService(s)
   160  	rs.GroupStats = NewProjectsGroupStatsService(s)
   161  	rs.Groups = NewProjectsGroupsService(s)
   162  	return rs
   163  }
   164  
   165  type ProjectsService struct {
   166  	s *Service
   167  
   168  	Events *ProjectsEventsService
   169  
   170  	GroupStats *ProjectsGroupStatsService
   171  
   172  	Groups *ProjectsGroupsService
   173  }
   174  
   175  func NewProjectsEventsService(s *Service) *ProjectsEventsService {
   176  	rs := &ProjectsEventsService{s: s}
   177  	return rs
   178  }
   179  
   180  type ProjectsEventsService struct {
   181  	s *Service
   182  }
   183  
   184  func NewProjectsGroupStatsService(s *Service) *ProjectsGroupStatsService {
   185  	rs := &ProjectsGroupStatsService{s: s}
   186  	return rs
   187  }
   188  
   189  type ProjectsGroupStatsService struct {
   190  	s *Service
   191  }
   192  
   193  func NewProjectsGroupsService(s *Service) *ProjectsGroupsService {
   194  	rs := &ProjectsGroupsService{s: s}
   195  	return rs
   196  }
   197  
   198  type ProjectsGroupsService struct {
   199  	s *Service
   200  }
   201  
   202  // DeleteEventsResponse: Response message for deleting error events.
   203  type DeleteEventsResponse struct {
   204  	// ServerResponse contains the HTTP response code and headers from the server.
   205  	googleapi.ServerResponse `json:"-"`
   206  }
   207  
   208  // ErrorContext: A description of the context in which an error occurred. This
   209  // data should be provided by the application when reporting an error, unless
   210  // the error report has been generated automatically from Google App Engine
   211  // logs.
   212  type ErrorContext struct {
   213  	// HttpRequest: The HTTP request which was processed when the error was
   214  	// triggered.
   215  	HttpRequest *HttpRequestContext `json:"httpRequest,omitempty"`
   216  	// ReportLocation: The location in the source code where the decision was made
   217  	// to report the error, usually the place where it was logged. For a logged
   218  	// exception this would be the source line where the exception is logged,
   219  	// usually close to the place where it was caught.
   220  	ReportLocation *SourceLocation `json:"reportLocation,omitempty"`
   221  	// SourceReferences: Source code that was used to build the executable which
   222  	// has caused the given error message.
   223  	SourceReferences []*SourceReference `json:"sourceReferences,omitempty"`
   224  	// User: The user who caused or was affected by the crash. This can be a user
   225  	// ID, an email address, or an arbitrary token that uniquely identifies the
   226  	// user. When sending an error report, leave this field empty if the user was
   227  	// not logged in. In this case the Error Reporting system will use other data,
   228  	// such as remote IP address, to distinguish affected users. See
   229  	// `affected_users_count` in `ErrorGroupStats`.
   230  	User string `json:"user,omitempty"`
   231  	// ForceSendFields is a list of field names (e.g. "HttpRequest") to
   232  	// unconditionally include in API requests. By default, fields with empty or
   233  	// default values are omitted from API requests. See
   234  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   235  	// details.
   236  	ForceSendFields []string `json:"-"`
   237  	// NullFields is a list of field names (e.g. "HttpRequest") to include in API
   238  	// requests with the JSON null value. By default, fields with empty values are
   239  	// omitted from API requests. See
   240  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   241  	NullFields []string `json:"-"`
   242  }
   243  
   244  func (s *ErrorContext) MarshalJSON() ([]byte, error) {
   245  	type NoMethod ErrorContext
   246  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   247  }
   248  
   249  // ErrorEvent: An error event which is returned by the Error Reporting system.
   250  type ErrorEvent struct {
   251  	// Context: Data about the context in which the error occurred.
   252  	Context *ErrorContext `json:"context,omitempty"`
   253  	// EventTime: Time when the event occurred as provided in the error report. If
   254  	// the report did not contain a timestamp, the time the error was received by
   255  	// the Error Reporting system is used.
   256  	EventTime string `json:"eventTime,omitempty"`
   257  	// Message: The stack trace that was reported or logged by the service.
   258  	Message string `json:"message,omitempty"`
   259  	// ServiceContext: The `ServiceContext` for which this error was reported.
   260  	ServiceContext *ServiceContext `json:"serviceContext,omitempty"`
   261  	// ForceSendFields is a list of field names (e.g. "Context") to unconditionally
   262  	// include in API requests. By default, fields with empty or default values are
   263  	// omitted from API requests. See
   264  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   265  	// details.
   266  	ForceSendFields []string `json:"-"`
   267  	// NullFields is a list of field names (e.g. "Context") to include in API
   268  	// requests with the JSON null value. By default, fields with empty values are
   269  	// omitted from API requests. See
   270  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   271  	NullFields []string `json:"-"`
   272  }
   273  
   274  func (s *ErrorEvent) MarshalJSON() ([]byte, error) {
   275  	type NoMethod ErrorEvent
   276  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   277  }
   278  
   279  // ErrorGroup: Description of a group of similar error events.
   280  type ErrorGroup struct {
   281  	// GroupId: An opaque identifier of the group. This field is assigned by the
   282  	// Error Reporting system and always populated. In the group resource name, the
   283  	// `group_id` is a unique identifier for a particular error group. The
   284  	// identifier is derived from key parts of the error-log content and is treated
   285  	// as Service Data. For information about how Service Data is handled, see
   286  	// Google Cloud Privacy Notice
   287  	// (https://cloud.google.com/terms/cloud-privacy-notice).
   288  	GroupId string `json:"groupId,omitempty"`
   289  	// Name: The group resource name. Written as
   290  	// `projects/{projectID}/groups/{group_id}`. Example:
   291  	// `projects/my-project-123/groups/my-group` In the group resource name, the
   292  	// `group_id` is a unique identifier for a particular error group. The
   293  	// identifier is derived from key parts of the error-log content and is treated
   294  	// as Service Data. For information about how Service Data is handled, see
   295  	// Google Cloud Privacy Notice
   296  	// (https://cloud.google.com/terms/cloud-privacy-notice).
   297  	Name string `json:"name,omitempty"`
   298  	// ResolutionStatus: Error group's resolution status. An unspecified resolution
   299  	// status will be interpreted as OPEN
   300  	//
   301  	// Possible values:
   302  	//   "RESOLUTION_STATUS_UNSPECIFIED" - Status is unknown. When left unspecified
   303  	// in requests, it is treated like OPEN.
   304  	//   "OPEN" - The error group is not being addressed. This is the default for
   305  	// new groups. It is also used for errors re-occurring after marked RESOLVED.
   306  	//   "ACKNOWLEDGED" - Error Group manually acknowledged, it can have an issue
   307  	// link attached.
   308  	//   "RESOLVED" - Error Group manually resolved, more events for this group are
   309  	// not expected to occur.
   310  	//   "MUTED" - The error group is muted and excluded by default on group stats
   311  	// requests.
   312  	ResolutionStatus string `json:"resolutionStatus,omitempty"`
   313  	// TrackingIssues: Associated tracking issues.
   314  	TrackingIssues []*TrackingIssue `json:"trackingIssues,omitempty"`
   315  
   316  	// ServerResponse contains the HTTP response code and headers from the server.
   317  	googleapi.ServerResponse `json:"-"`
   318  	// ForceSendFields is a list of field names (e.g. "GroupId") to unconditionally
   319  	// include in API requests. By default, fields with empty or default values are
   320  	// omitted from API requests. See
   321  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   322  	// details.
   323  	ForceSendFields []string `json:"-"`
   324  	// NullFields is a list of field names (e.g. "GroupId") to include in API
   325  	// requests with the JSON null value. By default, fields with empty values are
   326  	// omitted from API requests. See
   327  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   328  	NullFields []string `json:"-"`
   329  }
   330  
   331  func (s *ErrorGroup) MarshalJSON() ([]byte, error) {
   332  	type NoMethod ErrorGroup
   333  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   334  }
   335  
   336  // ErrorGroupStats: Data extracted for a specific group based on certain filter
   337  // criteria, such as a given time period and/or service filter.
   338  type ErrorGroupStats struct {
   339  	// AffectedServices: Service contexts with a non-zero error count for the given
   340  	// filter criteria. This list can be truncated if multiple services are
   341  	// affected. Refer to `num_affected_services` for the total count.
   342  	AffectedServices []*ServiceContext `json:"affectedServices,omitempty"`
   343  	// AffectedUsersCount: Approximate number of affected users in the given group
   344  	// that match the filter criteria. Users are distinguished by data in the
   345  	// ErrorContext of the individual error events, such as their login name or
   346  	// their remote IP address in case of HTTP requests. The number of affected
   347  	// users can be zero even if the number of errors is non-zero if no data was
   348  	// provided from which the affected user could be deduced. Users are counted
   349  	// based on data in the request context that was provided in the error report.
   350  	// If more users are implicitly affected, such as due to a crash of the whole
   351  	// service, this is not reflected here.
   352  	AffectedUsersCount int64 `json:"affectedUsersCount,omitempty,string"`
   353  	// Count: Approximate total number of events in the given group that match the
   354  	// filter criteria.
   355  	Count int64 `json:"count,omitempty,string"`
   356  	// FirstSeenTime: Approximate first occurrence that was ever seen for this
   357  	// group and which matches the given filter criteria, ignoring the time_range
   358  	// that was specified in the request.
   359  	FirstSeenTime string `json:"firstSeenTime,omitempty"`
   360  	// Group: Group data that is independent of the filter criteria.
   361  	Group *ErrorGroup `json:"group,omitempty"`
   362  	// LastSeenTime: Approximate last occurrence that was ever seen for this group
   363  	// and which matches the given filter criteria, ignoring the time_range that
   364  	// was specified in the request.
   365  	LastSeenTime string `json:"lastSeenTime,omitempty"`
   366  	// NumAffectedServices: The total number of services with a non-zero error
   367  	// count for the given filter criteria.
   368  	NumAffectedServices int64 `json:"numAffectedServices,omitempty"`
   369  	// Representative: An arbitrary event that is chosen as representative for the
   370  	// whole group. The representative event is intended to be used as a quick
   371  	// preview for the whole group. Events in the group are usually sufficiently
   372  	// similar to each other such that showing an arbitrary representative provides
   373  	// insight into the characteristics of the group as a whole.
   374  	Representative *ErrorEvent `json:"representative,omitempty"`
   375  	// TimedCounts: Approximate number of occurrences over time. Timed counts
   376  	// returned by ListGroups are guaranteed to be: - Inside the requested time
   377  	// interval - Non-overlapping, and - Ordered by ascending time.
   378  	TimedCounts []*TimedCount `json:"timedCounts,omitempty"`
   379  	// ForceSendFields is a list of field names (e.g. "AffectedServices") to
   380  	// unconditionally include in API requests. By default, fields with empty or
   381  	// default values are omitted from API requests. See
   382  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   383  	// details.
   384  	ForceSendFields []string `json:"-"`
   385  	// NullFields is a list of field names (e.g. "AffectedServices") to include in
   386  	// API requests with the JSON null value. By default, fields with empty values
   387  	// are omitted from API requests. See
   388  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   389  	NullFields []string `json:"-"`
   390  }
   391  
   392  func (s *ErrorGroupStats) MarshalJSON() ([]byte, error) {
   393  	type NoMethod ErrorGroupStats
   394  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   395  }
   396  
   397  // HttpRequestContext: HTTP request data that is related to a reported error.
   398  // This data should be provided by the application when reporting an error,
   399  // unless the error report has been generated automatically from Google App
   400  // Engine logs.
   401  type HttpRequestContext struct {
   402  	// Method: The type of HTTP request, such as `GET`, `POST`, etc.
   403  	Method string `json:"method,omitempty"`
   404  	// Referrer: The referrer information that is provided with the request.
   405  	Referrer string `json:"referrer,omitempty"`
   406  	// RemoteIp: The IP address from which the request originated. This can be
   407  	// IPv4, IPv6, or a token which is derived from the IP address, depending on
   408  	// the data that has been provided in the error report.
   409  	RemoteIp string `json:"remoteIp,omitempty"`
   410  	// ResponseStatusCode: The HTTP response status code for the request.
   411  	ResponseStatusCode int64 `json:"responseStatusCode,omitempty"`
   412  	// Url: The URL of the request.
   413  	Url string `json:"url,omitempty"`
   414  	// UserAgent: The user agent information that is provided with the request.
   415  	UserAgent string `json:"userAgent,omitempty"`
   416  	// ForceSendFields is a list of field names (e.g. "Method") to unconditionally
   417  	// include in API requests. By default, fields with empty or default values are
   418  	// omitted from API requests. See
   419  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   420  	// details.
   421  	ForceSendFields []string `json:"-"`
   422  	// NullFields is a list of field names (e.g. "Method") to include in API
   423  	// requests with the JSON null value. By default, fields with empty values are
   424  	// omitted from API requests. See
   425  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   426  	NullFields []string `json:"-"`
   427  }
   428  
   429  func (s *HttpRequestContext) MarshalJSON() ([]byte, error) {
   430  	type NoMethod HttpRequestContext
   431  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   432  }
   433  
   434  // ListEventsResponse: Contains a set of requested error events.
   435  type ListEventsResponse struct {
   436  	// ErrorEvents: The error events which match the given request.
   437  	ErrorEvents []*ErrorEvent `json:"errorEvents,omitempty"`
   438  	// NextPageToken: If non-empty, more results are available. Pass this token,
   439  	// along with the same query parameters as the first request, to view the next
   440  	// page of results.
   441  	NextPageToken string `json:"nextPageToken,omitempty"`
   442  	// TimeRangeBegin: The timestamp specifies the start time to which the request
   443  	// was restricted.
   444  	TimeRangeBegin string `json:"timeRangeBegin,omitempty"`
   445  
   446  	// ServerResponse contains the HTTP response code and headers from the server.
   447  	googleapi.ServerResponse `json:"-"`
   448  	// ForceSendFields is a list of field names (e.g. "ErrorEvents") to
   449  	// unconditionally include in API requests. By default, fields with empty or
   450  	// default values are omitted from API requests. See
   451  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   452  	// details.
   453  	ForceSendFields []string `json:"-"`
   454  	// NullFields is a list of field names (e.g. "ErrorEvents") to include in API
   455  	// requests with the JSON null value. By default, fields with empty values are
   456  	// omitted from API requests. See
   457  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   458  	NullFields []string `json:"-"`
   459  }
   460  
   461  func (s *ListEventsResponse) MarshalJSON() ([]byte, error) {
   462  	type NoMethod ListEventsResponse
   463  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   464  }
   465  
   466  // ListGroupStatsResponse: Contains a set of requested error group stats.
   467  type ListGroupStatsResponse struct {
   468  	// ErrorGroupStats: The error group stats which match the given request.
   469  	ErrorGroupStats []*ErrorGroupStats `json:"errorGroupStats,omitempty"`
   470  	// NextPageToken: If non-empty, more results are available. Pass this token,
   471  	// along with the same query parameters as the first request, to view the next
   472  	// page of results.
   473  	NextPageToken string `json:"nextPageToken,omitempty"`
   474  	// TimeRangeBegin: The timestamp specifies the start time to which the request
   475  	// was restricted. The start time is set based on the requested time range. It
   476  	// may be adjusted to a later time if a project has exceeded the storage quota
   477  	// and older data has been deleted.
   478  	TimeRangeBegin string `json:"timeRangeBegin,omitempty"`
   479  
   480  	// ServerResponse contains the HTTP response code and headers from the server.
   481  	googleapi.ServerResponse `json:"-"`
   482  	// ForceSendFields is a list of field names (e.g. "ErrorGroupStats") to
   483  	// unconditionally include in API requests. By default, fields with empty or
   484  	// default values are omitted from API requests. See
   485  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   486  	// details.
   487  	ForceSendFields []string `json:"-"`
   488  	// NullFields is a list of field names (e.g. "ErrorGroupStats") to include in
   489  	// API requests with the JSON null value. By default, fields with empty values
   490  	// are omitted from API requests. See
   491  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   492  	NullFields []string `json:"-"`
   493  }
   494  
   495  func (s *ListGroupStatsResponse) MarshalJSON() ([]byte, error) {
   496  	type NoMethod ListGroupStatsResponse
   497  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   498  }
   499  
   500  // ReportErrorEventResponse: Response for reporting an individual error event.
   501  // Data may be added to this message in the future.
   502  type ReportErrorEventResponse struct {
   503  	// ServerResponse contains the HTTP response code and headers from the server.
   504  	googleapi.ServerResponse `json:"-"`
   505  }
   506  
   507  // ReportedErrorEvent: An error event which is reported to the Error Reporting
   508  // system.
   509  type ReportedErrorEvent struct {
   510  	// Context: Optional. A description of the context in which the error occurred.
   511  	Context *ErrorContext `json:"context,omitempty"`
   512  	// EventTime: Optional. Time when the event occurred. If not provided, the time
   513  	// when the event was received by the Error Reporting system is used. If
   514  	// provided, the time must not exceed the logs retention period
   515  	// (https://cloud.google.com/logging/quotas#logs_retention_periods) in the
   516  	// past, or be more than 24 hours in the future. If an invalid time is
   517  	// provided, then an error is returned.
   518  	EventTime string `json:"eventTime,omitempty"`
   519  	// Message: Required. The error message. If no `context.reportLocation` is
   520  	// provided, the message must contain a header (typically consisting of the
   521  	// exception type name and an error message) and an exception stack trace in
   522  	// one of the supported programming languages and formats. Supported languages
   523  	// are Java, Python, JavaScript, Ruby, C#, PHP, and Go. Supported stack trace
   524  	// formats are: * **Java**: Must be the return value of
   525  	// `Throwable.printStackTrace()`
   526  	// (https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29).
   527  	// * **Python**: Must be the return value of `traceback.format_exc()`
   528  	// (https://docs.python.org/2/library/traceback.html#traceback.format_exc). *
   529  	// **JavaScript**: Must be the value of `error.stack`
   530  	// (https://github.com/v8/v8/wiki/Stack-Trace-API) as returned by V8. *
   531  	// **Ruby**: Must contain frames returned by `Exception.backtrace`
   532  	// (https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace). *
   533  	// **C#**: Must be the return value of `Exception.ToString()`
   534  	// (https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx). *
   535  	// **PHP**: Must be prefixed with "PHP (Notice|Parse error|Fatal
   536  	// error|Warning): " and contain the result of `(string)$exception`
   537  	// (https://php.net/manual/en/exception.tostring.php). * **Go**: Must be the
   538  	// return value of `runtime.Stack()`
   539  	// (https://golang.org/pkg/runtime/debug/#Stack).
   540  	Message string `json:"message,omitempty"`
   541  	// ServiceContext: Required. The service context in which this error has
   542  	// occurred.
   543  	ServiceContext *ServiceContext `json:"serviceContext,omitempty"`
   544  	// ForceSendFields is a list of field names (e.g. "Context") to unconditionally
   545  	// include in API requests. By default, fields with empty or default values are
   546  	// omitted from API requests. See
   547  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   548  	// details.
   549  	ForceSendFields []string `json:"-"`
   550  	// NullFields is a list of field names (e.g. "Context") to include in API
   551  	// requests with the JSON null value. By default, fields with empty values are
   552  	// omitted from API requests. See
   553  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   554  	NullFields []string `json:"-"`
   555  }
   556  
   557  func (s *ReportedErrorEvent) MarshalJSON() ([]byte, error) {
   558  	type NoMethod ReportedErrorEvent
   559  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   560  }
   561  
   562  // ServiceContext: Describes a running service that sends errors. Its version
   563  // changes over time and multiple versions can run in parallel.
   564  type ServiceContext struct {
   565  	// ResourceType: Type of the MonitoredResource. List of possible values:
   566  	// https://cloud.google.com/monitoring/api/resources Value is set automatically
   567  	// for incoming errors and must not be set when reporting errors.
   568  	ResourceType string `json:"resourceType,omitempty"`
   569  	// Service: An identifier of the service, such as the name of the executable,
   570  	// job, or Google App Engine service name. This field is expected to have a low
   571  	// number of values that are relatively stable over time, as opposed to
   572  	// `version`, which can be changed whenever new code is deployed. Contains the
   573  	// service name for error reports extracted from Google App Engine logs or
   574  	// `default` if the App Engine default service is used.
   575  	Service string `json:"service,omitempty"`
   576  	// Version: Represents the source code version that the developer provided,
   577  	// which could represent a version label or a Git SHA-1 hash, for example. For
   578  	// App Engine standard environment, the version is set to the version of the
   579  	// app.
   580  	Version string `json:"version,omitempty"`
   581  	// ForceSendFields is a list of field names (e.g. "ResourceType") to
   582  	// unconditionally include in API requests. By default, fields with empty or
   583  	// default values are omitted from API requests. See
   584  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   585  	// details.
   586  	ForceSendFields []string `json:"-"`
   587  	// NullFields is a list of field names (e.g. "ResourceType") to include in API
   588  	// requests with the JSON null value. By default, fields with empty values are
   589  	// omitted from API requests. See
   590  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   591  	NullFields []string `json:"-"`
   592  }
   593  
   594  func (s *ServiceContext) MarshalJSON() ([]byte, error) {
   595  	type NoMethod ServiceContext
   596  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   597  }
   598  
   599  // SourceLocation: Indicates a location in the source code of the service for
   600  // which errors are reported. `functionName` must be provided by the
   601  // application when reporting an error, unless the error report contains a
   602  // `message` with a supported exception stack trace. All fields are optional
   603  // for the later case.
   604  type SourceLocation struct {
   605  	// FilePath: The source code filename, which can include a truncated relative
   606  	// path, or a full path from a production machine.
   607  	FilePath string `json:"filePath,omitempty"`
   608  	// FunctionName: Human-readable name of a function or method. The value can
   609  	// include optional context like the class or package name. For example,
   610  	// `my.package.MyClass.method` in case of Java.
   611  	FunctionName string `json:"functionName,omitempty"`
   612  	// LineNumber: 1-based. 0 indicates that the line number is unknown.
   613  	LineNumber int64 `json:"lineNumber,omitempty"`
   614  	// ForceSendFields is a list of field names (e.g. "FilePath") to
   615  	// unconditionally include in API requests. By default, fields with empty or
   616  	// default values are omitted from API requests. See
   617  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   618  	// details.
   619  	ForceSendFields []string `json:"-"`
   620  	// NullFields is a list of field names (e.g. "FilePath") to include in API
   621  	// requests with the JSON null value. By default, fields with empty values are
   622  	// omitted from API requests. See
   623  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   624  	NullFields []string `json:"-"`
   625  }
   626  
   627  func (s *SourceLocation) MarshalJSON() ([]byte, error) {
   628  	type NoMethod SourceLocation
   629  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   630  }
   631  
   632  // SourceReference: A reference to a particular snapshot of the source tree
   633  // used to build and deploy an application.
   634  type SourceReference struct {
   635  	// Repository: Optional. A URI string identifying the repository. Example:
   636  	// "https://github.com/GoogleCloudPlatform/kubernetes.git"
   637  	Repository string `json:"repository,omitempty"`
   638  	// RevisionId: The canonical and persistent identifier of the deployed
   639  	// revision. Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
   640  	RevisionId string `json:"revisionId,omitempty"`
   641  	// ForceSendFields is a list of field names (e.g. "Repository") to
   642  	// unconditionally include in API requests. By default, fields with empty or
   643  	// default values are omitted from API requests. See
   644  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   645  	// details.
   646  	ForceSendFields []string `json:"-"`
   647  	// NullFields is a list of field names (e.g. "Repository") to include in API
   648  	// requests with the JSON null value. By default, fields with empty values are
   649  	// omitted from API requests. See
   650  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   651  	NullFields []string `json:"-"`
   652  }
   653  
   654  func (s *SourceReference) MarshalJSON() ([]byte, error) {
   655  	type NoMethod SourceReference
   656  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   657  }
   658  
   659  // TimedCount: The number of errors in a given time period. All numbers are
   660  // approximate since the error events are sampled before counting them.
   661  type TimedCount struct {
   662  	// Count: Approximate number of occurrences in the given time period.
   663  	Count int64 `json:"count,omitempty,string"`
   664  	// EndTime: End of the time period to which `count` refers (excluded).
   665  	EndTime string `json:"endTime,omitempty"`
   666  	// StartTime: Start of the time period to which `count` refers (included).
   667  	StartTime string `json:"startTime,omitempty"`
   668  	// ForceSendFields is a list of field names (e.g. "Count") to unconditionally
   669  	// include in API requests. By default, fields with empty or default values are
   670  	// omitted from API requests. See
   671  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   672  	// details.
   673  	ForceSendFields []string `json:"-"`
   674  	// NullFields is a list of field names (e.g. "Count") to include in API
   675  	// requests with the JSON null value. By default, fields with empty values are
   676  	// omitted from API requests. See
   677  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   678  	NullFields []string `json:"-"`
   679  }
   680  
   681  func (s *TimedCount) MarshalJSON() ([]byte, error) {
   682  	type NoMethod TimedCount
   683  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   684  }
   685  
   686  // TrackingIssue: Information related to tracking the progress on resolving the
   687  // error.
   688  type TrackingIssue struct {
   689  	// Url: A URL pointing to a related entry in an issue tracking system. Example:
   690  	// `https://github.com/user/project/issues/4`
   691  	Url string `json:"url,omitempty"`
   692  	// ForceSendFields is a list of field names (e.g. "Url") to unconditionally
   693  	// include in API requests. By default, fields with empty or default values are
   694  	// omitted from API requests. See
   695  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   696  	// details.
   697  	ForceSendFields []string `json:"-"`
   698  	// NullFields is a list of field names (e.g. "Url") to include in API requests
   699  	// with the JSON null value. By default, fields with empty values are omitted
   700  	// from API requests. See
   701  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   702  	NullFields []string `json:"-"`
   703  }
   704  
   705  func (s *TrackingIssue) MarshalJSON() ([]byte, error) {
   706  	type NoMethod TrackingIssue
   707  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   708  }
   709  
   710  type ProjectsDeleteEventsCall struct {
   711  	s           *Service
   712  	projectName string
   713  	urlParams_  gensupport.URLParams
   714  	ctx_        context.Context
   715  	header_     http.Header
   716  }
   717  
   718  // DeleteEvents: Deletes all error events of a given project.
   719  //
   720  //   - projectName: The resource name of the Google Cloud Platform project.
   721  //     Written as `projects/{projectID}`, where `{projectID}` is the Google Cloud
   722  //     Platform project ID (https://support.google.com/cloud/answer/6158840).
   723  //     Example: `projects/my-project-123`.
   724  func (r *ProjectsService) DeleteEvents(projectName string) *ProjectsDeleteEventsCall {
   725  	c := &ProjectsDeleteEventsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   726  	c.projectName = projectName
   727  	return c
   728  }
   729  
   730  // Fields allows partial responses to be retrieved. See
   731  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   732  // details.
   733  func (c *ProjectsDeleteEventsCall) Fields(s ...googleapi.Field) *ProjectsDeleteEventsCall {
   734  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   735  	return c
   736  }
   737  
   738  // Context sets the context to be used in this call's Do method.
   739  func (c *ProjectsDeleteEventsCall) Context(ctx context.Context) *ProjectsDeleteEventsCall {
   740  	c.ctx_ = ctx
   741  	return c
   742  }
   743  
   744  // Header returns a http.Header that can be modified by the caller to add
   745  // headers to the request.
   746  func (c *ProjectsDeleteEventsCall) Header() http.Header {
   747  	if c.header_ == nil {
   748  		c.header_ = make(http.Header)
   749  	}
   750  	return c.header_
   751  }
   752  
   753  func (c *ProjectsDeleteEventsCall) doRequest(alt string) (*http.Response, error) {
   754  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   755  	var body io.Reader = nil
   756  	c.urlParams_.Set("alt", alt)
   757  	c.urlParams_.Set("prettyPrint", "false")
   758  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events")
   759  	urls += "?" + c.urlParams_.Encode()
   760  	req, err := http.NewRequest("DELETE", urls, body)
   761  	if err != nil {
   762  		return nil, err
   763  	}
   764  	req.Header = reqHeaders
   765  	googleapi.Expand(req.URL, map[string]string{
   766  		"projectName": c.projectName,
   767  	})
   768  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   769  }
   770  
   771  // Do executes the "clouderrorreporting.projects.deleteEvents" call.
   772  // Any non-2xx status code is an error. Response headers are in either
   773  // *DeleteEventsResponse.ServerResponse.Header or (if a response was returned
   774  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   775  // check whether the returned error was because http.StatusNotModified was
   776  // returned.
   777  func (c *ProjectsDeleteEventsCall) Do(opts ...googleapi.CallOption) (*DeleteEventsResponse, error) {
   778  	gensupport.SetOptions(c.urlParams_, opts...)
   779  	res, err := c.doRequest("json")
   780  	if res != nil && res.StatusCode == http.StatusNotModified {
   781  		if res.Body != nil {
   782  			res.Body.Close()
   783  		}
   784  		return nil, gensupport.WrapError(&googleapi.Error{
   785  			Code:   res.StatusCode,
   786  			Header: res.Header,
   787  		})
   788  	}
   789  	if err != nil {
   790  		return nil, err
   791  	}
   792  	defer googleapi.CloseBody(res)
   793  	if err := googleapi.CheckResponse(res); err != nil {
   794  		return nil, gensupport.WrapError(err)
   795  	}
   796  	ret := &DeleteEventsResponse{
   797  		ServerResponse: googleapi.ServerResponse{
   798  			Header:         res.Header,
   799  			HTTPStatusCode: res.StatusCode,
   800  		},
   801  	}
   802  	target := &ret
   803  	if err := gensupport.DecodeResponse(target, res); err != nil {
   804  		return nil, err
   805  	}
   806  	return ret, nil
   807  }
   808  
   809  type ProjectsEventsListCall struct {
   810  	s            *Service
   811  	projectName  string
   812  	urlParams_   gensupport.URLParams
   813  	ifNoneMatch_ string
   814  	ctx_         context.Context
   815  	header_      http.Header
   816  }
   817  
   818  // List: Lists the specified events.
   819  //
   820  //   - projectName: The resource name of the Google Cloud Platform project.
   821  //     Written as `projects/{projectID}`, where `{projectID}` is the Google Cloud
   822  //     Platform project ID (https://support.google.com/cloud/answer/6158840).
   823  //     Example: `projects/my-project-123`.
   824  func (r *ProjectsEventsService) List(projectName string) *ProjectsEventsListCall {
   825  	c := &ProjectsEventsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   826  	c.projectName = projectName
   827  	return c
   828  }
   829  
   830  // GroupId sets the optional parameter "groupId": Required. The group for which
   831  // events shall be returned. The `group_id` is a unique identifier for a
   832  // particular error group. The identifier is derived from key parts of the
   833  // error-log content and is treated as Service Data. For information about how
   834  // Service Data is handled, see Google Cloud Privacy Notice
   835  // (https://cloud.google.com/terms/cloud-privacy-notice).
   836  func (c *ProjectsEventsListCall) GroupId(groupId string) *ProjectsEventsListCall {
   837  	c.urlParams_.Set("groupId", groupId)
   838  	return c
   839  }
   840  
   841  // PageSize sets the optional parameter "pageSize": The maximum number of
   842  // results to return per response.
   843  func (c *ProjectsEventsListCall) PageSize(pageSize int64) *ProjectsEventsListCall {
   844  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   845  	return c
   846  }
   847  
   848  // PageToken sets the optional parameter "pageToken": A `next_page_token`
   849  // provided by a previous response.
   850  func (c *ProjectsEventsListCall) PageToken(pageToken string) *ProjectsEventsListCall {
   851  	c.urlParams_.Set("pageToken", pageToken)
   852  	return c
   853  }
   854  
   855  // ServiceFilterResourceType sets the optional parameter
   856  // "serviceFilter.resourceType": The exact value to match against
   857  // `ServiceContext.resource_type`
   858  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type)
   859  // .
   860  func (c *ProjectsEventsListCall) ServiceFilterResourceType(serviceFilterResourceType string) *ProjectsEventsListCall {
   861  	c.urlParams_.Set("serviceFilter.resourceType", serviceFilterResourceType)
   862  	return c
   863  }
   864  
   865  // ServiceFilterService sets the optional parameter "serviceFilter.service":
   866  // The exact value to match against `ServiceContext.service`
   867  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
   868  func (c *ProjectsEventsListCall) ServiceFilterService(serviceFilterService string) *ProjectsEventsListCall {
   869  	c.urlParams_.Set("serviceFilter.service", serviceFilterService)
   870  	return c
   871  }
   872  
   873  // ServiceFilterVersion sets the optional parameter "serviceFilter.version":
   874  // The exact value to match against `ServiceContext.version`
   875  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
   876  func (c *ProjectsEventsListCall) ServiceFilterVersion(serviceFilterVersion string) *ProjectsEventsListCall {
   877  	c.urlParams_.Set("serviceFilter.version", serviceFilterVersion)
   878  	return c
   879  }
   880  
   881  // TimeRangePeriod sets the optional parameter "timeRange.period": Restricts
   882  // the query to the specified time range.
   883  //
   884  // Possible values:
   885  //
   886  //	"PERIOD_UNSPECIFIED" - Do not use.
   887  //	"PERIOD_1_HOUR" - Retrieve data for the last hour. Recommended minimum
   888  //
   889  // timed count duration: 1 min.
   890  //
   891  //	"PERIOD_6_HOURS" - Retrieve data for the last 6 hours. Recommended minimum
   892  //
   893  // timed count duration: 10 min.
   894  //
   895  //	"PERIOD_1_DAY" - Retrieve data for the last day. Recommended minimum timed
   896  //
   897  // count duration: 1 hour.
   898  //
   899  //	"PERIOD_1_WEEK" - Retrieve data for the last week. Recommended minimum
   900  //
   901  // timed count duration: 6 hours.
   902  //
   903  //	"PERIOD_30_DAYS" - Retrieve data for the last 30 days. Recommended minimum
   904  //
   905  // timed count duration: 1 day.
   906  func (c *ProjectsEventsListCall) TimeRangePeriod(timeRangePeriod string) *ProjectsEventsListCall {
   907  	c.urlParams_.Set("timeRange.period", timeRangePeriod)
   908  	return c
   909  }
   910  
   911  // Fields allows partial responses to be retrieved. See
   912  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   913  // details.
   914  func (c *ProjectsEventsListCall) Fields(s ...googleapi.Field) *ProjectsEventsListCall {
   915  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   916  	return c
   917  }
   918  
   919  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   920  // object's ETag matches the given value. This is useful for getting updates
   921  // only after the object has changed since the last request.
   922  func (c *ProjectsEventsListCall) IfNoneMatch(entityTag string) *ProjectsEventsListCall {
   923  	c.ifNoneMatch_ = entityTag
   924  	return c
   925  }
   926  
   927  // Context sets the context to be used in this call's Do method.
   928  func (c *ProjectsEventsListCall) Context(ctx context.Context) *ProjectsEventsListCall {
   929  	c.ctx_ = ctx
   930  	return c
   931  }
   932  
   933  // Header returns a http.Header that can be modified by the caller to add
   934  // headers to the request.
   935  func (c *ProjectsEventsListCall) Header() http.Header {
   936  	if c.header_ == nil {
   937  		c.header_ = make(http.Header)
   938  	}
   939  	return c.header_
   940  }
   941  
   942  func (c *ProjectsEventsListCall) doRequest(alt string) (*http.Response, error) {
   943  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   944  	if c.ifNoneMatch_ != "" {
   945  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   946  	}
   947  	var body io.Reader = nil
   948  	c.urlParams_.Set("alt", alt)
   949  	c.urlParams_.Set("prettyPrint", "false")
   950  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events")
   951  	urls += "?" + c.urlParams_.Encode()
   952  	req, err := http.NewRequest("GET", urls, body)
   953  	if err != nil {
   954  		return nil, err
   955  	}
   956  	req.Header = reqHeaders
   957  	googleapi.Expand(req.URL, map[string]string{
   958  		"projectName": c.projectName,
   959  	})
   960  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   961  }
   962  
   963  // Do executes the "clouderrorreporting.projects.events.list" call.
   964  // Any non-2xx status code is an error. Response headers are in either
   965  // *ListEventsResponse.ServerResponse.Header or (if a response was returned at
   966  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   967  // check whether the returned error was because http.StatusNotModified was
   968  // returned.
   969  func (c *ProjectsEventsListCall) Do(opts ...googleapi.CallOption) (*ListEventsResponse, error) {
   970  	gensupport.SetOptions(c.urlParams_, opts...)
   971  	res, err := c.doRequest("json")
   972  	if res != nil && res.StatusCode == http.StatusNotModified {
   973  		if res.Body != nil {
   974  			res.Body.Close()
   975  		}
   976  		return nil, gensupport.WrapError(&googleapi.Error{
   977  			Code:   res.StatusCode,
   978  			Header: res.Header,
   979  		})
   980  	}
   981  	if err != nil {
   982  		return nil, err
   983  	}
   984  	defer googleapi.CloseBody(res)
   985  	if err := googleapi.CheckResponse(res); err != nil {
   986  		return nil, gensupport.WrapError(err)
   987  	}
   988  	ret := &ListEventsResponse{
   989  		ServerResponse: googleapi.ServerResponse{
   990  			Header:         res.Header,
   991  			HTTPStatusCode: res.StatusCode,
   992  		},
   993  	}
   994  	target := &ret
   995  	if err := gensupport.DecodeResponse(target, res); err != nil {
   996  		return nil, err
   997  	}
   998  	return ret, nil
   999  }
  1000  
  1001  // Pages invokes f for each page of results.
  1002  // A non-nil error returned from f will halt the iteration.
  1003  // The provided context supersedes any context provided to the Context method.
  1004  func (c *ProjectsEventsListCall) Pages(ctx context.Context, f func(*ListEventsResponse) error) error {
  1005  	c.ctx_ = ctx
  1006  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1007  	for {
  1008  		x, err := c.Do()
  1009  		if err != nil {
  1010  			return err
  1011  		}
  1012  		if err := f(x); err != nil {
  1013  			return err
  1014  		}
  1015  		if x.NextPageToken == "" {
  1016  			return nil
  1017  		}
  1018  		c.PageToken(x.NextPageToken)
  1019  	}
  1020  }
  1021  
  1022  type ProjectsEventsReportCall struct {
  1023  	s                  *Service
  1024  	projectName        string
  1025  	reportederrorevent *ReportedErrorEvent
  1026  	urlParams_         gensupport.URLParams
  1027  	ctx_               context.Context
  1028  	header_            http.Header
  1029  }
  1030  
  1031  // Report: Report an individual error event and record the event to a log. This
  1032  // endpoint accepts **either** an OAuth token, **or** an API key
  1033  // (https://support.google.com/cloud/answer/6158862) for authentication. To use
  1034  // an API key, append it to the URL as the value of a `key` parameter. For
  1035  // example: `POST
  1036  // https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456`
  1037  // **Note:** [Error Reporting] (https://cloud.google.com/error-reporting) is a
  1038  // global service built on Cloud Logging and can analyze log entries when all
  1039  // of the following are true: * The log entries are stored in a log bucket in
  1040  // the `global` location. * Customer-managed encryption keys (CMEK) are
  1041  // disabled on the log bucket. * The log bucket satisfies one of the following:
  1042  // * The log bucket is stored in the same project where the logs originated. *
  1043  // The logs were routed to a project, and then that project stored those logs
  1044  // in a log bucket that it owns.
  1045  //
  1046  //   - projectName: The resource name of the Google Cloud Platform project.
  1047  //     Written as `projects/{projectId}`, where `{projectId}` is the Google Cloud
  1048  //     Platform project ID (https://support.google.com/cloud/answer/6158840).
  1049  //     Example: // `projects/my-project-123`.
  1050  func (r *ProjectsEventsService) Report(projectName string, reportederrorevent *ReportedErrorEvent) *ProjectsEventsReportCall {
  1051  	c := &ProjectsEventsReportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1052  	c.projectName = projectName
  1053  	c.reportederrorevent = reportederrorevent
  1054  	return c
  1055  }
  1056  
  1057  // Fields allows partial responses to be retrieved. See
  1058  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1059  // details.
  1060  func (c *ProjectsEventsReportCall) Fields(s ...googleapi.Field) *ProjectsEventsReportCall {
  1061  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1062  	return c
  1063  }
  1064  
  1065  // Context sets the context to be used in this call's Do method.
  1066  func (c *ProjectsEventsReportCall) Context(ctx context.Context) *ProjectsEventsReportCall {
  1067  	c.ctx_ = ctx
  1068  	return c
  1069  }
  1070  
  1071  // Header returns a http.Header that can be modified by the caller to add
  1072  // headers to the request.
  1073  func (c *ProjectsEventsReportCall) Header() http.Header {
  1074  	if c.header_ == nil {
  1075  		c.header_ = make(http.Header)
  1076  	}
  1077  	return c.header_
  1078  }
  1079  
  1080  func (c *ProjectsEventsReportCall) doRequest(alt string) (*http.Response, error) {
  1081  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1082  	var body io.Reader = nil
  1083  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.reportederrorevent)
  1084  	if err != nil {
  1085  		return nil, err
  1086  	}
  1087  	c.urlParams_.Set("alt", alt)
  1088  	c.urlParams_.Set("prettyPrint", "false")
  1089  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events:report")
  1090  	urls += "?" + c.urlParams_.Encode()
  1091  	req, err := http.NewRequest("POST", urls, body)
  1092  	if err != nil {
  1093  		return nil, err
  1094  	}
  1095  	req.Header = reqHeaders
  1096  	googleapi.Expand(req.URL, map[string]string{
  1097  		"projectName": c.projectName,
  1098  	})
  1099  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1100  }
  1101  
  1102  // Do executes the "clouderrorreporting.projects.events.report" call.
  1103  // Any non-2xx status code is an error. Response headers are in either
  1104  // *ReportErrorEventResponse.ServerResponse.Header or (if a response was
  1105  // returned at all) in error.(*googleapi.Error).Header. Use
  1106  // googleapi.IsNotModified to check whether the returned error was because
  1107  // http.StatusNotModified was returned.
  1108  func (c *ProjectsEventsReportCall) Do(opts ...googleapi.CallOption) (*ReportErrorEventResponse, error) {
  1109  	gensupport.SetOptions(c.urlParams_, opts...)
  1110  	res, err := c.doRequest("json")
  1111  	if res != nil && res.StatusCode == http.StatusNotModified {
  1112  		if res.Body != nil {
  1113  			res.Body.Close()
  1114  		}
  1115  		return nil, gensupport.WrapError(&googleapi.Error{
  1116  			Code:   res.StatusCode,
  1117  			Header: res.Header,
  1118  		})
  1119  	}
  1120  	if err != nil {
  1121  		return nil, err
  1122  	}
  1123  	defer googleapi.CloseBody(res)
  1124  	if err := googleapi.CheckResponse(res); err != nil {
  1125  		return nil, gensupport.WrapError(err)
  1126  	}
  1127  	ret := &ReportErrorEventResponse{
  1128  		ServerResponse: googleapi.ServerResponse{
  1129  			Header:         res.Header,
  1130  			HTTPStatusCode: res.StatusCode,
  1131  		},
  1132  	}
  1133  	target := &ret
  1134  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1135  		return nil, err
  1136  	}
  1137  	return ret, nil
  1138  }
  1139  
  1140  type ProjectsGroupStatsListCall struct {
  1141  	s            *Service
  1142  	projectName  string
  1143  	urlParams_   gensupport.URLParams
  1144  	ifNoneMatch_ string
  1145  	ctx_         context.Context
  1146  	header_      http.Header
  1147  }
  1148  
  1149  // List: Lists the specified groups.
  1150  //
  1151  //   - projectName: The resource name of the Google Cloud Platform project.
  1152  //     Written as `projects/{projectID}` or `projects/{projectNumber}`, where
  1153  //     `{projectID}` and `{projectNumber}` can be found in the Google Cloud
  1154  //     console (https://support.google.com/cloud/answer/6158840). Examples:
  1155  //     `projects/my-project-123`, `projects/5551234`.
  1156  func (r *ProjectsGroupStatsService) List(projectName string) *ProjectsGroupStatsListCall {
  1157  	c := &ProjectsGroupStatsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1158  	c.projectName = projectName
  1159  	return c
  1160  }
  1161  
  1162  // Alignment sets the optional parameter "alignment": The alignment of the
  1163  // timed counts to be returned. Default is `ALIGNMENT_EQUAL_AT_END`.
  1164  //
  1165  // Possible values:
  1166  //
  1167  //	"ERROR_COUNT_ALIGNMENT_UNSPECIFIED" - No alignment specified.
  1168  //	"ALIGNMENT_EQUAL_ROUNDED" - The time periods shall be consecutive, have
  1169  //
  1170  // width equal to the requested duration, and be aligned at the alignment_time
  1171  // provided in the request. The alignment_time does not have to be inside the
  1172  // query period but even if it is outside, only time periods are returned which
  1173  // overlap with the query period. A rounded alignment will typically result in
  1174  // a different size of the first or the last time period.
  1175  //
  1176  //	"ALIGNMENT_EQUAL_AT_END" - The time periods shall be consecutive, have
  1177  //
  1178  // width equal to the requested duration, and be aligned at the end of the
  1179  // requested time period. This can result in a different size of the first time
  1180  // period.
  1181  func (c *ProjectsGroupStatsListCall) Alignment(alignment string) *ProjectsGroupStatsListCall {
  1182  	c.urlParams_.Set("alignment", alignment)
  1183  	return c
  1184  }
  1185  
  1186  // AlignmentTime sets the optional parameter "alignmentTime": Time where the
  1187  // timed counts shall be aligned if rounded alignment is chosen. Default is
  1188  // 00:00 UTC.
  1189  func (c *ProjectsGroupStatsListCall) AlignmentTime(alignmentTime string) *ProjectsGroupStatsListCall {
  1190  	c.urlParams_.Set("alignmentTime", alignmentTime)
  1191  	return c
  1192  }
  1193  
  1194  // GroupId sets the optional parameter "groupId": List all ErrorGroupStats with
  1195  // these IDs. The `group_id` is a unique identifier for a particular error
  1196  // group. The identifier is derived from key parts of the error-log content and
  1197  // is treated as Service Data. For information about how Service Data is
  1198  // handled, see [Google Cloud Privacy Notice]
  1199  // (https://cloud.google.com/terms/cloud-privacy-notice).
  1200  func (c *ProjectsGroupStatsListCall) GroupId(groupId ...string) *ProjectsGroupStatsListCall {
  1201  	c.urlParams_.SetMulti("groupId", append([]string{}, groupId...))
  1202  	return c
  1203  }
  1204  
  1205  // Order sets the optional parameter "order": The sort order in which the
  1206  // results are returned. Default is `COUNT_DESC`.
  1207  //
  1208  // Possible values:
  1209  //
  1210  //	"GROUP_ORDER_UNSPECIFIED" - No group order specified.
  1211  //	"COUNT_DESC" - Total count of errors in the given time window in
  1212  //
  1213  // descending order.
  1214  //
  1215  //	"LAST_SEEN_DESC" - Timestamp when the group was last seen in the given
  1216  //
  1217  // time window in descending order.
  1218  //
  1219  //	"CREATED_DESC" - Timestamp when the group was created in descending order.
  1220  //	"AFFECTED_USERS_DESC" - Number of affected users in the given time window
  1221  //
  1222  // in descending order.
  1223  func (c *ProjectsGroupStatsListCall) Order(order string) *ProjectsGroupStatsListCall {
  1224  	c.urlParams_.Set("order", order)
  1225  	return c
  1226  }
  1227  
  1228  // PageSize sets the optional parameter "pageSize": The maximum number of
  1229  // results to return per response. Default is 20.
  1230  func (c *ProjectsGroupStatsListCall) PageSize(pageSize int64) *ProjectsGroupStatsListCall {
  1231  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1232  	return c
  1233  }
  1234  
  1235  // PageToken sets the optional parameter "pageToken": A next_page_token
  1236  // provided by a previous response. To view additional results, pass this token
  1237  // along with the identical query parameters as the first request.
  1238  func (c *ProjectsGroupStatsListCall) PageToken(pageToken string) *ProjectsGroupStatsListCall {
  1239  	c.urlParams_.Set("pageToken", pageToken)
  1240  	return c
  1241  }
  1242  
  1243  // ServiceFilterResourceType sets the optional parameter
  1244  // "serviceFilter.resourceType": The exact value to match against
  1245  // `ServiceContext.resource_type`
  1246  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type)
  1247  // .
  1248  func (c *ProjectsGroupStatsListCall) ServiceFilterResourceType(serviceFilterResourceType string) *ProjectsGroupStatsListCall {
  1249  	c.urlParams_.Set("serviceFilter.resourceType", serviceFilterResourceType)
  1250  	return c
  1251  }
  1252  
  1253  // ServiceFilterService sets the optional parameter "serviceFilter.service":
  1254  // The exact value to match against `ServiceContext.service`
  1255  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
  1256  func (c *ProjectsGroupStatsListCall) ServiceFilterService(serviceFilterService string) *ProjectsGroupStatsListCall {
  1257  	c.urlParams_.Set("serviceFilter.service", serviceFilterService)
  1258  	return c
  1259  }
  1260  
  1261  // ServiceFilterVersion sets the optional parameter "serviceFilter.version":
  1262  // The exact value to match against `ServiceContext.version`
  1263  // (/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
  1264  func (c *ProjectsGroupStatsListCall) ServiceFilterVersion(serviceFilterVersion string) *ProjectsGroupStatsListCall {
  1265  	c.urlParams_.Set("serviceFilter.version", serviceFilterVersion)
  1266  	return c
  1267  }
  1268  
  1269  // TimeRangePeriod sets the optional parameter "timeRange.period": Restricts
  1270  // the query to the specified time range.
  1271  //
  1272  // Possible values:
  1273  //
  1274  //	"PERIOD_UNSPECIFIED" - Do not use.
  1275  //	"PERIOD_1_HOUR" - Retrieve data for the last hour. Recommended minimum
  1276  //
  1277  // timed count duration: 1 min.
  1278  //
  1279  //	"PERIOD_6_HOURS" - Retrieve data for the last 6 hours. Recommended minimum
  1280  //
  1281  // timed count duration: 10 min.
  1282  //
  1283  //	"PERIOD_1_DAY" - Retrieve data for the last day. Recommended minimum timed
  1284  //
  1285  // count duration: 1 hour.
  1286  //
  1287  //	"PERIOD_1_WEEK" - Retrieve data for the last week. Recommended minimum
  1288  //
  1289  // timed count duration: 6 hours.
  1290  //
  1291  //	"PERIOD_30_DAYS" - Retrieve data for the last 30 days. Recommended minimum
  1292  //
  1293  // timed count duration: 1 day.
  1294  func (c *ProjectsGroupStatsListCall) TimeRangePeriod(timeRangePeriod string) *ProjectsGroupStatsListCall {
  1295  	c.urlParams_.Set("timeRange.period", timeRangePeriod)
  1296  	return c
  1297  }
  1298  
  1299  // TimedCountDuration sets the optional parameter "timedCountDuration": The
  1300  // preferred duration for a single returned TimedCount. If not set, no timed
  1301  // counts are returned.
  1302  func (c *ProjectsGroupStatsListCall) TimedCountDuration(timedCountDuration string) *ProjectsGroupStatsListCall {
  1303  	c.urlParams_.Set("timedCountDuration", timedCountDuration)
  1304  	return c
  1305  }
  1306  
  1307  // Fields allows partial responses to be retrieved. See
  1308  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1309  // details.
  1310  func (c *ProjectsGroupStatsListCall) Fields(s ...googleapi.Field) *ProjectsGroupStatsListCall {
  1311  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1312  	return c
  1313  }
  1314  
  1315  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1316  // object's ETag matches the given value. This is useful for getting updates
  1317  // only after the object has changed since the last request.
  1318  func (c *ProjectsGroupStatsListCall) IfNoneMatch(entityTag string) *ProjectsGroupStatsListCall {
  1319  	c.ifNoneMatch_ = entityTag
  1320  	return c
  1321  }
  1322  
  1323  // Context sets the context to be used in this call's Do method.
  1324  func (c *ProjectsGroupStatsListCall) Context(ctx context.Context) *ProjectsGroupStatsListCall {
  1325  	c.ctx_ = ctx
  1326  	return c
  1327  }
  1328  
  1329  // Header returns a http.Header that can be modified by the caller to add
  1330  // headers to the request.
  1331  func (c *ProjectsGroupStatsListCall) Header() http.Header {
  1332  	if c.header_ == nil {
  1333  		c.header_ = make(http.Header)
  1334  	}
  1335  	return c.header_
  1336  }
  1337  
  1338  func (c *ProjectsGroupStatsListCall) doRequest(alt string) (*http.Response, error) {
  1339  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1340  	if c.ifNoneMatch_ != "" {
  1341  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1342  	}
  1343  	var body io.Reader = nil
  1344  	c.urlParams_.Set("alt", alt)
  1345  	c.urlParams_.Set("prettyPrint", "false")
  1346  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/groupStats")
  1347  	urls += "?" + c.urlParams_.Encode()
  1348  	req, err := http.NewRequest("GET", urls, body)
  1349  	if err != nil {
  1350  		return nil, err
  1351  	}
  1352  	req.Header = reqHeaders
  1353  	googleapi.Expand(req.URL, map[string]string{
  1354  		"projectName": c.projectName,
  1355  	})
  1356  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1357  }
  1358  
  1359  // Do executes the "clouderrorreporting.projects.groupStats.list" call.
  1360  // Any non-2xx status code is an error. Response headers are in either
  1361  // *ListGroupStatsResponse.ServerResponse.Header or (if a response was returned
  1362  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1363  // check whether the returned error was because http.StatusNotModified was
  1364  // returned.
  1365  func (c *ProjectsGroupStatsListCall) Do(opts ...googleapi.CallOption) (*ListGroupStatsResponse, error) {
  1366  	gensupport.SetOptions(c.urlParams_, opts...)
  1367  	res, err := c.doRequest("json")
  1368  	if res != nil && res.StatusCode == http.StatusNotModified {
  1369  		if res.Body != nil {
  1370  			res.Body.Close()
  1371  		}
  1372  		return nil, gensupport.WrapError(&googleapi.Error{
  1373  			Code:   res.StatusCode,
  1374  			Header: res.Header,
  1375  		})
  1376  	}
  1377  	if err != nil {
  1378  		return nil, err
  1379  	}
  1380  	defer googleapi.CloseBody(res)
  1381  	if err := googleapi.CheckResponse(res); err != nil {
  1382  		return nil, gensupport.WrapError(err)
  1383  	}
  1384  	ret := &ListGroupStatsResponse{
  1385  		ServerResponse: googleapi.ServerResponse{
  1386  			Header:         res.Header,
  1387  			HTTPStatusCode: res.StatusCode,
  1388  		},
  1389  	}
  1390  	target := &ret
  1391  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1392  		return nil, err
  1393  	}
  1394  	return ret, nil
  1395  }
  1396  
  1397  // Pages invokes f for each page of results.
  1398  // A non-nil error returned from f will halt the iteration.
  1399  // The provided context supersedes any context provided to the Context method.
  1400  func (c *ProjectsGroupStatsListCall) Pages(ctx context.Context, f func(*ListGroupStatsResponse) error) error {
  1401  	c.ctx_ = ctx
  1402  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1403  	for {
  1404  		x, err := c.Do()
  1405  		if err != nil {
  1406  			return err
  1407  		}
  1408  		if err := f(x); err != nil {
  1409  			return err
  1410  		}
  1411  		if x.NextPageToken == "" {
  1412  			return nil
  1413  		}
  1414  		c.PageToken(x.NextPageToken)
  1415  	}
  1416  }
  1417  
  1418  type ProjectsGroupsGetCall struct {
  1419  	s            *Service
  1420  	groupNameid  string
  1421  	urlParams_   gensupport.URLParams
  1422  	ifNoneMatch_ string
  1423  	ctx_         context.Context
  1424  	header_      http.Header
  1425  }
  1426  
  1427  // Get: Get the specified group.
  1428  //
  1429  //   - groupName: The group resource name. Written as
  1430  //     `projects/{projectID}/groups/{group_id}`. Call groupStats.list to return a
  1431  //     list of groups belonging to this project. Example:
  1432  //     `projects/my-project-123/groups/my-group` In the group resource name, the
  1433  //     `group_id` is a unique identifier for a particular error group. The
  1434  //     identifier is derived from key parts of the error-log content and is
  1435  //     treated as Service Data. For information about how Service Data is
  1436  //     handled, see Google Cloud Privacy Notice
  1437  //     (https://cloud.google.com/terms/cloud-privacy-notice).
  1438  func (r *ProjectsGroupsService) Get(groupNameid string) *ProjectsGroupsGetCall {
  1439  	c := &ProjectsGroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1440  	c.groupNameid = groupNameid
  1441  	return c
  1442  }
  1443  
  1444  // Fields allows partial responses to be retrieved. See
  1445  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1446  // details.
  1447  func (c *ProjectsGroupsGetCall) Fields(s ...googleapi.Field) *ProjectsGroupsGetCall {
  1448  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1449  	return c
  1450  }
  1451  
  1452  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1453  // object's ETag matches the given value. This is useful for getting updates
  1454  // only after the object has changed since the last request.
  1455  func (c *ProjectsGroupsGetCall) IfNoneMatch(entityTag string) *ProjectsGroupsGetCall {
  1456  	c.ifNoneMatch_ = entityTag
  1457  	return c
  1458  }
  1459  
  1460  // Context sets the context to be used in this call's Do method.
  1461  func (c *ProjectsGroupsGetCall) Context(ctx context.Context) *ProjectsGroupsGetCall {
  1462  	c.ctx_ = ctx
  1463  	return c
  1464  }
  1465  
  1466  // Header returns a http.Header that can be modified by the caller to add
  1467  // headers to the request.
  1468  func (c *ProjectsGroupsGetCall) Header() http.Header {
  1469  	if c.header_ == nil {
  1470  		c.header_ = make(http.Header)
  1471  	}
  1472  	return c.header_
  1473  }
  1474  
  1475  func (c *ProjectsGroupsGetCall) doRequest(alt string) (*http.Response, error) {
  1476  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1477  	if c.ifNoneMatch_ != "" {
  1478  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1479  	}
  1480  	var body io.Reader = nil
  1481  	c.urlParams_.Set("alt", alt)
  1482  	c.urlParams_.Set("prettyPrint", "false")
  1483  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+groupName}")
  1484  	urls += "?" + c.urlParams_.Encode()
  1485  	req, err := http.NewRequest("GET", urls, body)
  1486  	if err != nil {
  1487  		return nil, err
  1488  	}
  1489  	req.Header = reqHeaders
  1490  	googleapi.Expand(req.URL, map[string]string{
  1491  		"groupName": c.groupNameid,
  1492  	})
  1493  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1494  }
  1495  
  1496  // Do executes the "clouderrorreporting.projects.groups.get" call.
  1497  // Any non-2xx status code is an error. Response headers are in either
  1498  // *ErrorGroup.ServerResponse.Header or (if a response was returned at all) in
  1499  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1500  // whether the returned error was because http.StatusNotModified was returned.
  1501  func (c *ProjectsGroupsGetCall) Do(opts ...googleapi.CallOption) (*ErrorGroup, error) {
  1502  	gensupport.SetOptions(c.urlParams_, opts...)
  1503  	res, err := c.doRequest("json")
  1504  	if res != nil && res.StatusCode == http.StatusNotModified {
  1505  		if res.Body != nil {
  1506  			res.Body.Close()
  1507  		}
  1508  		return nil, gensupport.WrapError(&googleapi.Error{
  1509  			Code:   res.StatusCode,
  1510  			Header: res.Header,
  1511  		})
  1512  	}
  1513  	if err != nil {
  1514  		return nil, err
  1515  	}
  1516  	defer googleapi.CloseBody(res)
  1517  	if err := googleapi.CheckResponse(res); err != nil {
  1518  		return nil, gensupport.WrapError(err)
  1519  	}
  1520  	ret := &ErrorGroup{
  1521  		ServerResponse: googleapi.ServerResponse{
  1522  			Header:         res.Header,
  1523  			HTTPStatusCode: res.StatusCode,
  1524  		},
  1525  	}
  1526  	target := &ret
  1527  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1528  		return nil, err
  1529  	}
  1530  	return ret, nil
  1531  }
  1532  
  1533  type ProjectsGroupsUpdateCall struct {
  1534  	s          *Service
  1535  	nameid     string
  1536  	errorgroup *ErrorGroup
  1537  	urlParams_ gensupport.URLParams
  1538  	ctx_       context.Context
  1539  	header_    http.Header
  1540  }
  1541  
  1542  // Update: Replace the data for the specified group. Fails if the group does
  1543  // not exist.
  1544  //
  1545  //   - name: The group resource name. Written as
  1546  //     `projects/{projectID}/groups/{group_id}`. Example:
  1547  //     `projects/my-project-123/groups/my-group` In the group resource name, the
  1548  //     `group_id` is a unique identifier for a particular error group. The
  1549  //     identifier is derived from key parts of the error-log content and is
  1550  //     treated as Service Data. For information about how Service Data is
  1551  //     handled, see Google Cloud Privacy Notice
  1552  //     (https://cloud.google.com/terms/cloud-privacy-notice).
  1553  func (r *ProjectsGroupsService) Update(nameid string, errorgroup *ErrorGroup) *ProjectsGroupsUpdateCall {
  1554  	c := &ProjectsGroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1555  	c.nameid = nameid
  1556  	c.errorgroup = errorgroup
  1557  	return c
  1558  }
  1559  
  1560  // Fields allows partial responses to be retrieved. See
  1561  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1562  // details.
  1563  func (c *ProjectsGroupsUpdateCall) Fields(s ...googleapi.Field) *ProjectsGroupsUpdateCall {
  1564  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1565  	return c
  1566  }
  1567  
  1568  // Context sets the context to be used in this call's Do method.
  1569  func (c *ProjectsGroupsUpdateCall) Context(ctx context.Context) *ProjectsGroupsUpdateCall {
  1570  	c.ctx_ = ctx
  1571  	return c
  1572  }
  1573  
  1574  // Header returns a http.Header that can be modified by the caller to add
  1575  // headers to the request.
  1576  func (c *ProjectsGroupsUpdateCall) Header() http.Header {
  1577  	if c.header_ == nil {
  1578  		c.header_ = make(http.Header)
  1579  	}
  1580  	return c.header_
  1581  }
  1582  
  1583  func (c *ProjectsGroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1584  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1585  	var body io.Reader = nil
  1586  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.errorgroup)
  1587  	if err != nil {
  1588  		return nil, err
  1589  	}
  1590  	c.urlParams_.Set("alt", alt)
  1591  	c.urlParams_.Set("prettyPrint", "false")
  1592  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1593  	urls += "?" + c.urlParams_.Encode()
  1594  	req, err := http.NewRequest("PUT", urls, body)
  1595  	if err != nil {
  1596  		return nil, err
  1597  	}
  1598  	req.Header = reqHeaders
  1599  	googleapi.Expand(req.URL, map[string]string{
  1600  		"name": c.nameid,
  1601  	})
  1602  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1603  }
  1604  
  1605  // Do executes the "clouderrorreporting.projects.groups.update" call.
  1606  // Any non-2xx status code is an error. Response headers are in either
  1607  // *ErrorGroup.ServerResponse.Header or (if a response was returned at all) in
  1608  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1609  // whether the returned error was because http.StatusNotModified was returned.
  1610  func (c *ProjectsGroupsUpdateCall) Do(opts ...googleapi.CallOption) (*ErrorGroup, error) {
  1611  	gensupport.SetOptions(c.urlParams_, opts...)
  1612  	res, err := c.doRequest("json")
  1613  	if res != nil && res.StatusCode == http.StatusNotModified {
  1614  		if res.Body != nil {
  1615  			res.Body.Close()
  1616  		}
  1617  		return nil, gensupport.WrapError(&googleapi.Error{
  1618  			Code:   res.StatusCode,
  1619  			Header: res.Header,
  1620  		})
  1621  	}
  1622  	if err != nil {
  1623  		return nil, err
  1624  	}
  1625  	defer googleapi.CloseBody(res)
  1626  	if err := googleapi.CheckResponse(res); err != nil {
  1627  		return nil, gensupport.WrapError(err)
  1628  	}
  1629  	ret := &ErrorGroup{
  1630  		ServerResponse: googleapi.ServerResponse{
  1631  			Header:         res.Header,
  1632  			HTTPStatusCode: res.StatusCode,
  1633  		},
  1634  	}
  1635  	target := &ret
  1636  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1637  		return nil, err
  1638  	}
  1639  	return ret, nil
  1640  }
  1641  

View as plain text