...

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

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

     1  // Copyright 2020 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 servicebroker provides access to the Service Broker API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/kubernetes-engine/docs/concepts/add-on/service-broker
    10  //
    11  // # Creating a client
    12  //
    13  // Usage example:
    14  //
    15  //	import "google.golang.org/api/servicebroker/v1"
    16  //	...
    17  //	ctx := context.Background()
    18  //	servicebrokerService, err := servicebroker.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  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    27  //
    28  //	servicebrokerService, err := servicebroker.NewService(ctx, option.WithAPIKey("AIza..."))
    29  //
    30  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
    31  //
    32  //	config := &oauth2.Config{...}
    33  //	// ...
    34  //	token, err := config.Exchange(ctx, ...)
    35  //	servicebrokerService, err := servicebroker.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    36  //
    37  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    38  package servicebroker // import "google.golang.org/api/servicebroker/v1"
    39  
    40  import (
    41  	"bytes"
    42  	"context"
    43  	"encoding/json"
    44  	"errors"
    45  	"fmt"
    46  	"io"
    47  	"net/http"
    48  	"net/url"
    49  	"strconv"
    50  	"strings"
    51  
    52  	googleapi "google.golang.org/api/googleapi"
    53  	gensupport "google.golang.org/api/internal/gensupport"
    54  	option "google.golang.org/api/option"
    55  	htransport "google.golang.org/api/transport/http"
    56  )
    57  
    58  // Always reference these packages, just in case the auto-generated code
    59  // below doesn't.
    60  var _ = bytes.NewBuffer
    61  var _ = strconv.Itoa
    62  var _ = fmt.Sprintf
    63  var _ = json.NewDecoder
    64  var _ = io.Copy
    65  var _ = url.Parse
    66  var _ = gensupport.MarshalJSON
    67  var _ = googleapi.Version
    68  var _ = errors.New
    69  var _ = strings.Replace
    70  var _ = context.Canceled
    71  
    72  const apiId = "servicebroker:v1"
    73  const apiName = "servicebroker"
    74  const apiVersion = "v1"
    75  const basePath = "https://servicebroker.googleapis.com/"
    76  
    77  // OAuth2 scopes used by this API.
    78  const (
    79  	// View and manage your data across Google Cloud Platform services
    80  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
    81  )
    82  
    83  // NewService creates a new Service.
    84  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    85  	scopesOption := option.WithScopes(
    86  		"https://www.googleapis.com/auth/cloud-platform",
    87  	)
    88  	// NOTE: prepend, so we don't override user-specified scopes.
    89  	opts = append([]option.ClientOption{scopesOption}, opts...)
    90  	client, endpoint, err := htransport.NewClient(ctx, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	s, err := New(client)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	if endpoint != "" {
    99  		s.BasePath = endpoint
   100  	}
   101  	return s, nil
   102  }
   103  
   104  // New creates a new Service. It uses the provided http.Client for requests.
   105  //
   106  // Deprecated: please use NewService instead.
   107  // To provide a custom HTTP client, use option.WithHTTPClient.
   108  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   109  func New(client *http.Client) (*Service, error) {
   110  	if client == nil {
   111  		return nil, errors.New("client is nil")
   112  	}
   113  	s := &Service{client: client, BasePath: basePath}
   114  	s.V1 = NewV1Service(s)
   115  	return s, nil
   116  }
   117  
   118  type Service struct {
   119  	client    *http.Client
   120  	BasePath  string // API endpoint base URL
   121  	UserAgent string // optional additional User-Agent fragment
   122  
   123  	V1 *V1Service
   124  }
   125  
   126  func (s *Service) userAgent() string {
   127  	if s.UserAgent == "" {
   128  		return googleapi.UserAgent
   129  	}
   130  	return googleapi.UserAgent + " " + s.UserAgent
   131  }
   132  
   133  func NewV1Service(s *Service) *V1Service {
   134  	rs := &V1Service{s: s}
   135  	return rs
   136  }
   137  
   138  type V1Service struct {
   139  	s *Service
   140  }
   141  
   142  // GoogleIamV1__Binding: Associates `members` with a `role`.
   143  type GoogleIamV1__Binding struct {
   144  	// Condition: The condition that is associated with this binding.
   145  	// NOTE: An unsatisfied condition will not allow user access via
   146  	// current
   147  	// binding. Different bindings, including their conditions, are
   148  	// examined
   149  	// independently.
   150  	Condition *GoogleType__Expr `json:"condition,omitempty"`
   151  
   152  	// Members: Specifies the identities requesting access for a Cloud
   153  	// Platform resource.
   154  	// `members` can have the following values:
   155  	//
   156  	// * `allUsers`: A special identifier that represents anyone who is
   157  	//    on the internet; with or without a Google account.
   158  	//
   159  	// * `allAuthenticatedUsers`: A special identifier that represents
   160  	// anyone
   161  	//    who is authenticated with a Google account or a service
   162  	// account.
   163  	//
   164  	// * `user:{emailid}`: An email address that represents a specific
   165  	// Google
   166  	//    account. For example, `alice@example.com` .
   167  	//
   168  	//
   169  	// * `serviceAccount:{emailid}`: An email address that represents a
   170  	// service
   171  	//    account. For example,
   172  	// `my-other-app@appspot.gserviceaccount.com`.
   173  	//
   174  	// * `group:{emailid}`: An email address that represents a Google
   175  	// group.
   176  	//    For example, `admins@example.com`.
   177  	//
   178  	// * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus
   179  	// unique
   180  	//    identifier) representing a user that has been recently deleted.
   181  	// For
   182  	//    example, `alice@example.com?uid=123456789012345678901`. If the
   183  	// user is
   184  	//    recovered, this value reverts to `user:{emailid}` and the
   185  	// recovered user
   186  	//    retains the role in the binding.
   187  	//
   188  	// * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address
   189  	// (plus
   190  	//    unique identifier) representing a service account that has been
   191  	// recently
   192  	//    deleted. For example,
   193  	//
   194  	// `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
   195  	//
   196  	//    If the service account is undeleted, this value reverts to
   197  	//    `serviceAccount:{emailid}` and the undeleted service account
   198  	// retains the
   199  	//    role in the binding.
   200  	//
   201  	// * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus
   202  	// unique
   203  	//    identifier) representing a Google group that has been recently
   204  	//    deleted. For example,
   205  	// `admins@example.com?uid=123456789012345678901`. If
   206  	//    the group is recovered, this value reverts to `group:{emailid}`
   207  	// and the
   208  	//    recovered group retains the role in the binding.
   209  	//
   210  	//
   211  	// * `domain:{domain}`: The G Suite domain (primary) that represents all
   212  	// the
   213  	//    users of that domain. For example, `google.com` or
   214  	// `example.com`.
   215  	//
   216  	//
   217  	Members []string `json:"members,omitempty"`
   218  
   219  	// Role: Role that is assigned to `members`.
   220  	// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
   221  	Role string `json:"role,omitempty"`
   222  
   223  	// ForceSendFields is a list of field names (e.g. "Condition") to
   224  	// unconditionally include in API requests. By default, fields with
   225  	// empty values are omitted from API requests. However, any non-pointer,
   226  	// non-interface field appearing in ForceSendFields will be sent to the
   227  	// server regardless of whether the field is empty or not. This may be
   228  	// used to include empty fields in Patch requests.
   229  	ForceSendFields []string `json:"-"`
   230  
   231  	// NullFields is a list of field names (e.g. "Condition") to include in
   232  	// API requests with the JSON null value. By default, fields with empty
   233  	// values are omitted from API requests. However, any field with an
   234  	// empty value appearing in NullFields will be sent to the server as
   235  	// null. It is an error if a field in this list has a non-empty value.
   236  	// This may be used to include null fields in Patch requests.
   237  	NullFields []string `json:"-"`
   238  }
   239  
   240  func (s *GoogleIamV1__Binding) MarshalJSON() ([]byte, error) {
   241  	type NoMethod GoogleIamV1__Binding
   242  	raw := NoMethod(*s)
   243  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   244  }
   245  
   246  // GoogleIamV1__Policy: An Identity and Access Management (IAM) policy,
   247  // which specifies access
   248  // controls for Google Cloud resources.
   249  //
   250  // A `Policy` is a collection of `bindings`. A `binding` binds one or
   251  // more
   252  // `members` to a single `role`. Members can be user accounts, service
   253  // accounts,
   254  // Google groups, and domains (such as G Suite). A `role` is a named
   255  // list of
   256  // permissions; each `role` can be an IAM predefined role or a
   257  // user-created
   258  // custom role.
   259  //
   260  // Optionally, a `binding` can specify a `condition`, which is a
   261  // logical
   262  // expression that allows access to a resource only if the expression
   263  // evaluates
   264  // to `true`. A condition can add constraints based on attributes of
   265  // the
   266  // request, the resource, or both.
   267  //
   268  // **JSON example:**
   269  //
   270  //	{
   271  //	  "bindings": [
   272  //	    {
   273  //	      "role": "roles/resourcemanager.organizationAdmin",
   274  //	      "members": [
   275  //	        "user:mike@example.com",
   276  //	        "group:admins@example.com",
   277  //	        "domain:google.com",
   278  //
   279  // "serviceAccount:my-project-id@appspot.gserviceaccount.com"
   280  //
   281  //	  ]
   282  //	},
   283  //	{
   284  //	  "role": "roles/resourcemanager.organizationViewer",
   285  //	  "members": ["user:eve@example.com"],
   286  //	  "condition": {
   287  //	    "title": "expirable access",
   288  //	    "description": "Does not grant access after Sep 2020",
   289  //	    "expression": "request.time <
   290  //
   291  // timestamp('2020-10-01T00:00:00.000Z')",
   292  //
   293  //	      }
   294  //	    }
   295  //	  ],
   296  //	  "etag": "BwWWja0YfJA=",
   297  //	  "version": 3
   298  //	}
   299  //
   300  // **YAML example:**
   301  //
   302  //	bindings:
   303  //	- members:
   304  //	  - user:mike@example.com
   305  //	  - group:admins@example.com
   306  //	  - domain:google.com
   307  //	  - serviceAccount:my-project-id@appspot.gserviceaccount.com
   308  //	  role: roles/resourcemanager.organizationAdmin
   309  //	- members:
   310  //	  - user:eve@example.com
   311  //	  role: roles/resourcemanager.organizationViewer
   312  //	  condition:
   313  //	    title: expirable access
   314  //	    description: Does not grant access after Sep 2020
   315  //	    expression: request.time <
   316  //
   317  // timestamp('2020-10-01T00:00:00.000Z')
   318  //   - etag: BwWWja0YfJA=
   319  //   - version: 3
   320  //
   321  // For a description of IAM and its features, see the
   322  // [IAM documentation](https://cloud.google.com/iam/docs/).
   323  type GoogleIamV1__Policy struct {
   324  	// Bindings: Associates a list of `members` to a `role`. Optionally, may
   325  	// specify a
   326  	// `condition` that determines how and when the `bindings` are applied.
   327  	// Each
   328  	// of the `bindings` must contain at least one member.
   329  	Bindings []*GoogleIamV1__Binding `json:"bindings,omitempty"`
   330  
   331  	// Etag: `etag` is used for optimistic concurrency control as a way to
   332  	// help
   333  	// prevent simultaneous updates of a policy from overwriting each
   334  	// other.
   335  	// It is strongly suggested that systems make use of the `etag` in
   336  	// the
   337  	// read-modify-write cycle to perform policy updates in order to avoid
   338  	// race
   339  	// conditions: An `etag` is returned in the response to `getIamPolicy`,
   340  	// and
   341  	// systems are expected to put that etag in the request to
   342  	// `setIamPolicy` to
   343  	// ensure that their change will be applied to the same version of the
   344  	// policy.
   345  	//
   346  	// **Important:** If you use IAM Conditions, you must include the `etag`
   347  	// field
   348  	// whenever you call `setIamPolicy`. If you omit this field, then IAM
   349  	// allows
   350  	// you to overwrite a version `3` policy with a version `1` policy, and
   351  	// all of
   352  	// the conditions in the version `3` policy are lost.
   353  	Etag string `json:"etag,omitempty"`
   354  
   355  	// Version: Specifies the format of the policy.
   356  	//
   357  	// Valid values are `0`, `1`, and `3`. Requests that specify an invalid
   358  	// value
   359  	// are rejected.
   360  	//
   361  	// Any operation that affects conditional role bindings must specify
   362  	// version
   363  	// `3`. This requirement applies to the following operations:
   364  	//
   365  	// * Getting a policy that includes a conditional role binding
   366  	// * Adding a conditional role binding to a policy
   367  	// * Changing a conditional role binding in a policy
   368  	// * Removing any role binding, with or without a condition, from a
   369  	// policy
   370  	//   that includes conditions
   371  	//
   372  	// **Important:** If you use IAM Conditions, you must include the `etag`
   373  	// field
   374  	// whenever you call `setIamPolicy`. If you omit this field, then IAM
   375  	// allows
   376  	// you to overwrite a version `3` policy with a version `1` policy, and
   377  	// all of
   378  	// the conditions in the version `3` policy are lost.
   379  	//
   380  	// If a policy does not include any conditions, operations on that
   381  	// policy may
   382  	// specify any valid version or leave the field unset.
   383  	Version int64 `json:"version,omitempty"`
   384  
   385  	// ServerResponse contains the HTTP response code and headers from the
   386  	// server.
   387  	googleapi.ServerResponse `json:"-"`
   388  
   389  	// ForceSendFields is a list of field names (e.g. "Bindings") to
   390  	// unconditionally include in API requests. By default, fields with
   391  	// empty values are omitted from API requests. However, any non-pointer,
   392  	// non-interface field appearing in ForceSendFields will be sent to the
   393  	// server regardless of whether the field is empty or not. This may be
   394  	// used to include empty fields in Patch requests.
   395  	ForceSendFields []string `json:"-"`
   396  
   397  	// NullFields is a list of field names (e.g. "Bindings") to include in
   398  	// API requests with the JSON null value. By default, fields with empty
   399  	// values are omitted from API requests. However, any field with an
   400  	// empty value appearing in NullFields will be sent to the server as
   401  	// null. It is an error if a field in this list has a non-empty value.
   402  	// This may be used to include null fields in Patch requests.
   403  	NullFields []string `json:"-"`
   404  }
   405  
   406  func (s *GoogleIamV1__Policy) MarshalJSON() ([]byte, error) {
   407  	type NoMethod GoogleIamV1__Policy
   408  	raw := NoMethod(*s)
   409  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   410  }
   411  
   412  // GoogleIamV1__SetIamPolicyRequest: Request message for `SetIamPolicy`
   413  // method.
   414  type GoogleIamV1__SetIamPolicyRequest struct {
   415  	// Policy: REQUIRED: The complete policy to be applied to the
   416  	// `resource`. The size of
   417  	// the policy is limited to a few 10s of KB. An empty policy is a
   418  	// valid policy but certain Cloud Platform services (such as
   419  	// Projects)
   420  	// might reject them.
   421  	Policy *GoogleIamV1__Policy `json:"policy,omitempty"`
   422  
   423  	// ForceSendFields is a list of field names (e.g. "Policy") to
   424  	// unconditionally include in API requests. By default, fields with
   425  	// empty values are omitted from API requests. However, any non-pointer,
   426  	// non-interface field appearing in ForceSendFields will be sent to the
   427  	// server regardless of whether the field is empty or not. This may be
   428  	// used to include empty fields in Patch requests.
   429  	ForceSendFields []string `json:"-"`
   430  
   431  	// NullFields is a list of field names (e.g. "Policy") to include in API
   432  	// requests with the JSON null value. By default, fields with empty
   433  	// values are omitted from API requests. However, any field with an
   434  	// empty value appearing in NullFields will be sent to the server as
   435  	// null. It is an error if a field in this list has a non-empty value.
   436  	// This may be used to include null fields in Patch requests.
   437  	NullFields []string `json:"-"`
   438  }
   439  
   440  func (s *GoogleIamV1__SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
   441  	type NoMethod GoogleIamV1__SetIamPolicyRequest
   442  	raw := NoMethod(*s)
   443  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   444  }
   445  
   446  // GoogleIamV1__TestIamPermissionsRequest: Request message for
   447  // `TestIamPermissions` method.
   448  type GoogleIamV1__TestIamPermissionsRequest struct {
   449  	// Permissions: The set of permissions to check for the `resource`.
   450  	// Permissions with
   451  	// wildcards (such as '*' or 'storage.*') are not allowed. For
   452  	// more
   453  	// information see
   454  	// [IAM
   455  	// Overview](https://cloud.google.com/iam/docs/overview#permissions).
   456  	Permissions []string `json:"permissions,omitempty"`
   457  
   458  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   459  	// unconditionally include in API requests. By default, fields with
   460  	// empty values are omitted from API requests. However, any non-pointer,
   461  	// non-interface field appearing in ForceSendFields will be sent to the
   462  	// server regardless of whether the field is empty or not. This may be
   463  	// used to include empty fields in Patch requests.
   464  	ForceSendFields []string `json:"-"`
   465  
   466  	// NullFields is a list of field names (e.g. "Permissions") to include
   467  	// in API requests with the JSON null value. By default, fields with
   468  	// empty values are omitted from API requests. However, any field with
   469  	// an empty value appearing in NullFields will be sent to the server as
   470  	// null. It is an error if a field in this list has a non-empty value.
   471  	// This may be used to include null fields in Patch requests.
   472  	NullFields []string `json:"-"`
   473  }
   474  
   475  func (s *GoogleIamV1__TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
   476  	type NoMethod GoogleIamV1__TestIamPermissionsRequest
   477  	raw := NoMethod(*s)
   478  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   479  }
   480  
   481  // GoogleIamV1__TestIamPermissionsResponse: Response message for
   482  // `TestIamPermissions` method.
   483  type GoogleIamV1__TestIamPermissionsResponse struct {
   484  	// Permissions: A subset of `TestPermissionsRequest.permissions` that
   485  	// the caller is
   486  	// allowed.
   487  	Permissions []string `json:"permissions,omitempty"`
   488  
   489  	// ServerResponse contains the HTTP response code and headers from the
   490  	// server.
   491  	googleapi.ServerResponse `json:"-"`
   492  
   493  	// ForceSendFields is a list of field names (e.g. "Permissions") to
   494  	// unconditionally include in API requests. By default, fields with
   495  	// empty values are omitted from API requests. However, any non-pointer,
   496  	// non-interface field appearing in ForceSendFields will be sent to the
   497  	// server regardless of whether the field is empty or not. This may be
   498  	// used to include empty fields in Patch requests.
   499  	ForceSendFields []string `json:"-"`
   500  
   501  	// NullFields is a list of field names (e.g. "Permissions") to include
   502  	// in API requests with the JSON null value. By default, fields with
   503  	// empty values are omitted from API requests. However, any field with
   504  	// an empty value appearing in NullFields will be sent to the server as
   505  	// null. It is an error if a field in this list has a non-empty value.
   506  	// This may be used to include null fields in Patch requests.
   507  	NullFields []string `json:"-"`
   508  }
   509  
   510  func (s *GoogleIamV1__TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
   511  	type NoMethod GoogleIamV1__TestIamPermissionsResponse
   512  	raw := NoMethod(*s)
   513  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   514  }
   515  
   516  // GoogleType__Expr: Represents an expression text. Example:
   517  //
   518  //	title: "User account presence"
   519  //	description: "Determines whether the request has a user account"
   520  //	expression: "size(request.user) > 0"
   521  type GoogleType__Expr struct {
   522  	// Description: An optional description of the expression. This is a
   523  	// longer text which
   524  	// describes the expression, e.g. when hovered over it in a UI.
   525  	Description string `json:"description,omitempty"`
   526  
   527  	// Expression: Textual representation of an expression in
   528  	// Common Expression Language syntax.
   529  	//
   530  	// The application context of the containing message determines
   531  	// which
   532  	// well-known feature set of CEL is supported.
   533  	Expression string `json:"expression,omitempty"`
   534  
   535  	// Location: An optional string indicating the location of the
   536  	// expression for error
   537  	// reporting, e.g. a file name and a position in the file.
   538  	Location string `json:"location,omitempty"`
   539  
   540  	// Title: An optional title for the expression, i.e. a short string
   541  	// describing
   542  	// its purpose. This can be used e.g. in UIs which allow to enter
   543  	// the
   544  	// expression.
   545  	Title string `json:"title,omitempty"`
   546  
   547  	// ForceSendFields is a list of field names (e.g. "Description") to
   548  	// unconditionally include in API requests. By default, fields with
   549  	// empty values are omitted from API requests. However, any non-pointer,
   550  	// non-interface field appearing in ForceSendFields will be sent to the
   551  	// server regardless of whether the field is empty or not. This may be
   552  	// used to include empty fields in Patch requests.
   553  	ForceSendFields []string `json:"-"`
   554  
   555  	// NullFields is a list of field names (e.g. "Description") to include
   556  	// in API requests with the JSON null value. By default, fields with
   557  	// empty values are omitted from API requests. However, any field with
   558  	// an empty value appearing in NullFields will be sent to the server as
   559  	// null. It is an error if a field in this list has a non-empty value.
   560  	// This may be used to include null fields in Patch requests.
   561  	NullFields []string `json:"-"`
   562  }
   563  
   564  func (s *GoogleType__Expr) MarshalJSON() ([]byte, error) {
   565  	type NoMethod GoogleType__Expr
   566  	raw := NoMethod(*s)
   567  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   568  }
   569  
   570  // method id "servicebroker.getIamPolicy":
   571  
   572  type V1GetIamPolicyCall struct {
   573  	s            *Service
   574  	resource     string
   575  	urlParams_   gensupport.URLParams
   576  	ifNoneMatch_ string
   577  	ctx_         context.Context
   578  	header_      http.Header
   579  }
   580  
   581  // GetIamPolicy: Gets the access control policy for a resource.
   582  // Returns an empty policy if the resource exists and does not have a
   583  // policy
   584  // set.
   585  func (r *V1Service) GetIamPolicy(resource string) *V1GetIamPolicyCall {
   586  	c := &V1GetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   587  	c.resource = resource
   588  	return c
   589  }
   590  
   591  // OptionsRequestedPolicyVersion sets the optional parameter
   592  // "options.requestedPolicyVersion": The policy format version to be
   593  // returned.
   594  //
   595  // Valid values are 0, 1, and 3. Requests specifying an invalid value
   596  // will be
   597  // rejected.
   598  //
   599  // Requests for policies with any conditional bindings must specify
   600  // version 3.
   601  // Policies without any conditional bindings may specify any valid value
   602  // or
   603  // leave the field unset.
   604  func (c *V1GetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *V1GetIamPolicyCall {
   605  	c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
   606  	return c
   607  }
   608  
   609  // Fields allows partial responses to be retrieved. See
   610  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   611  // for more information.
   612  func (c *V1GetIamPolicyCall) Fields(s ...googleapi.Field) *V1GetIamPolicyCall {
   613  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   614  	return c
   615  }
   616  
   617  // IfNoneMatch sets the optional parameter which makes the operation
   618  // fail if the object's ETag matches the given value. This is useful for
   619  // getting updates only after the object has changed since the last
   620  // request. Use googleapi.IsNotModified to check whether the response
   621  // error from Do is the result of In-None-Match.
   622  func (c *V1GetIamPolicyCall) IfNoneMatch(entityTag string) *V1GetIamPolicyCall {
   623  	c.ifNoneMatch_ = entityTag
   624  	return c
   625  }
   626  
   627  // Context sets the context to be used in this call's Do method. Any
   628  // pending HTTP request will be aborted if the provided context is
   629  // canceled.
   630  func (c *V1GetIamPolicyCall) Context(ctx context.Context) *V1GetIamPolicyCall {
   631  	c.ctx_ = ctx
   632  	return c
   633  }
   634  
   635  // Header returns an http.Header that can be modified by the caller to
   636  // add HTTP headers to the request.
   637  func (c *V1GetIamPolicyCall) Header() http.Header {
   638  	if c.header_ == nil {
   639  		c.header_ = make(http.Header)
   640  	}
   641  	return c.header_
   642  }
   643  
   644  func (c *V1GetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
   645  	reqHeaders := make(http.Header)
   646  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
   647  	for k, v := range c.header_ {
   648  		reqHeaders[k] = v
   649  	}
   650  	reqHeaders.Set("User-Agent", c.s.userAgent())
   651  	if c.ifNoneMatch_ != "" {
   652  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   653  	}
   654  	var body io.Reader = nil
   655  	c.urlParams_.Set("alt", alt)
   656  	c.urlParams_.Set("prettyPrint", "false")
   657  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
   658  	urls += "?" + c.urlParams_.Encode()
   659  	req, err := http.NewRequest("GET", urls, body)
   660  	if err != nil {
   661  		return nil, err
   662  	}
   663  	req.Header = reqHeaders
   664  	googleapi.Expand(req.URL, map[string]string{
   665  		"resource": c.resource,
   666  	})
   667  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   668  }
   669  
   670  // Do executes the "servicebroker.getIamPolicy" call.
   671  // Exactly one of *GoogleIamV1__Policy or error will be non-nil. Any
   672  // non-2xx status code is an error. Response headers are in either
   673  // *GoogleIamV1__Policy.ServerResponse.Header or (if a response was
   674  // returned at all) in error.(*googleapi.Error).Header. Use
   675  // googleapi.IsNotModified to check whether the returned error was
   676  // because http.StatusNotModified was returned.
   677  func (c *V1GetIamPolicyCall) Do(opts ...googleapi.CallOption) (*GoogleIamV1__Policy, error) {
   678  	gensupport.SetOptions(c.urlParams_, opts...)
   679  	res, err := c.doRequest("json")
   680  	if res != nil && res.StatusCode == http.StatusNotModified {
   681  		if res.Body != nil {
   682  			res.Body.Close()
   683  		}
   684  		return nil, &googleapi.Error{
   685  			Code:   res.StatusCode,
   686  			Header: res.Header,
   687  		}
   688  	}
   689  	if err != nil {
   690  		return nil, err
   691  	}
   692  	defer googleapi.CloseBody(res)
   693  	if err := googleapi.CheckResponse(res); err != nil {
   694  		return nil, err
   695  	}
   696  	ret := &GoogleIamV1__Policy{
   697  		ServerResponse: googleapi.ServerResponse{
   698  			Header:         res.Header,
   699  			HTTPStatusCode: res.StatusCode,
   700  		},
   701  	}
   702  	target := &ret
   703  	if err := gensupport.DecodeResponse(target, res); err != nil {
   704  		return nil, err
   705  	}
   706  	return ret, nil
   707  	// {
   708  	//   "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
   709  	//   "flatPath": "v1/{v1Id}:getIamPolicy",
   710  	//   "httpMethod": "GET",
   711  	//   "id": "servicebroker.getIamPolicy",
   712  	//   "parameterOrder": [
   713  	//     "resource"
   714  	//   ],
   715  	//   "parameters": {
   716  	//     "options.requestedPolicyVersion": {
   717  	//       "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.",
   718  	//       "format": "int32",
   719  	//       "location": "query",
   720  	//       "type": "integer"
   721  	//     },
   722  	//     "resource": {
   723  	//       "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
   724  	//       "location": "path",
   725  	//       "pattern": "^.+$",
   726  	//       "required": true,
   727  	//       "type": "string"
   728  	//     }
   729  	//   },
   730  	//   "path": "v1/{+resource}:getIamPolicy",
   731  	//   "response": {
   732  	//     "$ref": "GoogleIamV1__Policy"
   733  	//   },
   734  	//   "scopes": [
   735  	//     "https://www.googleapis.com/auth/cloud-platform"
   736  	//   ]
   737  	// }
   738  
   739  }
   740  
   741  // method id "servicebroker.setIamPolicy":
   742  
   743  type V1SetIamPolicyCall struct {
   744  	s                                *Service
   745  	resource                         string
   746  	googleiamv1__setiampolicyrequest *GoogleIamV1__SetIamPolicyRequest
   747  	urlParams_                       gensupport.URLParams
   748  	ctx_                             context.Context
   749  	header_                          http.Header
   750  }
   751  
   752  // SetIamPolicy: Sets the access control policy on the specified
   753  // resource. Replaces any
   754  // existing policy.
   755  //
   756  // Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
   757  // PERMISSION_DENIED
   758  func (r *V1Service) SetIamPolicy(resource string, googleiamv1__setiampolicyrequest *GoogleIamV1__SetIamPolicyRequest) *V1SetIamPolicyCall {
   759  	c := &V1SetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   760  	c.resource = resource
   761  	c.googleiamv1__setiampolicyrequest = googleiamv1__setiampolicyrequest
   762  	return c
   763  }
   764  
   765  // Fields allows partial responses to be retrieved. See
   766  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   767  // for more information.
   768  func (c *V1SetIamPolicyCall) Fields(s ...googleapi.Field) *V1SetIamPolicyCall {
   769  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   770  	return c
   771  }
   772  
   773  // Context sets the context to be used in this call's Do method. Any
   774  // pending HTTP request will be aborted if the provided context is
   775  // canceled.
   776  func (c *V1SetIamPolicyCall) Context(ctx context.Context) *V1SetIamPolicyCall {
   777  	c.ctx_ = ctx
   778  	return c
   779  }
   780  
   781  // Header returns an http.Header that can be modified by the caller to
   782  // add HTTP headers to the request.
   783  func (c *V1SetIamPolicyCall) Header() http.Header {
   784  	if c.header_ == nil {
   785  		c.header_ = make(http.Header)
   786  	}
   787  	return c.header_
   788  }
   789  
   790  func (c *V1SetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
   791  	reqHeaders := make(http.Header)
   792  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
   793  	for k, v := range c.header_ {
   794  		reqHeaders[k] = v
   795  	}
   796  	reqHeaders.Set("User-Agent", c.s.userAgent())
   797  	var body io.Reader = nil
   798  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleiamv1__setiampolicyrequest)
   799  	if err != nil {
   800  		return nil, err
   801  	}
   802  	reqHeaders.Set("Content-Type", "application/json")
   803  	c.urlParams_.Set("alt", alt)
   804  	c.urlParams_.Set("prettyPrint", "false")
   805  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
   806  	urls += "?" + c.urlParams_.Encode()
   807  	req, err := http.NewRequest("POST", urls, body)
   808  	if err != nil {
   809  		return nil, err
   810  	}
   811  	req.Header = reqHeaders
   812  	googleapi.Expand(req.URL, map[string]string{
   813  		"resource": c.resource,
   814  	})
   815  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   816  }
   817  
   818  // Do executes the "servicebroker.setIamPolicy" call.
   819  // Exactly one of *GoogleIamV1__Policy or error will be non-nil. Any
   820  // non-2xx status code is an error. Response headers are in either
   821  // *GoogleIamV1__Policy.ServerResponse.Header or (if a response was
   822  // returned at all) in error.(*googleapi.Error).Header. Use
   823  // googleapi.IsNotModified to check whether the returned error was
   824  // because http.StatusNotModified was returned.
   825  func (c *V1SetIamPolicyCall) Do(opts ...googleapi.CallOption) (*GoogleIamV1__Policy, error) {
   826  	gensupport.SetOptions(c.urlParams_, opts...)
   827  	res, err := c.doRequest("json")
   828  	if res != nil && res.StatusCode == http.StatusNotModified {
   829  		if res.Body != nil {
   830  			res.Body.Close()
   831  		}
   832  		return nil, &googleapi.Error{
   833  			Code:   res.StatusCode,
   834  			Header: res.Header,
   835  		}
   836  	}
   837  	if err != nil {
   838  		return nil, err
   839  	}
   840  	defer googleapi.CloseBody(res)
   841  	if err := googleapi.CheckResponse(res); err != nil {
   842  		return nil, err
   843  	}
   844  	ret := &GoogleIamV1__Policy{
   845  		ServerResponse: googleapi.ServerResponse{
   846  			Header:         res.Header,
   847  			HTTPStatusCode: res.StatusCode,
   848  		},
   849  	}
   850  	target := &ret
   851  	if err := gensupport.DecodeResponse(target, res); err != nil {
   852  		return nil, err
   853  	}
   854  	return ret, nil
   855  	// {
   856  	//   "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED",
   857  	//   "flatPath": "v1/{v1Id}:setIamPolicy",
   858  	//   "httpMethod": "POST",
   859  	//   "id": "servicebroker.setIamPolicy",
   860  	//   "parameterOrder": [
   861  	//     "resource"
   862  	//   ],
   863  	//   "parameters": {
   864  	//     "resource": {
   865  	//       "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
   866  	//       "location": "path",
   867  	//       "pattern": "^.+$",
   868  	//       "required": true,
   869  	//       "type": "string"
   870  	//     }
   871  	//   },
   872  	//   "path": "v1/{+resource}:setIamPolicy",
   873  	//   "request": {
   874  	//     "$ref": "GoogleIamV1__SetIamPolicyRequest"
   875  	//   },
   876  	//   "response": {
   877  	//     "$ref": "GoogleIamV1__Policy"
   878  	//   },
   879  	//   "scopes": [
   880  	//     "https://www.googleapis.com/auth/cloud-platform"
   881  	//   ]
   882  	// }
   883  
   884  }
   885  
   886  // method id "servicebroker.testIamPermissions":
   887  
   888  type V1TestIamPermissionsCall struct {
   889  	s                                      *Service
   890  	resource                               string
   891  	googleiamv1__testiampermissionsrequest *GoogleIamV1__TestIamPermissionsRequest
   892  	urlParams_                             gensupport.URLParams
   893  	ctx_                                   context.Context
   894  	header_                                http.Header
   895  }
   896  
   897  // TestIamPermissions: Returns permissions that a caller has on the
   898  // specified resource.
   899  // If the resource does not exist, this will return an empty set
   900  // of
   901  // permissions, not a NOT_FOUND error.
   902  //
   903  // Note: This operation is designed to be used for building
   904  // permission-aware
   905  // UIs and command-line tools, not for authorization checking. This
   906  // operation
   907  // may "fail open" without warning.
   908  func (r *V1Service) TestIamPermissions(resource string, googleiamv1__testiampermissionsrequest *GoogleIamV1__TestIamPermissionsRequest) *V1TestIamPermissionsCall {
   909  	c := &V1TestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   910  	c.resource = resource
   911  	c.googleiamv1__testiampermissionsrequest = googleiamv1__testiampermissionsrequest
   912  	return c
   913  }
   914  
   915  // Fields allows partial responses to be retrieved. See
   916  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   917  // for more information.
   918  func (c *V1TestIamPermissionsCall) Fields(s ...googleapi.Field) *V1TestIamPermissionsCall {
   919  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   920  	return c
   921  }
   922  
   923  // Context sets the context to be used in this call's Do method. Any
   924  // pending HTTP request will be aborted if the provided context is
   925  // canceled.
   926  func (c *V1TestIamPermissionsCall) Context(ctx context.Context) *V1TestIamPermissionsCall {
   927  	c.ctx_ = ctx
   928  	return c
   929  }
   930  
   931  // Header returns an http.Header that can be modified by the caller to
   932  // add HTTP headers to the request.
   933  func (c *V1TestIamPermissionsCall) Header() http.Header {
   934  	if c.header_ == nil {
   935  		c.header_ = make(http.Header)
   936  	}
   937  	return c.header_
   938  }
   939  
   940  func (c *V1TestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
   941  	reqHeaders := make(http.Header)
   942  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
   943  	for k, v := range c.header_ {
   944  		reqHeaders[k] = v
   945  	}
   946  	reqHeaders.Set("User-Agent", c.s.userAgent())
   947  	var body io.Reader = nil
   948  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googleiamv1__testiampermissionsrequest)
   949  	if err != nil {
   950  		return nil, err
   951  	}
   952  	reqHeaders.Set("Content-Type", "application/json")
   953  	c.urlParams_.Set("alt", alt)
   954  	c.urlParams_.Set("prettyPrint", "false")
   955  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
   956  	urls += "?" + c.urlParams_.Encode()
   957  	req, err := http.NewRequest("POST", urls, body)
   958  	if err != nil {
   959  		return nil, err
   960  	}
   961  	req.Header = reqHeaders
   962  	googleapi.Expand(req.URL, map[string]string{
   963  		"resource": c.resource,
   964  	})
   965  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   966  }
   967  
   968  // Do executes the "servicebroker.testIamPermissions" call.
   969  // Exactly one of *GoogleIamV1__TestIamPermissionsResponse or error will
   970  // be non-nil. Any non-2xx status code is an error. Response headers are
   971  // in either
   972  // *GoogleIamV1__TestIamPermissionsResponse.ServerResponse.Header or (if
   973  // a response was returned at all) in error.(*googleapi.Error).Header.
   974  // Use googleapi.IsNotModified to check whether the returned error was
   975  // because http.StatusNotModified was returned.
   976  func (c *V1TestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*GoogleIamV1__TestIamPermissionsResponse, error) {
   977  	gensupport.SetOptions(c.urlParams_, opts...)
   978  	res, err := c.doRequest("json")
   979  	if res != nil && res.StatusCode == http.StatusNotModified {
   980  		if res.Body != nil {
   981  			res.Body.Close()
   982  		}
   983  		return nil, &googleapi.Error{
   984  			Code:   res.StatusCode,
   985  			Header: res.Header,
   986  		}
   987  	}
   988  	if err != nil {
   989  		return nil, err
   990  	}
   991  	defer googleapi.CloseBody(res)
   992  	if err := googleapi.CheckResponse(res); err != nil {
   993  		return nil, err
   994  	}
   995  	ret := &GoogleIamV1__TestIamPermissionsResponse{
   996  		ServerResponse: googleapi.ServerResponse{
   997  			Header:         res.Header,
   998  			HTTPStatusCode: res.StatusCode,
   999  		},
  1000  	}
  1001  	target := &ret
  1002  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1003  		return nil, err
  1004  	}
  1005  	return ret, nil
  1006  	// {
  1007  	//   "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
  1008  	//   "flatPath": "v1/{v1Id}:testIamPermissions",
  1009  	//   "httpMethod": "POST",
  1010  	//   "id": "servicebroker.testIamPermissions",
  1011  	//   "parameterOrder": [
  1012  	//     "resource"
  1013  	//   ],
  1014  	//   "parameters": {
  1015  	//     "resource": {
  1016  	//       "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1017  	//       "location": "path",
  1018  	//       "pattern": "^.+$",
  1019  	//       "required": true,
  1020  	//       "type": "string"
  1021  	//     }
  1022  	//   },
  1023  	//   "path": "v1/{+resource}:testIamPermissions",
  1024  	//   "request": {
  1025  	//     "$ref": "GoogleIamV1__TestIamPermissionsRequest"
  1026  	//   },
  1027  	//   "response": {
  1028  	//     "$ref": "GoogleIamV1__TestIamPermissionsResponse"
  1029  	//   },
  1030  	//   "scopes": [
  1031  	//     "https://www.googleapis.com/auth/cloud-platform"
  1032  	//   ]
  1033  	// }
  1034  
  1035  }
  1036  

View as plain text