You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

914 lines
31 KiB

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