1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package runtimeconfig provides access to the Cloud Runtime Configuration API.
8//
9// For product documentation, see: https://cloud.google.com/deployment-manager/runtime-configurator/
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/runtimeconfig/v1"
16//   ...
17//   ctx := context.Background()
18//   runtimeconfigService, err := runtimeconfig.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithScopes(runtimeconfig.CloudruntimeconfigScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package runtimeconfig // import "google.golang.org/api/runtimeconfig/v1"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	googleapi "google.golang.org/api/googleapi"
57	gensupport "google.golang.org/api/internal/gensupport"
58	option "google.golang.org/api/option"
59	htransport "google.golang.org/api/transport/http"
60)
61
62// Always reference these packages, just in case the auto-generated code
63// below doesn't.
64var _ = bytes.NewBuffer
65var _ = strconv.Itoa
66var _ = fmt.Sprintf
67var _ = json.NewDecoder
68var _ = io.Copy
69var _ = url.Parse
70var _ = gensupport.MarshalJSON
71var _ = googleapi.Version
72var _ = errors.New
73var _ = strings.Replace
74var _ = context.Canceled
75
76const apiId = "runtimeconfig:v1"
77const apiName = "runtimeconfig"
78const apiVersion = "v1"
79const basePath = "https://runtimeconfig.googleapis.com/"
80
81// OAuth2 scopes used by this API.
82const (
83	// View and manage your data across Google Cloud Platform services
84	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
85
86	// Manage your Google Cloud Platform services' runtime configuration
87	CloudruntimeconfigScope = "https://www.googleapis.com/auth/cloudruntimeconfig"
88)
89
90// NewService creates a new Service.
91func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
92	scopesOption := option.WithScopes(
93		"https://www.googleapis.com/auth/cloud-platform",
94		"https://www.googleapis.com/auth/cloudruntimeconfig",
95	)
96	// NOTE: prepend, so we don't override user-specified scopes.
97	opts = append([]option.ClientOption{scopesOption}, opts...)
98	client, endpoint, err := htransport.NewClient(ctx, opts...)
99	if err != nil {
100		return nil, err
101	}
102	s, err := New(client)
103	if err != nil {
104		return nil, err
105	}
106	if endpoint != "" {
107		s.BasePath = endpoint
108	}
109	return s, nil
110}
111
112// New creates a new Service. It uses the provided http.Client for requests.
113//
114// Deprecated: please use NewService instead.
115// To provide a custom HTTP client, use option.WithHTTPClient.
116// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
117func New(client *http.Client) (*Service, error) {
118	if client == nil {
119		return nil, errors.New("client is nil")
120	}
121	s := &Service{client: client, BasePath: basePath}
122	s.Operations = NewOperationsService(s)
123	return s, nil
124}
125
126type Service struct {
127	client    *http.Client
128	BasePath  string // API endpoint base URL
129	UserAgent string // optional additional User-Agent fragment
130
131	Operations *OperationsService
132}
133
134func (s *Service) userAgent() string {
135	if s.UserAgent == "" {
136		return googleapi.UserAgent
137	}
138	return googleapi.UserAgent + " " + s.UserAgent
139}
140
141func NewOperationsService(s *Service) *OperationsService {
142	rs := &OperationsService{s: s}
143	return rs
144}
145
146type OperationsService struct {
147	s *Service
148}
149
150// CancelOperationRequest: The request message for
151// Operations.CancelOperation.
152type CancelOperationRequest struct {
153}
154
155// Empty: A generic empty message that you can re-use to avoid defining
156// duplicated
157// empty messages in your APIs. A typical example is to use it as the
158// request
159// or the response type of an API method. For instance:
160//
161//     service Foo {
162//       rpc Bar(google.protobuf.Empty) returns
163// (google.protobuf.Empty);
164//     }
165//
166// The JSON representation for `Empty` is empty JSON object `{}`.
167type Empty struct {
168	// ServerResponse contains the HTTP response code and headers from the
169	// server.
170	googleapi.ServerResponse `json:"-"`
171}
172
173// ListOperationsResponse: The response message for
174// Operations.ListOperations.
175type ListOperationsResponse struct {
176	// NextPageToken: The standard List next-page token.
177	NextPageToken string `json:"nextPageToken,omitempty"`
178
179	// Operations: A list of operations that matches the specified filter in
180	// the request.
181	Operations []*Operation `json:"operations,omitempty"`
182
183	// ServerResponse contains the HTTP response code and headers from the
184	// server.
185	googleapi.ServerResponse `json:"-"`
186
187	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
188	// unconditionally include in API requests. By default, fields with
189	// empty values are omitted from API requests. However, any non-pointer,
190	// non-interface field appearing in ForceSendFields will be sent to the
191	// server regardless of whether the field is empty or not. This may be
192	// used to include empty fields in Patch requests.
193	ForceSendFields []string `json:"-"`
194
195	// NullFields is a list of field names (e.g. "NextPageToken") to include
196	// in API requests with the JSON null value. By default, fields with
197	// empty values are omitted from API requests. However, any field with
198	// an empty value appearing in NullFields will be sent to the server as
199	// null. It is an error if a field in this list has a non-empty value.
200	// This may be used to include null fields in Patch requests.
201	NullFields []string `json:"-"`
202}
203
204func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
205	type NoMethod ListOperationsResponse
206	raw := NoMethod(*s)
207	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
208}
209
210// Operation: This resource represents a long-running operation that is
211// the result of a
212// network API call.
213type Operation struct {
214	// Done: If the value is `false`, it means the operation is still in
215	// progress.
216	// If `true`, the operation is completed, and either `error` or
217	// `response` is
218	// available.
219	Done bool `json:"done,omitempty"`
220
221	// Error: The error result of the operation in case of failure or
222	// cancellation.
223	Error *Status `json:"error,omitempty"`
224
225	// Metadata: Service-specific metadata associated with the operation.
226	// It typically
227	// contains progress information and common metadata such as create
228	// time.
229	// Some services might not provide such metadata.  Any method that
230	// returns a
231	// long-running operation should document the metadata type, if any.
232	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
233
234	// Name: The server-assigned name, which is only unique within the same
235	// service that
236	// originally returns it. If you use the default HTTP mapping,
237	// the
238	// `name` should be a resource name ending with
239	// `operations/{unique_id}`.
240	Name string `json:"name,omitempty"`
241
242	// Response: The normal response of the operation in case of success.
243	// If the original
244	// method returns no data on success, such as `Delete`, the response
245	// is
246	// `google.protobuf.Empty`.  If the original method is
247	// standard
248	// `Get`/`Create`/`Update`, the response should be the resource.  For
249	// other
250	// methods, the response should have the type `XxxResponse`, where
251	// `Xxx`
252	// is the original method name.  For example, if the original method
253	// name
254	// is `TakeSnapshot()`, the inferred response type
255	// is
256	// `TakeSnapshotResponse`.
257	Response googleapi.RawMessage `json:"response,omitempty"`
258
259	// ForceSendFields is a list of field names (e.g. "Done") to
260	// unconditionally include in API requests. By default, fields with
261	// empty values are omitted from API requests. However, any non-pointer,
262	// non-interface field appearing in ForceSendFields will be sent to the
263	// server regardless of whether the field is empty or not. This may be
264	// used to include empty fields in Patch requests.
265	ForceSendFields []string `json:"-"`
266
267	// NullFields is a list of field names (e.g. "Done") to include in API
268	// requests with the JSON null value. By default, fields with empty
269	// values are omitted from API requests. However, any field with an
270	// empty value appearing in NullFields will be sent to the server as
271	// null. It is an error if a field in this list has a non-empty value.
272	// This may be used to include null fields in Patch requests.
273	NullFields []string `json:"-"`
274}
275
276func (s *Operation) MarshalJSON() ([]byte, error) {
277	type NoMethod Operation
278	raw := NoMethod(*s)
279	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
280}
281
282// Status: The `Status` type defines a logical error model that is
283// suitable for
284// different programming environments, including REST APIs and RPC APIs.
285// It is
286// used by [gRPC](https://github.com/grpc). Each `Status` message
287// contains
288// three pieces of data: error code, error message, and error
289// details.
290//
291// You can find out more about this error model and how to work with it
292// in the
293// [API Design Guide](https://cloud.google.com/apis/design/errors).
294type Status struct {
295	// Code: The status code, which should be an enum value of
296	// google.rpc.Code.
297	Code int64 `json:"code,omitempty"`
298
299	// Details: A list of messages that carry the error details.  There is a
300	// common set of
301	// message types for APIs to use.
302	Details []googleapi.RawMessage `json:"details,omitempty"`
303
304	// Message: A developer-facing error message, which should be in
305	// English. Any
306	// user-facing error message should be localized and sent in
307	// the
308	// google.rpc.Status.details field, or localized by the client.
309	Message string `json:"message,omitempty"`
310
311	// ForceSendFields is a list of field names (e.g. "Code") to
312	// unconditionally include in API requests. By default, fields with
313	// empty values are omitted from API requests. However, any non-pointer,
314	// non-interface field appearing in ForceSendFields will be sent to the
315	// server regardless of whether the field is empty or not. This may be
316	// used to include empty fields in Patch requests.
317	ForceSendFields []string `json:"-"`
318
319	// NullFields is a list of field names (e.g. "Code") to include in API
320	// requests with the JSON null value. By default, fields with empty
321	// values are omitted from API requests. However, any field with an
322	// empty value appearing in NullFields will be sent to the server as
323	// null. It is an error if a field in this list has a non-empty value.
324	// This may be used to include null fields in Patch requests.
325	NullFields []string `json:"-"`
326}
327
328func (s *Status) MarshalJSON() ([]byte, error) {
329	type NoMethod Status
330	raw := NoMethod(*s)
331	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
332}
333
334// method id "runtimeconfig.operations.cancel":
335
336type OperationsCancelCall struct {
337	s                      *Service
338	name                   string
339	canceloperationrequest *CancelOperationRequest
340	urlParams_             gensupport.URLParams
341	ctx_                   context.Context
342	header_                http.Header
343}
344
345// Cancel: Starts asynchronous cancellation on a long-running operation.
346//  The server
347// makes a best effort to cancel the operation, but success is
348// not
349// guaranteed.  If the server doesn't support this method, it
350// returns
351// `google.rpc.Code.UNIMPLEMENTED`.  Clients can
352// use
353// Operations.GetOperation or
354// other methods to check whether the cancellation succeeded or whether
355// the
356// operation completed despite cancellation. On successful
357// cancellation,
358// the operation is not deleted; instead, it becomes an operation
359// with
360// an Operation.error value with a google.rpc.Status.code of
361// 1,
362// corresponding to `Code.CANCELLED`.
363func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
364	c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
365	c.name = name
366	c.canceloperationrequest = canceloperationrequest
367	return c
368}
369
370// Fields allows partial responses to be retrieved. See
371// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
372// for more information.
373func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
374	c.urlParams_.Set("fields", googleapi.CombineFields(s))
375	return c
376}
377
378// Context sets the context to be used in this call's Do method. Any
379// pending HTTP request will be aborted if the provided context is
380// canceled.
381func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
382	c.ctx_ = ctx
383	return c
384}
385
386// Header returns an http.Header that can be modified by the caller to
387// add HTTP headers to the request.
388func (c *OperationsCancelCall) Header() http.Header {
389	if c.header_ == nil {
390		c.header_ = make(http.Header)
391	}
392	return c.header_
393}
394
395func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
396	reqHeaders := make(http.Header)
397	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114")
398	for k, v := range c.header_ {
399		reqHeaders[k] = v
400	}
401	reqHeaders.Set("User-Agent", c.s.userAgent())
402	var body io.Reader = nil
403	body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
404	if err != nil {
405		return nil, err
406	}
407	reqHeaders.Set("Content-Type", "application/json")
408	c.urlParams_.Set("alt", alt)
409	c.urlParams_.Set("prettyPrint", "false")
410	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
411	urls += "?" + c.urlParams_.Encode()
412	req, err := http.NewRequest("POST", urls, body)
413	if err != nil {
414		return nil, err
415	}
416	req.Header = reqHeaders
417	googleapi.Expand(req.URL, map[string]string{
418		"name": c.name,
419	})
420	return gensupport.SendRequest(c.ctx_, c.s.client, req)
421}
422
423// Do executes the "runtimeconfig.operations.cancel" call.
424// Exactly one of *Empty or error will be non-nil. Any non-2xx status
425// code is an error. Response headers are in either
426// *Empty.ServerResponse.Header or (if a response was returned at all)
427// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
428// check whether the returned error was because http.StatusNotModified
429// was returned.
430func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
431	gensupport.SetOptions(c.urlParams_, opts...)
432	res, err := c.doRequest("json")
433	if res != nil && res.StatusCode == http.StatusNotModified {
434		if res.Body != nil {
435			res.Body.Close()
436		}
437		return nil, &googleapi.Error{
438			Code:   res.StatusCode,
439			Header: res.Header,
440		}
441	}
442	if err != nil {
443		return nil, err
444	}
445	defer googleapi.CloseBody(res)
446	if err := googleapi.CheckResponse(res); err != nil {
447		return nil, err
448	}
449	ret := &Empty{
450		ServerResponse: googleapi.ServerResponse{
451			Header:         res.Header,
452			HTTPStatusCode: res.StatusCode,
453		},
454	}
455	target := &ret
456	if err := gensupport.DecodeResponse(target, res); err != nil {
457		return nil, err
458	}
459	return ret, nil
460	// {
461	//   "description": "Starts asynchronous cancellation on a long-running operation.  The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed.  If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.  Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
462	//   "flatPath": "v1/operations/{operationsId}:cancel",
463	//   "httpMethod": "POST",
464	//   "id": "runtimeconfig.operations.cancel",
465	//   "parameterOrder": [
466	//     "name"
467	//   ],
468	//   "parameters": {
469	//     "name": {
470	//       "description": "The name of the operation resource to be cancelled.",
471	//       "location": "path",
472	//       "pattern": "^operations/.+$",
473	//       "required": true,
474	//       "type": "string"
475	//     }
476	//   },
477	//   "path": "v1/{+name}:cancel",
478	//   "request": {
479	//     "$ref": "CancelOperationRequest"
480	//   },
481	//   "response": {
482	//     "$ref": "Empty"
483	//   },
484	//   "scopes": [
485	//     "https://www.googleapis.com/auth/cloud-platform",
486	//     "https://www.googleapis.com/auth/cloudruntimeconfig"
487	//   ]
488	// }
489
490}
491
492// method id "runtimeconfig.operations.delete":
493
494type OperationsDeleteCall struct {
495	s          *Service
496	name       string
497	urlParams_ gensupport.URLParams
498	ctx_       context.Context
499	header_    http.Header
500}
501
502// Delete: Deletes a long-running operation. This method indicates that
503// the client is
504// no longer interested in the operation result. It does not cancel
505// the
506// operation. If the server doesn't support this method, it
507// returns
508// `google.rpc.Code.UNIMPLEMENTED`.
509func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
510	c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
511	c.name = name
512	return c
513}
514
515// Fields allows partial responses to be retrieved. See
516// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
517// for more information.
518func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
519	c.urlParams_.Set("fields", googleapi.CombineFields(s))
520	return c
521}
522
523// Context sets the context to be used in this call's Do method. Any
524// pending HTTP request will be aborted if the provided context is
525// canceled.
526func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
527	c.ctx_ = ctx
528	return c
529}
530
531// Header returns an http.Header that can be modified by the caller to
532// add HTTP headers to the request.
533func (c *OperationsDeleteCall) Header() http.Header {
534	if c.header_ == nil {
535		c.header_ = make(http.Header)
536	}
537	return c.header_
538}
539
540func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
541	reqHeaders := make(http.Header)
542	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114")
543	for k, v := range c.header_ {
544		reqHeaders[k] = v
545	}
546	reqHeaders.Set("User-Agent", c.s.userAgent())
547	var body io.Reader = nil
548	c.urlParams_.Set("alt", alt)
549	c.urlParams_.Set("prettyPrint", "false")
550	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
551	urls += "?" + c.urlParams_.Encode()
552	req, err := http.NewRequest("DELETE", urls, body)
553	if err != nil {
554		return nil, err
555	}
556	req.Header = reqHeaders
557	googleapi.Expand(req.URL, map[string]string{
558		"name": c.name,
559	})
560	return gensupport.SendRequest(c.ctx_, c.s.client, req)
561}
562
563// Do executes the "runtimeconfig.operations.delete" call.
564// Exactly one of *Empty or error will be non-nil. Any non-2xx status
565// code is an error. Response headers are in either
566// *Empty.ServerResponse.Header or (if a response was returned at all)
567// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
568// check whether the returned error was because http.StatusNotModified
569// was returned.
570func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
571	gensupport.SetOptions(c.urlParams_, opts...)
572	res, err := c.doRequest("json")
573	if res != nil && res.StatusCode == http.StatusNotModified {
574		if res.Body != nil {
575			res.Body.Close()
576		}
577		return nil, &googleapi.Error{
578			Code:   res.StatusCode,
579			Header: res.Header,
580		}
581	}
582	if err != nil {
583		return nil, err
584	}
585	defer googleapi.CloseBody(res)
586	if err := googleapi.CheckResponse(res); err != nil {
587		return nil, err
588	}
589	ret := &Empty{
590		ServerResponse: googleapi.ServerResponse{
591			Header:         res.Header,
592			HTTPStatusCode: res.StatusCode,
593		},
594	}
595	target := &ret
596	if err := gensupport.DecodeResponse(target, res); err != nil {
597		return nil, err
598	}
599	return ret, nil
600	// {
601	//   "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
602	//   "flatPath": "v1/operations/{operationsId}",
603	//   "httpMethod": "DELETE",
604	//   "id": "runtimeconfig.operations.delete",
605	//   "parameterOrder": [
606	//     "name"
607	//   ],
608	//   "parameters": {
609	//     "name": {
610	//       "description": "The name of the operation resource to be deleted.",
611	//       "location": "path",
612	//       "pattern": "^operations/.+$",
613	//       "required": true,
614	//       "type": "string"
615	//     }
616	//   },
617	//   "path": "v1/{+name}",
618	//   "response": {
619	//     "$ref": "Empty"
620	//   },
621	//   "scopes": [
622	//     "https://www.googleapis.com/auth/cloud-platform",
623	//     "https://www.googleapis.com/auth/cloudruntimeconfig"
624	//   ]
625	// }
626
627}
628
629// method id "runtimeconfig.operations.list":
630
631type OperationsListCall struct {
632	s            *Service
633	name         string
634	urlParams_   gensupport.URLParams
635	ifNoneMatch_ string
636	ctx_         context.Context
637	header_      http.Header
638}
639
640// List: Lists operations that match the specified filter in the
641// request. If the
642// server doesn't support this method, it returns
643// `UNIMPLEMENTED`.
644//
645// NOTE: the `name` binding allows API services to override the
646// binding
647// to use different resource name schemes, such as `users/*/operations`.
648// To
649// override the binding, API services can add a binding such
650// as
651// "/v1/{name=users/*}/operations" to their service configuration.
652// For backwards compatibility, the default name includes the
653// operations
654// collection id, however overriding users must ensure the name
655// binding
656// is the parent resource, without the operations collection id.
657func (r *OperationsService) List(name string) *OperationsListCall {
658	c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
659	c.name = name
660	return c
661}
662
663// Filter sets the optional parameter "filter": The standard list
664// filter.
665func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
666	c.urlParams_.Set("filter", filter)
667	return c
668}
669
670// PageSize sets the optional parameter "pageSize": The standard list
671// page size.
672func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
673	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
674	return c
675}
676
677// PageToken sets the optional parameter "pageToken": The standard list
678// page token.
679func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
680	c.urlParams_.Set("pageToken", pageToken)
681	return c
682}
683
684// Fields allows partial responses to be retrieved. See
685// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
686// for more information.
687func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
688	c.urlParams_.Set("fields", googleapi.CombineFields(s))
689	return c
690}
691
692// IfNoneMatch sets the optional parameter which makes the operation
693// fail if the object's ETag matches the given value. This is useful for
694// getting updates only after the object has changed since the last
695// request. Use googleapi.IsNotModified to check whether the response
696// error from Do is the result of In-None-Match.
697func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
698	c.ifNoneMatch_ = entityTag
699	return c
700}
701
702// Context sets the context to be used in this call's Do method. Any
703// pending HTTP request will be aborted if the provided context is
704// canceled.
705func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
706	c.ctx_ = ctx
707	return c
708}
709
710// Header returns an http.Header that can be modified by the caller to
711// add HTTP headers to the request.
712func (c *OperationsListCall) Header() http.Header {
713	if c.header_ == nil {
714		c.header_ = make(http.Header)
715	}
716	return c.header_
717}
718
719func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
720	reqHeaders := make(http.Header)
721	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114")
722	for k, v := range c.header_ {
723		reqHeaders[k] = v
724	}
725	reqHeaders.Set("User-Agent", c.s.userAgent())
726	if c.ifNoneMatch_ != "" {
727		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
728	}
729	var body io.Reader = nil
730	c.urlParams_.Set("alt", alt)
731	c.urlParams_.Set("prettyPrint", "false")
732	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
733	urls += "?" + c.urlParams_.Encode()
734	req, err := http.NewRequest("GET", urls, body)
735	if err != nil {
736		return nil, err
737	}
738	req.Header = reqHeaders
739	googleapi.Expand(req.URL, map[string]string{
740		"name": c.name,
741	})
742	return gensupport.SendRequest(c.ctx_, c.s.client, req)
743}
744
745// Do executes the "runtimeconfig.operations.list" call.
746// Exactly one of *ListOperationsResponse or error will be non-nil. Any
747// non-2xx status code is an error. Response headers are in either
748// *ListOperationsResponse.ServerResponse.Header or (if a response was
749// returned at all) in error.(*googleapi.Error).Header. Use
750// googleapi.IsNotModified to check whether the returned error was
751// because http.StatusNotModified was returned.
752func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
753	gensupport.SetOptions(c.urlParams_, opts...)
754	res, err := c.doRequest("json")
755	if res != nil && res.StatusCode == http.StatusNotModified {
756		if res.Body != nil {
757			res.Body.Close()
758		}
759		return nil, &googleapi.Error{
760			Code:   res.StatusCode,
761			Header: res.Header,
762		}
763	}
764	if err != nil {
765		return nil, err
766	}
767	defer googleapi.CloseBody(res)
768	if err := googleapi.CheckResponse(res); err != nil {
769		return nil, err
770	}
771	ret := &ListOperationsResponse{
772		ServerResponse: googleapi.ServerResponse{
773			Header:         res.Header,
774			HTTPStatusCode: res.StatusCode,
775		},
776	}
777	target := &ret
778	if err := gensupport.DecodeResponse(target, res); err != nil {
779		return nil, err
780	}
781	return ret, nil
782	// {
783	//   "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
784	//   "flatPath": "v1/operations",
785	//   "httpMethod": "GET",
786	//   "id": "runtimeconfig.operations.list",
787	//   "parameterOrder": [
788	//     "name"
789	//   ],
790	//   "parameters": {
791	//     "filter": {
792	//       "description": "The standard list filter.",
793	//       "location": "query",
794	//       "type": "string"
795	//     },
796	//     "name": {
797	//       "description": "The name of the operation's parent resource.",
798	//       "location": "path",
799	//       "pattern": "^operations$",
800	//       "required": true,
801	//       "type": "string"
802	//     },
803	//     "pageSize": {
804	//       "description": "The standard list page size.",
805	//       "format": "int32",
806	//       "location": "query",
807	//       "type": "integer"
808	//     },
809	//     "pageToken": {
810	//       "description": "The standard list page token.",
811	//       "location": "query",
812	//       "type": "string"
813	//     }
814	//   },
815	//   "path": "v1/{+name}",
816	//   "response": {
817	//     "$ref": "ListOperationsResponse"
818	//   },
819	//   "scopes": [
820	//     "https://www.googleapis.com/auth/cloud-platform",
821	//     "https://www.googleapis.com/auth/cloudruntimeconfig"
822	//   ]
823	// }
824
825}
826
827// Pages invokes f for each page of results.
828// A non-nil error returned from f will halt the iteration.
829// The provided context supersedes any context provided to the Context method.
830func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
831	c.ctx_ = ctx
832	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
833	for {
834		x, err := c.Do()
835		if err != nil {
836			return err
837		}
838		if err := f(x); err != nil {
839			return err
840		}
841		if x.NextPageToken == "" {
842			return nil
843		}
844		c.PageToken(x.NextPageToken)
845	}
846}
847