...

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

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

     1  // Copyright 2024 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package 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  // # 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/runtimeconfig/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	runtimeconfigService, err := runtimeconfig.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  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithScopes(runtimeconfig.CloudruntimeconfigScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	runtimeconfigService, err := runtimeconfig.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package runtimeconfig // import "google.golang.org/api/runtimeconfig/v1"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "runtimeconfig:v1"
    95  const apiName = "runtimeconfig"
    96  const apiVersion = "v1"
    97  const basePath = "https://runtimeconfig.googleapis.com/"
    98  const basePathTemplate = "https://runtimeconfig.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://runtimeconfig.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// See, edit, configure, and delete your Google Cloud data and see the email
   104  	// address for your Google Account.
   105  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   106  
   107  	// Manage your Google Cloud Platform services' runtime configuration
   108  	CloudruntimeconfigScope = "https://www.googleapis.com/auth/cloudruntimeconfig"
   109  )
   110  
   111  // NewService creates a new Service.
   112  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   113  	scopesOption := internaloption.WithDefaultScopes(
   114  		"https://www.googleapis.com/auth/cloud-platform",
   115  		"https://www.googleapis.com/auth/cloudruntimeconfig",
   116  	)
   117  	// NOTE: prepend, so we don't override user-specified scopes.
   118  	opts = append([]option.ClientOption{scopesOption}, opts...)
   119  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   120  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   121  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   122  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   123  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	s, err := New(client)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	if endpoint != "" {
   132  		s.BasePath = endpoint
   133  	}
   134  	return s, nil
   135  }
   136  
   137  // New creates a new Service. It uses the provided http.Client for requests.
   138  //
   139  // Deprecated: please use NewService instead.
   140  // To provide a custom HTTP client, use option.WithHTTPClient.
   141  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   142  func New(client *http.Client) (*Service, error) {
   143  	if client == nil {
   144  		return nil, errors.New("client is nil")
   145  	}
   146  	s := &Service{client: client, BasePath: basePath}
   147  	s.Operations = NewOperationsService(s)
   148  	return s, nil
   149  }
   150  
   151  type Service struct {
   152  	client    *http.Client
   153  	BasePath  string // API endpoint base URL
   154  	UserAgent string // optional additional User-Agent fragment
   155  
   156  	Operations *OperationsService
   157  }
   158  
   159  func (s *Service) userAgent() string {
   160  	if s.UserAgent == "" {
   161  		return googleapi.UserAgent
   162  	}
   163  	return googleapi.UserAgent + " " + s.UserAgent
   164  }
   165  
   166  func NewOperationsService(s *Service) *OperationsService {
   167  	rs := &OperationsService{s: s}
   168  	return rs
   169  }
   170  
   171  type OperationsService struct {
   172  	s *Service
   173  }
   174  
   175  // CancelOperationRequest: The request message for Operations.CancelOperation.
   176  type CancelOperationRequest struct {
   177  }
   178  
   179  // Empty: A generic empty message that you can re-use to avoid defining
   180  // duplicated empty messages in your APIs. A typical example is to use it as
   181  // the request or the response type of an API method. For instance: service Foo
   182  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   183  type Empty struct {
   184  	// ServerResponse contains the HTTP response code and headers from the server.
   185  	googleapi.ServerResponse `json:"-"`
   186  }
   187  
   188  // ListOperationsResponse: The response message for Operations.ListOperations.
   189  type ListOperationsResponse struct {
   190  	// NextPageToken: The standard List next-page token.
   191  	NextPageToken string `json:"nextPageToken,omitempty"`
   192  	// Operations: A list of operations that matches the specified filter in the
   193  	// request.
   194  	Operations []*Operation `json:"operations,omitempty"`
   195  
   196  	// ServerResponse contains the HTTP response code and headers from the server.
   197  	googleapi.ServerResponse `json:"-"`
   198  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   199  	// unconditionally include in API requests. By default, fields with empty or
   200  	// default values are omitted from API requests. See
   201  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   202  	// details.
   203  	ForceSendFields []string `json:"-"`
   204  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   205  	// requests with the JSON null value. By default, fields with empty values are
   206  	// omitted from API requests. See
   207  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   208  	NullFields []string `json:"-"`
   209  }
   210  
   211  func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
   212  	type NoMethod ListOperationsResponse
   213  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   214  }
   215  
   216  // Operation: This resource represents a long-running operation that is the
   217  // result of a network API call.
   218  type Operation struct {
   219  	// Done: If the value is `false`, it means the operation is still in progress.
   220  	// If `true`, the operation is completed, and either `error` or `response` is
   221  	// available.
   222  	Done bool `json:"done,omitempty"`
   223  	// Error: The error result of the operation in case of failure or cancellation.
   224  	Error *Status `json:"error,omitempty"`
   225  	// Metadata: Service-specific metadata associated with the operation. It
   226  	// typically contains progress information and common metadata such as create
   227  	// time. Some services might not provide such metadata. Any method that returns
   228  	// a long-running operation should document the metadata type, if any.
   229  	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
   230  	// Name: The server-assigned name, which is only unique within the same service
   231  	// that originally returns it. If you use the default HTTP mapping, the `name`
   232  	// should be a resource name ending with `operations/{unique_id}`.
   233  	Name string `json:"name,omitempty"`
   234  	// Response: The normal, successful response of the operation. If the original
   235  	// method returns no data on success, such as `Delete`, the response is
   236  	// `google.protobuf.Empty`. If the original method is standard
   237  	// `Get`/`Create`/`Update`, the response should be the resource. For other
   238  	// methods, the response should have the type `XxxResponse`, where `Xxx` is the
   239  	// original method name. For example, if the original method name is
   240  	// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
   241  	Response googleapi.RawMessage `json:"response,omitempty"`
   242  	// ForceSendFields is a list of field names (e.g. "Done") to unconditionally
   243  	// include in API requests. By default, fields with empty or default values are
   244  	// omitted from API requests. See
   245  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   246  	// details.
   247  	ForceSendFields []string `json:"-"`
   248  	// NullFields is a list of field names (e.g. "Done") to include in API requests
   249  	// with the JSON null value. By default, fields with empty values are omitted
   250  	// from API requests. See
   251  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   252  	NullFields []string `json:"-"`
   253  }
   254  
   255  func (s *Operation) MarshalJSON() ([]byte, error) {
   256  	type NoMethod Operation
   257  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   258  }
   259  
   260  // Status: The `Status` type defines a logical error model that is suitable for
   261  // different programming environments, including REST APIs and RPC APIs. It is
   262  // used by gRPC (https://github.com/grpc). Each `Status` message contains three
   263  // pieces of data: error code, error message, and error details. You can find
   264  // out more about this error model and how to work with it in the API Design
   265  // Guide (https://cloud.google.com/apis/design/errors).
   266  type Status struct {
   267  	// Code: The status code, which should be an enum value of google.rpc.Code.
   268  	Code int64 `json:"code,omitempty"`
   269  	// Details: A list of messages that carry the error details. There is a common
   270  	// set of message types for APIs to use.
   271  	Details []googleapi.RawMessage `json:"details,omitempty"`
   272  	// Message: A developer-facing error message, which should be in English. Any
   273  	// user-facing error message should be localized and sent in the
   274  	// google.rpc.Status.details field, or localized by the client.
   275  	Message string `json:"message,omitempty"`
   276  	// ForceSendFields is a list of field names (e.g. "Code") to unconditionally
   277  	// include in API requests. By default, fields with empty or default values are
   278  	// omitted from API requests. See
   279  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   280  	// details.
   281  	ForceSendFields []string `json:"-"`
   282  	// NullFields is a list of field names (e.g. "Code") to include in API requests
   283  	// with the JSON null value. By default, fields with empty values are omitted
   284  	// from API requests. See
   285  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   286  	NullFields []string `json:"-"`
   287  }
   288  
   289  func (s *Status) MarshalJSON() ([]byte, error) {
   290  	type NoMethod Status
   291  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   292  }
   293  
   294  type OperationsCancelCall struct {
   295  	s                      *Service
   296  	name                   string
   297  	canceloperationrequest *CancelOperationRequest
   298  	urlParams_             gensupport.URLParams
   299  	ctx_                   context.Context
   300  	header_                http.Header
   301  }
   302  
   303  // Cancel: Starts asynchronous cancellation on a long-running operation. The
   304  // server makes a best effort to cancel the operation, but success is not
   305  // guaranteed. If the server doesn't support this method, it returns
   306  // `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
   307  // other methods to check whether the cancellation succeeded or whether the
   308  // operation completed despite cancellation. On successful cancellation, the
   309  // operation is not deleted; instead, it becomes an operation with an
   310  // Operation.error value with a google.rpc.Status.code of 1, corresponding to
   311  // `Code.CANCELLED`.
   312  //
   313  // - name: The name of the operation resource to be cancelled.
   314  func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
   315  	c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   316  	c.name = name
   317  	c.canceloperationrequest = canceloperationrequest
   318  	return c
   319  }
   320  
   321  // Fields allows partial responses to be retrieved. See
   322  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   323  // details.
   324  func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
   325  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   326  	return c
   327  }
   328  
   329  // Context sets the context to be used in this call's Do method.
   330  func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
   331  	c.ctx_ = ctx
   332  	return c
   333  }
   334  
   335  // Header returns a http.Header that can be modified by the caller to add
   336  // headers to the request.
   337  func (c *OperationsCancelCall) Header() http.Header {
   338  	if c.header_ == nil {
   339  		c.header_ = make(http.Header)
   340  	}
   341  	return c.header_
   342  }
   343  
   344  func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
   345  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   346  	var body io.Reader = nil
   347  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
   348  	if err != nil {
   349  		return nil, err
   350  	}
   351  	c.urlParams_.Set("alt", alt)
   352  	c.urlParams_.Set("prettyPrint", "false")
   353  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
   354  	urls += "?" + c.urlParams_.Encode()
   355  	req, err := http.NewRequest("POST", urls, body)
   356  	if err != nil {
   357  		return nil, err
   358  	}
   359  	req.Header = reqHeaders
   360  	googleapi.Expand(req.URL, map[string]string{
   361  		"name": c.name,
   362  	})
   363  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   364  }
   365  
   366  // Do executes the "runtimeconfig.operations.cancel" call.
   367  // Any non-2xx status code is an error. Response headers are in either
   368  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   369  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   370  // whether the returned error was because http.StatusNotModified was returned.
   371  func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   372  	gensupport.SetOptions(c.urlParams_, opts...)
   373  	res, err := c.doRequest("json")
   374  	if res != nil && res.StatusCode == http.StatusNotModified {
   375  		if res.Body != nil {
   376  			res.Body.Close()
   377  		}
   378  		return nil, gensupport.WrapError(&googleapi.Error{
   379  			Code:   res.StatusCode,
   380  			Header: res.Header,
   381  		})
   382  	}
   383  	if err != nil {
   384  		return nil, err
   385  	}
   386  	defer googleapi.CloseBody(res)
   387  	if err := googleapi.CheckResponse(res); err != nil {
   388  		return nil, gensupport.WrapError(err)
   389  	}
   390  	ret := &Empty{
   391  		ServerResponse: googleapi.ServerResponse{
   392  			Header:         res.Header,
   393  			HTTPStatusCode: res.StatusCode,
   394  		},
   395  	}
   396  	target := &ret
   397  	if err := gensupport.DecodeResponse(target, res); err != nil {
   398  		return nil, err
   399  	}
   400  	return ret, nil
   401  }
   402  
   403  type OperationsDeleteCall struct {
   404  	s          *Service
   405  	name       string
   406  	urlParams_ gensupport.URLParams
   407  	ctx_       context.Context
   408  	header_    http.Header
   409  }
   410  
   411  // Delete: Deletes a long-running operation. This method indicates that the
   412  // client is no longer interested in the operation result. It does not cancel
   413  // the operation. If the server doesn't support this method, it returns
   414  // `google.rpc.Code.UNIMPLEMENTED`.
   415  //
   416  // - name: The name of the operation resource to be deleted.
   417  func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
   418  	c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   419  	c.name = name
   420  	return c
   421  }
   422  
   423  // Fields allows partial responses to be retrieved. See
   424  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   425  // details.
   426  func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
   427  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   428  	return c
   429  }
   430  
   431  // Context sets the context to be used in this call's Do method.
   432  func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
   433  	c.ctx_ = ctx
   434  	return c
   435  }
   436  
   437  // Header returns a http.Header that can be modified by the caller to add
   438  // headers to the request.
   439  func (c *OperationsDeleteCall) Header() http.Header {
   440  	if c.header_ == nil {
   441  		c.header_ = make(http.Header)
   442  	}
   443  	return c.header_
   444  }
   445  
   446  func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
   447  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   448  	var body io.Reader = nil
   449  	c.urlParams_.Set("alt", alt)
   450  	c.urlParams_.Set("prettyPrint", "false")
   451  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   452  	urls += "?" + c.urlParams_.Encode()
   453  	req, err := http.NewRequest("DELETE", urls, body)
   454  	if err != nil {
   455  		return nil, err
   456  	}
   457  	req.Header = reqHeaders
   458  	googleapi.Expand(req.URL, map[string]string{
   459  		"name": c.name,
   460  	})
   461  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   462  }
   463  
   464  // Do executes the "runtimeconfig.operations.delete" call.
   465  // Any non-2xx status code is an error. Response headers are in either
   466  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   467  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   468  // whether the returned error was because http.StatusNotModified was returned.
   469  func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   470  	gensupport.SetOptions(c.urlParams_, opts...)
   471  	res, err := c.doRequest("json")
   472  	if res != nil && res.StatusCode == http.StatusNotModified {
   473  		if res.Body != nil {
   474  			res.Body.Close()
   475  		}
   476  		return nil, gensupport.WrapError(&googleapi.Error{
   477  			Code:   res.StatusCode,
   478  			Header: res.Header,
   479  		})
   480  	}
   481  	if err != nil {
   482  		return nil, err
   483  	}
   484  	defer googleapi.CloseBody(res)
   485  	if err := googleapi.CheckResponse(res); err != nil {
   486  		return nil, gensupport.WrapError(err)
   487  	}
   488  	ret := &Empty{
   489  		ServerResponse: googleapi.ServerResponse{
   490  			Header:         res.Header,
   491  			HTTPStatusCode: res.StatusCode,
   492  		},
   493  	}
   494  	target := &ret
   495  	if err := gensupport.DecodeResponse(target, res); err != nil {
   496  		return nil, err
   497  	}
   498  	return ret, nil
   499  }
   500  
   501  type OperationsListCall struct {
   502  	s            *Service
   503  	name         string
   504  	urlParams_   gensupport.URLParams
   505  	ifNoneMatch_ string
   506  	ctx_         context.Context
   507  	header_      http.Header
   508  }
   509  
   510  // List: Lists operations that match the specified filter in the request. If
   511  // the server doesn't support this method, it returns `UNIMPLEMENTED`.
   512  //
   513  // - name: The name of the operation's parent resource.
   514  func (r *OperationsService) List(name string) *OperationsListCall {
   515  	c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   516  	c.name = name
   517  	return c
   518  }
   519  
   520  // Filter sets the optional parameter "filter": The standard list filter.
   521  func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
   522  	c.urlParams_.Set("filter", filter)
   523  	return c
   524  }
   525  
   526  // PageSize sets the optional parameter "pageSize": The standard list page
   527  // size.
   528  func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
   529  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   530  	return c
   531  }
   532  
   533  // PageToken sets the optional parameter "pageToken": The standard list page
   534  // token.
   535  func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
   536  	c.urlParams_.Set("pageToken", pageToken)
   537  	return c
   538  }
   539  
   540  // Fields allows partial responses to be retrieved. See
   541  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   542  // details.
   543  func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
   544  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   545  	return c
   546  }
   547  
   548  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   549  // object's ETag matches the given value. This is useful for getting updates
   550  // only after the object has changed since the last request.
   551  func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
   552  	c.ifNoneMatch_ = entityTag
   553  	return c
   554  }
   555  
   556  // Context sets the context to be used in this call's Do method.
   557  func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
   558  	c.ctx_ = ctx
   559  	return c
   560  }
   561  
   562  // Header returns a http.Header that can be modified by the caller to add
   563  // headers to the request.
   564  func (c *OperationsListCall) Header() http.Header {
   565  	if c.header_ == nil {
   566  		c.header_ = make(http.Header)
   567  	}
   568  	return c.header_
   569  }
   570  
   571  func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
   572  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   573  	if c.ifNoneMatch_ != "" {
   574  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   575  	}
   576  	var body io.Reader = nil
   577  	c.urlParams_.Set("alt", alt)
   578  	c.urlParams_.Set("prettyPrint", "false")
   579  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   580  	urls += "?" + c.urlParams_.Encode()
   581  	req, err := http.NewRequest("GET", urls, body)
   582  	if err != nil {
   583  		return nil, err
   584  	}
   585  	req.Header = reqHeaders
   586  	googleapi.Expand(req.URL, map[string]string{
   587  		"name": c.name,
   588  	})
   589  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   590  }
   591  
   592  // Do executes the "runtimeconfig.operations.list" call.
   593  // Any non-2xx status code is an error. Response headers are in either
   594  // *ListOperationsResponse.ServerResponse.Header or (if a response was returned
   595  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   596  // check whether the returned error was because http.StatusNotModified was
   597  // returned.
   598  func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
   599  	gensupport.SetOptions(c.urlParams_, opts...)
   600  	res, err := c.doRequest("json")
   601  	if res != nil && res.StatusCode == http.StatusNotModified {
   602  		if res.Body != nil {
   603  			res.Body.Close()
   604  		}
   605  		return nil, gensupport.WrapError(&googleapi.Error{
   606  			Code:   res.StatusCode,
   607  			Header: res.Header,
   608  		})
   609  	}
   610  	if err != nil {
   611  		return nil, err
   612  	}
   613  	defer googleapi.CloseBody(res)
   614  	if err := googleapi.CheckResponse(res); err != nil {
   615  		return nil, gensupport.WrapError(err)
   616  	}
   617  	ret := &ListOperationsResponse{
   618  		ServerResponse: googleapi.ServerResponse{
   619  			Header:         res.Header,
   620  			HTTPStatusCode: res.StatusCode,
   621  		},
   622  	}
   623  	target := &ret
   624  	if err := gensupport.DecodeResponse(target, res); err != nil {
   625  		return nil, err
   626  	}
   627  	return ret, nil
   628  }
   629  
   630  // Pages invokes f for each page of results.
   631  // A non-nil error returned from f will halt the iteration.
   632  // The provided context supersedes any context provided to the Context method.
   633  func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
   634  	c.ctx_ = ctx
   635  	defer c.PageToken(c.urlParams_.Get("pageToken"))
   636  	for {
   637  		x, err := c.Do()
   638  		if err != nil {
   639  			return err
   640  		}
   641  		if err := f(x); err != nil {
   642  			return err
   643  		}
   644  		if x.NextPageToken == "" {
   645  			return nil
   646  		}
   647  		c.PageToken(x.NextPageToken)
   648  	}
   649  }
   650  

View as plain text