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.
 
 
 

4103 lines
139 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 accesscontextmanager provides access to the Access Context Manager API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/access-context-manager/docs/reference/rest/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/accesscontextmanager/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // accesscontextmanagerService, err := accesscontextmanager.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. // accesscontextmanagerService, err := accesscontextmanager.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. // accesscontextmanagerService, err := accesscontextmanager.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 accesscontextmanager // import "google.golang.org/api/accesscontextmanager/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 = "accesscontextmanager:v1"
  67. const apiName = "accesscontextmanager"
  68. const apiVersion = "v1"
  69. const basePath = "https://accesscontextmanager.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.AccessPolicies = NewAccessPoliciesService(s)
  106. s.Operations = NewOperationsService(s)
  107. return s, nil
  108. }
  109. type Service struct {
  110. client *http.Client
  111. BasePath string // API endpoint base URL
  112. UserAgent string // optional additional User-Agent fragment
  113. AccessPolicies *AccessPoliciesService
  114. Operations *OperationsService
  115. }
  116. func (s *Service) userAgent() string {
  117. if s.UserAgent == "" {
  118. return googleapi.UserAgent
  119. }
  120. return googleapi.UserAgent + " " + s.UserAgent
  121. }
  122. func NewAccessPoliciesService(s *Service) *AccessPoliciesService {
  123. rs := &AccessPoliciesService{s: s}
  124. rs.AccessLevels = NewAccessPoliciesAccessLevelsService(s)
  125. rs.ServicePerimeters = NewAccessPoliciesServicePerimetersService(s)
  126. return rs
  127. }
  128. type AccessPoliciesService struct {
  129. s *Service
  130. AccessLevels *AccessPoliciesAccessLevelsService
  131. ServicePerimeters *AccessPoliciesServicePerimetersService
  132. }
  133. func NewAccessPoliciesAccessLevelsService(s *Service) *AccessPoliciesAccessLevelsService {
  134. rs := &AccessPoliciesAccessLevelsService{s: s}
  135. return rs
  136. }
  137. type AccessPoliciesAccessLevelsService struct {
  138. s *Service
  139. }
  140. func NewAccessPoliciesServicePerimetersService(s *Service) *AccessPoliciesServicePerimetersService {
  141. rs := &AccessPoliciesServicePerimetersService{s: s}
  142. return rs
  143. }
  144. type AccessPoliciesServicePerimetersService struct {
  145. s *Service
  146. }
  147. func NewOperationsService(s *Service) *OperationsService {
  148. rs := &OperationsService{s: s}
  149. return rs
  150. }
  151. type OperationsService struct {
  152. s *Service
  153. }
  154. // AccessLevel: An `AccessLevel` is a label that can be applied to
  155. // requests to GCP services,
  156. // along with a list of requirements necessary for the label to be
  157. // applied.
  158. type AccessLevel struct {
  159. // Basic: A `BasicLevel` composed of `Conditions`.
  160. Basic *BasicLevel `json:"basic,omitempty"`
  161. // CreateTime: Output only. Time the `AccessLevel` was created in UTC.
  162. CreateTime string `json:"createTime,omitempty"`
  163. // Description: Description of the `AccessLevel` and its use. Does not
  164. // affect behavior.
  165. Description string `json:"description,omitempty"`
  166. // Name: Required. Resource name for the Access Level. The `short_name`
  167. // component
  168. // must begin with a letter and only include alphanumeric and '_'.
  169. // Format:
  170. // `accessPolicies/{policy_id}/accessLevels/{short_name}`
  171. Name string `json:"name,omitempty"`
  172. // Title: Human readable title. Must be unique within the Policy.
  173. Title string `json:"title,omitempty"`
  174. // UpdateTime: Output only. Time the `AccessLevel` was updated in UTC.
  175. UpdateTime string `json:"updateTime,omitempty"`
  176. // ServerResponse contains the HTTP response code and headers from the
  177. // server.
  178. googleapi.ServerResponse `json:"-"`
  179. // ForceSendFields is a list of field names (e.g. "Basic") to
  180. // unconditionally include in API requests. By default, fields with
  181. // empty values are omitted from API requests. However, any non-pointer,
  182. // non-interface field appearing in ForceSendFields will be sent to the
  183. // server regardless of whether the field is empty or not. This may be
  184. // used to include empty fields in Patch requests.
  185. ForceSendFields []string `json:"-"`
  186. // NullFields is a list of field names (e.g. "Basic") to include in API
  187. // requests with the JSON null value. By default, fields with empty
  188. // values are omitted from API requests. However, any field with an
  189. // empty value appearing in NullFields will be sent to the server as
  190. // null. It is an error if a field in this list has a non-empty value.
  191. // This may be used to include null fields in Patch requests.
  192. NullFields []string `json:"-"`
  193. }
  194. func (s *AccessLevel) MarshalJSON() ([]byte, error) {
  195. type NoMethod AccessLevel
  196. raw := NoMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  198. }
  199. // AccessPolicy: `AccessPolicy` is a container for `AccessLevels` (which
  200. // define the necessary
  201. // attributes to use GCP services) and `ServicePerimeters` (which define
  202. // regions
  203. // of services able to freely pass data within a perimeter). An access
  204. // policy is
  205. // globally visible within an organization, and the restrictions it
  206. // specifies
  207. // apply to all projects within an organization.
  208. type AccessPolicy struct {
  209. // CreateTime: Output only. Time the `AccessPolicy` was created in UTC.
  210. CreateTime string `json:"createTime,omitempty"`
  211. // Name: Output only. Resource name of the `AccessPolicy`.
  212. // Format:
  213. // `accessPolicies/{policy_id}`
  214. Name string `json:"name,omitempty"`
  215. // Parent: Required. The parent of this `AccessPolicy` in the Cloud
  216. // Resource
  217. // Hierarchy. Currently immutable once created.
  218. // Format:
  219. // `organizations/{organization_id}`
  220. Parent string `json:"parent,omitempty"`
  221. // Title: Required. Human readable title. Does not affect behavior.
  222. Title string `json:"title,omitempty"`
  223. // UpdateTime: Output only. Time the `AccessPolicy` was updated in UTC.
  224. UpdateTime string `json:"updateTime,omitempty"`
  225. // ServerResponse contains the HTTP response code and headers from the
  226. // server.
  227. googleapi.ServerResponse `json:"-"`
  228. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  229. // unconditionally include in API requests. By default, fields with
  230. // empty values are omitted from API requests. However, any non-pointer,
  231. // non-interface field appearing in ForceSendFields will be sent to the
  232. // server regardless of whether the field is empty or not. This may be
  233. // used to include empty fields in Patch requests.
  234. ForceSendFields []string `json:"-"`
  235. // NullFields is a list of field names (e.g. "CreateTime") to include in
  236. // API requests with the JSON null value. By default, fields with empty
  237. // values are omitted from API requests. However, any field with an
  238. // empty value appearing in NullFields will be sent to the server as
  239. // null. It is an error if a field in this list has a non-empty value.
  240. // This may be used to include null fields in Patch requests.
  241. NullFields []string `json:"-"`
  242. }
  243. func (s *AccessPolicy) MarshalJSON() ([]byte, error) {
  244. type NoMethod AccessPolicy
  245. raw := NoMethod(*s)
  246. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  247. }
  248. // BasicLevel: `BasicLevel` is an `AccessLevel` using a set of
  249. // recommended features.
  250. type BasicLevel struct {
  251. // CombiningFunction: How the `conditions` list should be combined to
  252. // determine if a request is
  253. // granted this `AccessLevel`. If AND is used, each `Condition`
  254. // in
  255. // `conditions` must be satisfied for the `AccessLevel` to be applied.
  256. // If OR
  257. // is used, at least one `Condition` in `conditions` must be satisfied
  258. // for the
  259. // `AccessLevel` to be applied. Default behavior is AND.
  260. //
  261. // Possible values:
  262. // "AND" - All `Conditions` must be true for the `BasicLevel` to be
  263. // true.
  264. // "OR" - If at least one `Condition` is true, then the `BasicLevel`
  265. // is true.
  266. CombiningFunction string `json:"combiningFunction,omitempty"`
  267. // Conditions: Required. A list of requirements for the `AccessLevel` to
  268. // be granted.
  269. Conditions []*Condition `json:"conditions,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "CombiningFunction")
  271. // to unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. // NullFields is a list of field names (e.g. "CombiningFunction") to
  278. // include in API requests with the JSON null value. By default, fields
  279. // with empty values are omitted from API requests. However, any field
  280. // with an empty value appearing in NullFields will be sent to the
  281. // server as null. It is an error if a field in this list has a
  282. // non-empty value. This may be used to include null fields in Patch
  283. // requests.
  284. NullFields []string `json:"-"`
  285. }
  286. func (s *BasicLevel) MarshalJSON() ([]byte, error) {
  287. type NoMethod BasicLevel
  288. raw := NoMethod(*s)
  289. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  290. }
  291. // CancelOperationRequest: The request message for
  292. // Operations.CancelOperation.
  293. type CancelOperationRequest struct {
  294. }
  295. // Condition: A condition necessary for an `AccessLevel` to be granted.
  296. // The Condition is an
  297. // AND over its fields. So a Condition is true if: 1) the request IP is
  298. // from one
  299. // of the listed subnetworks AND 2) the originating device complies with
  300. // the
  301. // listed device policy AND 3) all listed access levels are granted AND
  302. // 4) the
  303. // request was sent at a time allowed by the DateTimeRestriction.
  304. type Condition struct {
  305. // DevicePolicy: Device specific restrictions, all restrictions must
  306. // hold for the
  307. // Condition to be true. If not specified, all devices are allowed.
  308. DevicePolicy *DevicePolicy `json:"devicePolicy,omitempty"`
  309. // IpSubnetworks: CIDR block IP subnetwork specification. May be IPv4 or
  310. // IPv6. Note that for
  311. // a CIDR IP address block, the specified IP address portion must be
  312. // properly
  313. // truncated (i.e. all the host bits must be zero) or the input is
  314. // considered
  315. // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24"
  316. // is
  317. // not. Similarly, for IPv6, "2001:db8::/32" is accepted
  318. // whereas
  319. // "2001:db8::1/32" is not. The originating IP of a request must be in
  320. // one of
  321. // the listed subnets in order for this Condition to be true. If empty,
  322. // all IP
  323. // addresses are allowed.
  324. IpSubnetworks []string `json:"ipSubnetworks,omitempty"`
  325. // Members: The request must be made by one of the provided user or
  326. // service
  327. // accounts. Groups are not
  328. // supported.
  329. // Syntax:
  330. // `user:{emailid}`
  331. // `serviceAccount:{emailid}`
  332. // If not specified, a request may come from any user.
  333. Members []string `json:"members,omitempty"`
  334. // Negate: Whether to negate the Condition. If true, the Condition
  335. // becomes a NAND over
  336. // its non-empty fields, each field must be false for the Condition
  337. // overall to
  338. // be satisfied. Defaults to false.
  339. Negate bool `json:"negate,omitempty"`
  340. // Regions: The request must originate from one of the provided
  341. // countries/regions.
  342. // Must be valid ISO 3166-1 alpha-2 codes.
  343. Regions []string `json:"regions,omitempty"`
  344. // RequiredAccessLevels: A list of other access levels defined in the
  345. // same `Policy`, referenced by
  346. // resource name. Referencing an `AccessLevel` which does not exist is
  347. // an
  348. // error. All access levels listed must be granted for the Condition
  349. // to be true.
  350. // Example:
  351. // "accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"
  352. RequiredAccessLevels []string `json:"requiredAccessLevels,omitempty"`
  353. // ForceSendFields is a list of field names (e.g. "DevicePolicy") to
  354. // unconditionally include in API requests. By default, fields with
  355. // empty values are omitted from API requests. However, any non-pointer,
  356. // non-interface field appearing in ForceSendFields will be sent to the
  357. // server regardless of whether the field is empty or not. This may be
  358. // used to include empty fields in Patch requests.
  359. ForceSendFields []string `json:"-"`
  360. // NullFields is a list of field names (e.g. "DevicePolicy") to include
  361. // in API requests with the JSON null value. By default, fields with
  362. // empty values are omitted from API requests. However, any field with
  363. // an empty value appearing in NullFields will be sent to the server as
  364. // null. It is an error if a field in this list has a non-empty value.
  365. // This may be used to include null fields in Patch requests.
  366. NullFields []string `json:"-"`
  367. }
  368. func (s *Condition) MarshalJSON() ([]byte, error) {
  369. type NoMethod Condition
  370. raw := NoMethod(*s)
  371. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  372. }
  373. // DevicePolicy: `DevicePolicy` specifies device specific restrictions
  374. // necessary to acquire a
  375. // given access level. A `DevicePolicy` specifies requirements for
  376. // requests from
  377. // devices to be granted access levels, it does not do any enforcement
  378. // on the
  379. // device. `DevicePolicy` acts as an AND over all specified fields, and
  380. // each
  381. // repeated field is an OR over its elements. Any unset fields are
  382. // ignored. For
  383. // example, if the proto is { os_type : DESKTOP_WINDOWS, os_type
  384. // :
  385. // DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy
  386. // will be
  387. // true for requests originating from encrypted Linux desktops and
  388. // encrypted
  389. // Windows desktops.
  390. type DevicePolicy struct {
  391. // AllowedDeviceManagementLevels: Allowed device management levels, an
  392. // empty list allows all management
  393. // levels.
  394. //
  395. // Possible values:
  396. // "MANAGEMENT_UNSPECIFIED" - The device's management level is not
  397. // specified or not known.
  398. // "NONE" - The device is not managed.
  399. // "BASIC" - Basic management is enabled, which is generally limited
  400. // to monitoring and
  401. // wiping the corporate account.
  402. // "COMPLETE" - Complete device management. This includes more
  403. // thorough monitoring and the
  404. // ability to directly manage the device (such as remote wiping). This
  405. // can be
  406. // enabled through the Android Enterprise Platform.
  407. AllowedDeviceManagementLevels []string `json:"allowedDeviceManagementLevels,omitempty"`
  408. // AllowedEncryptionStatuses: Allowed encryptions statuses, an empty
  409. // list allows all statuses.
  410. //
  411. // Possible values:
  412. // "ENCRYPTION_UNSPECIFIED" - The encryption status of the device is
  413. // not specified or not known.
  414. // "ENCRYPTION_UNSUPPORTED" - The device does not support encryption.
  415. // "UNENCRYPTED" - The device supports encryption, but is currently
  416. // unencrypted.
  417. // "ENCRYPTED" - The device is encrypted.
  418. AllowedEncryptionStatuses []string `json:"allowedEncryptionStatuses,omitempty"`
  419. // OsConstraints: Allowed OS versions, an empty list allows all types
  420. // and all versions.
  421. OsConstraints []*OsConstraint `json:"osConstraints,omitempty"`
  422. // RequireAdminApproval: Whether the device needs to be approved by the
  423. // customer admin.
  424. RequireAdminApproval bool `json:"requireAdminApproval,omitempty"`
  425. // RequireCorpOwned: Whether the device needs to be corp owned.
  426. RequireCorpOwned bool `json:"requireCorpOwned,omitempty"`
  427. // RequireScreenlock: Whether or not screenlock is required for the
  428. // DevicePolicy to be true.
  429. // Defaults to `false`.
  430. RequireScreenlock bool `json:"requireScreenlock,omitempty"`
  431. // ForceSendFields is a list of field names (e.g.
  432. // "AllowedDeviceManagementLevels") to unconditionally include in API
  433. // requests. By default, fields with empty values are omitted from API
  434. // requests. However, any non-pointer, non-interface field appearing in
  435. // ForceSendFields will be sent to the server regardless of whether the
  436. // field is empty or not. This may be used to include empty fields in
  437. // Patch requests.
  438. ForceSendFields []string `json:"-"`
  439. // NullFields is a list of field names (e.g.
  440. // "AllowedDeviceManagementLevels") to include in API requests with the
  441. // JSON null value. By default, fields with empty values are omitted
  442. // from API requests. However, any field with an empty value appearing
  443. // in NullFields will be sent to the server as null. It is an error if a
  444. // field in this list has a non-empty value. This may be used to include
  445. // null fields in Patch requests.
  446. NullFields []string `json:"-"`
  447. }
  448. func (s *DevicePolicy) MarshalJSON() ([]byte, error) {
  449. type NoMethod DevicePolicy
  450. raw := NoMethod(*s)
  451. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  452. }
  453. // Empty: A generic empty message that you can re-use to avoid defining
  454. // duplicated
  455. // empty messages in your APIs. A typical example is to use it as the
  456. // request
  457. // or the response type of an API method. For instance:
  458. //
  459. // service Foo {
  460. // rpc Bar(google.protobuf.Empty) returns
  461. // (google.protobuf.Empty);
  462. // }
  463. //
  464. // The JSON representation for `Empty` is empty JSON object `{}`.
  465. type Empty struct {
  466. // ServerResponse contains the HTTP response code and headers from the
  467. // server.
  468. googleapi.ServerResponse `json:"-"`
  469. }
  470. // ListAccessLevelsResponse: A response to `ListAccessLevelsRequest`.
  471. type ListAccessLevelsResponse struct {
  472. // AccessLevels: List of the Access Level instances.
  473. AccessLevels []*AccessLevel `json:"accessLevels,omitempty"`
  474. // NextPageToken: The pagination token to retrieve the next page of
  475. // results. If the value is
  476. // empty, no further results remain.
  477. NextPageToken string `json:"nextPageToken,omitempty"`
  478. // ServerResponse contains the HTTP response code and headers from the
  479. // server.
  480. googleapi.ServerResponse `json:"-"`
  481. // ForceSendFields is a list of field names (e.g. "AccessLevels") to
  482. // unconditionally include in API requests. By default, fields with
  483. // empty values are omitted from API requests. However, any non-pointer,
  484. // non-interface field appearing in ForceSendFields will be sent to the
  485. // server regardless of whether the field is empty or not. This may be
  486. // used to include empty fields in Patch requests.
  487. ForceSendFields []string `json:"-"`
  488. // NullFields is a list of field names (e.g. "AccessLevels") to include
  489. // in API requests with the JSON null value. By default, fields with
  490. // empty values are omitted from API requests. However, any field with
  491. // an empty value appearing in NullFields will be sent to the server as
  492. // null. It is an error if a field in this list has a non-empty value.
  493. // This may be used to include null fields in Patch requests.
  494. NullFields []string `json:"-"`
  495. }
  496. func (s *ListAccessLevelsResponse) MarshalJSON() ([]byte, error) {
  497. type NoMethod ListAccessLevelsResponse
  498. raw := NoMethod(*s)
  499. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  500. }
  501. // ListAccessPoliciesResponse: A response to
  502. // `ListAccessPoliciesRequest`.
  503. type ListAccessPoliciesResponse struct {
  504. // AccessPolicies: List of the AccessPolicy instances.
  505. AccessPolicies []*AccessPolicy `json:"accessPolicies,omitempty"`
  506. // NextPageToken: The pagination token to retrieve the next page of
  507. // results. If the value is
  508. // empty, no further results remain.
  509. NextPageToken string `json:"nextPageToken,omitempty"`
  510. // ServerResponse contains the HTTP response code and headers from the
  511. // server.
  512. googleapi.ServerResponse `json:"-"`
  513. // ForceSendFields is a list of field names (e.g. "AccessPolicies") to
  514. // unconditionally include in API requests. By default, fields with
  515. // empty values are omitted from API requests. However, any non-pointer,
  516. // non-interface field appearing in ForceSendFields will be sent to the
  517. // server regardless of whether the field is empty or not. This may be
  518. // used to include empty fields in Patch requests.
  519. ForceSendFields []string `json:"-"`
  520. // NullFields is a list of field names (e.g. "AccessPolicies") to
  521. // include in API requests with the JSON null value. By default, fields
  522. // with empty values are omitted from API requests. However, any field
  523. // with an empty value appearing in NullFields will be sent to the
  524. // server as null. It is an error if a field in this list has a
  525. // non-empty value. This may be used to include null fields in Patch
  526. // requests.
  527. NullFields []string `json:"-"`
  528. }
  529. func (s *ListAccessPoliciesResponse) MarshalJSON() ([]byte, error) {
  530. type NoMethod ListAccessPoliciesResponse
  531. raw := NoMethod(*s)
  532. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  533. }
  534. // ListOperationsResponse: The response message for
  535. // Operations.ListOperations.
  536. type ListOperationsResponse struct {
  537. // NextPageToken: The standard List next-page token.
  538. NextPageToken string `json:"nextPageToken,omitempty"`
  539. // Operations: A list of operations that matches the specified filter in
  540. // the request.
  541. Operations []*Operation `json:"operations,omitempty"`
  542. // ServerResponse contains the HTTP response code and headers from the
  543. // server.
  544. googleapi.ServerResponse `json:"-"`
  545. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  546. // unconditionally include in API requests. By default, fields with
  547. // empty values are omitted from API requests. However, any non-pointer,
  548. // non-interface field appearing in ForceSendFields will be sent to the
  549. // server regardless of whether the field is empty or not. This may be
  550. // used to include empty fields in Patch requests.
  551. ForceSendFields []string `json:"-"`
  552. // NullFields is a list of field names (e.g. "NextPageToken") to include
  553. // in API requests with the JSON null value. By default, fields with
  554. // empty values are omitted from API requests. However, any field with
  555. // an empty value appearing in NullFields will be sent to the server as
  556. // null. It is an error if a field in this list has a non-empty value.
  557. // This may be used to include null fields in Patch requests.
  558. NullFields []string `json:"-"`
  559. }
  560. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  561. type NoMethod ListOperationsResponse
  562. raw := NoMethod(*s)
  563. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  564. }
  565. // ListServicePerimetersResponse: A response to
  566. // `ListServicePerimetersRequest`.
  567. type ListServicePerimetersResponse struct {
  568. // NextPageToken: The pagination token to retrieve the next page of
  569. // results. If the value is
  570. // empty, no further results remain.
  571. NextPageToken string `json:"nextPageToken,omitempty"`
  572. // ServicePerimeters: List of the Service Perimeter instances.
  573. ServicePerimeters []*ServicePerimeter `json:"servicePerimeters,omitempty"`
  574. // ServerResponse contains the HTTP response code and headers from the
  575. // server.
  576. googleapi.ServerResponse `json:"-"`
  577. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  578. // unconditionally include in API requests. By default, fields with
  579. // empty values are omitted from API requests. However, any non-pointer,
  580. // non-interface field appearing in ForceSendFields will be sent to the
  581. // server regardless of whether the field is empty or not. This may be
  582. // used to include empty fields in Patch requests.
  583. ForceSendFields []string `json:"-"`
  584. // NullFields is a list of field names (e.g. "NextPageToken") to include
  585. // in API requests with the JSON null value. By default, fields with
  586. // empty values are omitted from API requests. However, any field with
  587. // an empty value appearing in NullFields will be sent to the server as
  588. // null. It is an error if a field in this list has a non-empty value.
  589. // This may be used to include null fields in Patch requests.
  590. NullFields []string `json:"-"`
  591. }
  592. func (s *ListServicePerimetersResponse) MarshalJSON() ([]byte, error) {
  593. type NoMethod ListServicePerimetersResponse
  594. raw := NoMethod(*s)
  595. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  596. }
  597. // Operation: This resource represents a long-running operation that is
  598. // the result of a
  599. // network API call.
  600. type Operation struct {
  601. // Done: If the value is `false`, it means the operation is still in
  602. // progress.
  603. // If `true`, the operation is completed, and either `error` or
  604. // `response` is
  605. // available.
  606. Done bool `json:"done,omitempty"`
  607. // Error: The error result of the operation in case of failure or
  608. // cancellation.
  609. Error *Status `json:"error,omitempty"`
  610. // Metadata: Service-specific metadata associated with the operation.
  611. // It typically
  612. // contains progress information and common metadata such as create
  613. // time.
  614. // Some services might not provide such metadata. Any method that
  615. // returns a
  616. // long-running operation should document the metadata type, if any.
  617. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  618. // Name: The server-assigned name, which is only unique within the same
  619. // service that
  620. // originally returns it. If you use the default HTTP mapping,
  621. // the
  622. // `name` should have the format of `operations/some/unique/name`.
  623. Name string `json:"name,omitempty"`
  624. // Response: The normal response of the operation in case of success.
  625. // If the original
  626. // method returns no data on success, such as `Delete`, the response
  627. // is
  628. // `google.protobuf.Empty`. If the original method is
  629. // standard
  630. // `Get`/`Create`/`Update`, the response should be the resource. For
  631. // other
  632. // methods, the response should have the type `XxxResponse`, where
  633. // `Xxx`
  634. // is the original method name. For example, if the original method
  635. // name
  636. // is `TakeSnapshot()`, the inferred response type
  637. // is
  638. // `TakeSnapshotResponse`.
  639. Response googleapi.RawMessage `json:"response,omitempty"`
  640. // ServerResponse contains the HTTP response code and headers from the
  641. // server.
  642. googleapi.ServerResponse `json:"-"`
  643. // ForceSendFields is a list of field names (e.g. "Done") to
  644. // unconditionally include in API requests. By default, fields with
  645. // empty values are omitted from API requests. However, any non-pointer,
  646. // non-interface field appearing in ForceSendFields will be sent to the
  647. // server regardless of whether the field is empty or not. This may be
  648. // used to include empty fields in Patch requests.
  649. ForceSendFields []string `json:"-"`
  650. // NullFields is a list of field names (e.g. "Done") to include in API
  651. // requests with the JSON null value. By default, fields with empty
  652. // values are omitted from API requests. However, any field with an
  653. // empty value appearing in NullFields will be sent to the server as
  654. // null. It is an error if a field in this list has a non-empty value.
  655. // This may be used to include null fields in Patch requests.
  656. NullFields []string `json:"-"`
  657. }
  658. func (s *Operation) MarshalJSON() ([]byte, error) {
  659. type NoMethod Operation
  660. raw := NoMethod(*s)
  661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  662. }
  663. // OsConstraint: A restriction on the OS type and version of devices
  664. // making requests.
  665. type OsConstraint struct {
  666. // MinimumVersion: The minimum allowed OS version. If not set, any
  667. // version of this OS
  668. // satisfies the constraint. Format: "major.minor.patch".
  669. // Examples: "10.5.301", "9.2.1".
  670. MinimumVersion string `json:"minimumVersion,omitempty"`
  671. // OsType: Required. The allowed OS type.
  672. //
  673. // Possible values:
  674. // "OS_UNSPECIFIED" - The operating system of the device is not
  675. // specified or not known.
  676. // "DESKTOP_MAC" - A desktop Mac operating system.
  677. // "DESKTOP_WINDOWS" - A desktop Windows operating system.
  678. // "DESKTOP_LINUX" - A desktop Linux operating system.
  679. // "DESKTOP_CHROME_OS" - A desktop ChromeOS operating system.
  680. OsType string `json:"osType,omitempty"`
  681. // RequireVerifiedChromeOs: Only allows requests from devices with a
  682. // verified Chrome OS.
  683. // Verifications includes requirements that the device is
  684. // enterprise-managed,
  685. // conformant to Dasher domain policies, and the caller has permission
  686. // to call
  687. // the API targeted by the request.
  688. RequireVerifiedChromeOs bool `json:"requireVerifiedChromeOs,omitempty"`
  689. // ForceSendFields is a list of field names (e.g. "MinimumVersion") to
  690. // unconditionally include in API requests. By default, fields with
  691. // empty values are omitted from API requests. However, any non-pointer,
  692. // non-interface field appearing in ForceSendFields will be sent to the
  693. // server regardless of whether the field is empty or not. This may be
  694. // used to include empty fields in Patch requests.
  695. ForceSendFields []string `json:"-"`
  696. // NullFields is a list of field names (e.g. "MinimumVersion") to
  697. // include in API requests with the JSON null value. By default, fields
  698. // with empty values are omitted from API requests. However, any field
  699. // with an empty value appearing in NullFields will be sent to the
  700. // server as null. It is an error if a field in this list has a
  701. // non-empty value. This may be used to include null fields in Patch
  702. // requests.
  703. NullFields []string `json:"-"`
  704. }
  705. func (s *OsConstraint) MarshalJSON() ([]byte, error) {
  706. type NoMethod OsConstraint
  707. raw := NoMethod(*s)
  708. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  709. }
  710. // ServicePerimeter: `ServicePerimeter` describes a set of GCP resources
  711. // which can freely import
  712. // and export data amongst themselves, but not export outside of
  713. // the
  714. // `ServicePerimeter`. If a request with a source within this
  715. // `ServicePerimeter`
  716. // has a target outside of the `ServicePerimeter`, the request will be
  717. // blocked.
  718. // Otherwise the request is allowed. There are two types of Service
  719. // Perimeter -
  720. // Regular and Bridge. Regular Service Perimeters cannot overlap, a
  721. // single GCP
  722. // project can only belong to a single regular Service Perimeter.
  723. // Service
  724. // Perimeter Bridges can contain only GCP projects as members, a single
  725. // GCP
  726. // project may belong to multiple Service Perimeter Bridges.
  727. type ServicePerimeter struct {
  728. // CreateTime: Output only. Time the `ServicePerimeter` was created in
  729. // UTC.
  730. CreateTime string `json:"createTime,omitempty"`
  731. // Description: Description of the `ServicePerimeter` and its use. Does
  732. // not affect
  733. // behavior.
  734. Description string `json:"description,omitempty"`
  735. // Name: Required. Resource name for the ServicePerimeter. The
  736. // `short_name`
  737. // component must begin with a letter and only include alphanumeric and
  738. // '_'.
  739. // Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}`
  740. Name string `json:"name,omitempty"`
  741. // PerimeterType: Perimeter type indicator. A single project is
  742. // allowed to be a member of single regular perimeter, but multiple
  743. // service
  744. // perimeter bridges. A project cannot be a included in a perimeter
  745. // bridge
  746. // without being included in regular perimeter. For perimeter
  747. // bridges,
  748. // the restricted service list as well as access level lists must
  749. // be
  750. // empty.
  751. //
  752. // Possible values:
  753. // "PERIMETER_TYPE_REGULAR" - Regular Perimeter.
  754. // "PERIMETER_TYPE_BRIDGE" - Perimeter Bridge.
  755. PerimeterType string `json:"perimeterType,omitempty"`
  756. // Status: Current ServicePerimeter configuration. Specifies sets of
  757. // resources,
  758. // restricted services and access levels that determine
  759. // perimeter
  760. // content and boundaries.
  761. Status *ServicePerimeterConfig `json:"status,omitempty"`
  762. // Title: Human readable title. Must be unique within the Policy.
  763. Title string `json:"title,omitempty"`
  764. // UpdateTime: Output only. Time the `ServicePerimeter` was updated in
  765. // UTC.
  766. UpdateTime string `json:"updateTime,omitempty"`
  767. // ServerResponse contains the HTTP response code and headers from the
  768. // server.
  769. googleapi.ServerResponse `json:"-"`
  770. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  771. // unconditionally include in API requests. By default, fields with
  772. // empty values are omitted from API requests. However, any non-pointer,
  773. // non-interface field appearing in ForceSendFields will be sent to the
  774. // server regardless of whether the field is empty or not. This may be
  775. // used to include empty fields in Patch requests.
  776. ForceSendFields []string `json:"-"`
  777. // NullFields is a list of field names (e.g. "CreateTime") to include in
  778. // API requests with the JSON null value. By default, fields with empty
  779. // values are omitted from API requests. However, any field with an
  780. // empty value appearing in NullFields will be sent to the server as
  781. // null. It is an error if a field in this list has a non-empty value.
  782. // This may be used to include null fields in Patch requests.
  783. NullFields []string `json:"-"`
  784. }
  785. func (s *ServicePerimeter) MarshalJSON() ([]byte, error) {
  786. type NoMethod ServicePerimeter
  787. raw := NoMethod(*s)
  788. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  789. }
  790. // ServicePerimeterConfig: `ServicePerimeterConfig` specifies a set of
  791. // GCP resources that describe
  792. // specific Service Perimeter configuration.
  793. type ServicePerimeterConfig struct {
  794. // AccessLevels: A list of `AccessLevel` resource names that allow
  795. // resources within the
  796. // `ServicePerimeter` to be accessed from the internet. `AccessLevels`
  797. // listed
  798. // must be in the same policy as this `ServicePerimeter`. Referencing
  799. // a
  800. // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel`
  801. // names are
  802. // listed, resources within the perimeter can only be accessed via GCP
  803. // calls
  804. // with request origins within the perimeter.
  805. // Example:
  806. // "accessPolicies/MY_POLICY/accessLevels/MY_LEVEL".
  807. // For Service Perimeter Bridge, must be empty.
  808. AccessLevels []string `json:"accessLevels,omitempty"`
  809. // Resources: A list of GCP resources that are inside of the service
  810. // perimeter.
  811. // Currently only projects are allowed. Format:
  812. // `projects/{project_number}`
  813. Resources []string `json:"resources,omitempty"`
  814. // RestrictedServices: GCP services that are subject to the Service
  815. // Perimeter restrictions. For
  816. // example, if `storage.googleapis.com` is specified, access to the
  817. // storage
  818. // buckets inside the perimeter must meet the perimeter's access
  819. // restrictions.
  820. RestrictedServices []string `json:"restrictedServices,omitempty"`
  821. // ForceSendFields is a list of field names (e.g. "AccessLevels") to
  822. // unconditionally include in API requests. By default, fields with
  823. // empty values are omitted from API requests. However, any non-pointer,
  824. // non-interface field appearing in ForceSendFields will be sent to the
  825. // server regardless of whether the field is empty or not. This may be
  826. // used to include empty fields in Patch requests.
  827. ForceSendFields []string `json:"-"`
  828. // NullFields is a list of field names (e.g. "AccessLevels") to include
  829. // in API requests with the JSON null value. By default, fields with
  830. // empty values are omitted from API requests. However, any field with
  831. // an empty value appearing in NullFields will be sent to the server as
  832. // null. It is an error if a field in this list has a non-empty value.
  833. // This may be used to include null fields in Patch requests.
  834. NullFields []string `json:"-"`
  835. }
  836. func (s *ServicePerimeterConfig) MarshalJSON() ([]byte, error) {
  837. type NoMethod ServicePerimeterConfig
  838. raw := NoMethod(*s)
  839. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  840. }
  841. // Status: The `Status` type defines a logical error model that is
  842. // suitable for
  843. // different programming environments, including REST APIs and RPC APIs.
  844. // It is
  845. // used by [gRPC](https://github.com/grpc). The error model is designed
  846. // to be:
  847. //
  848. // - Simple to use and understand for most users
  849. // - Flexible enough to meet unexpected needs
  850. //
  851. // # Overview
  852. //
  853. // The `Status` message contains three pieces of data: error code,
  854. // error
  855. // message, and error details. The error code should be an enum value
  856. // of
  857. // google.rpc.Code, but it may accept additional error codes if needed.
  858. // The
  859. // error message should be a developer-facing English message that
  860. // helps
  861. // developers *understand* and *resolve* the error. If a localized
  862. // user-facing
  863. // error message is needed, put the localized message in the error
  864. // details or
  865. // localize it in the client. The optional error details may contain
  866. // arbitrary
  867. // information about the error. There is a predefined set of error
  868. // detail types
  869. // in the package `google.rpc` that can be used for common error
  870. // conditions.
  871. //
  872. // # Language mapping
  873. //
  874. // The `Status` message is the logical representation of the error
  875. // model, but it
  876. // is not necessarily the actual wire format. When the `Status` message
  877. // is
  878. // exposed in different client libraries and different wire protocols,
  879. // it can be
  880. // mapped differently. For example, it will likely be mapped to some
  881. // exceptions
  882. // in Java, but more likely mapped to some error codes in C.
  883. //
  884. // # Other uses
  885. //
  886. // The error model and the `Status` message can be used in a variety
  887. // of
  888. // environments, either with or without APIs, to provide a
  889. // consistent developer experience across different
  890. // environments.
  891. //
  892. // Example uses of this error model include:
  893. //
  894. // - Partial errors. If a service needs to return partial errors to the
  895. // client,
  896. // it may embed the `Status` in the normal response to indicate the
  897. // partial
  898. // errors.
  899. //
  900. // - Workflow errors. A typical workflow has multiple steps. Each step
  901. // may
  902. // have a `Status` message for error reporting.
  903. //
  904. // - Batch operations. If a client uses batch request and batch
  905. // response, the
  906. // `Status` message should be used directly inside batch response,
  907. // one for
  908. // each error sub-response.
  909. //
  910. // - Asynchronous operations. If an API call embeds asynchronous
  911. // operation
  912. // results in its response, the status of those operations should
  913. // be
  914. // represented directly using the `Status` message.
  915. //
  916. // - Logging. If some API errors are stored in logs, the message
  917. // `Status` could
  918. // be used directly after any stripping needed for security/privacy
  919. // reasons.
  920. type Status struct {
  921. // Code: The status code, which should be an enum value of
  922. // google.rpc.Code.
  923. Code int64 `json:"code,omitempty"`
  924. // Details: A list of messages that carry the error details. There is a
  925. // common set of
  926. // message types for APIs to use.
  927. Details []googleapi.RawMessage `json:"details,omitempty"`
  928. // Message: A developer-facing error message, which should be in
  929. // English. Any
  930. // user-facing error message should be localized and sent in
  931. // the
  932. // google.rpc.Status.details field, or localized by the client.
  933. Message string `json:"message,omitempty"`
  934. // ForceSendFields is a list of field names (e.g. "Code") to
  935. // unconditionally include in API requests. By default, fields with
  936. // empty values are omitted from API requests. However, any non-pointer,
  937. // non-interface field appearing in ForceSendFields will be sent to the
  938. // server regardless of whether the field is empty or not. This may be
  939. // used to include empty fields in Patch requests.
  940. ForceSendFields []string `json:"-"`
  941. // NullFields is a list of field names (e.g. "Code") to include in API
  942. // requests with the JSON null value. By default, fields with empty
  943. // values are omitted from API requests. However, any field with an
  944. // empty value appearing in NullFields will be sent to the server as
  945. // null. It is an error if a field in this list has a non-empty value.
  946. // This may be used to include null fields in Patch requests.
  947. NullFields []string `json:"-"`
  948. }
  949. func (s *Status) MarshalJSON() ([]byte, error) {
  950. type NoMethod Status
  951. raw := NoMethod(*s)
  952. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  953. }
  954. // method id "accesscontextmanager.accessPolicies.create":
  955. type AccessPoliciesCreateCall struct {
  956. s *Service
  957. accesspolicy *AccessPolicy
  958. urlParams_ gensupport.URLParams
  959. ctx_ context.Context
  960. header_ http.Header
  961. }
  962. // Create: Create an `AccessPolicy`. Fails if this organization already
  963. // has a
  964. // `AccessPolicy`. The longrunning Operation will have a successful
  965. // status
  966. // once the `AccessPolicy` has propagated to long-lasting
  967. // storage.
  968. // Syntactic and basic semantic errors will be returned in `metadata` as
  969. // a
  970. // BadRequest proto.
  971. func (r *AccessPoliciesService) Create(accesspolicy *AccessPolicy) *AccessPoliciesCreateCall {
  972. c := &AccessPoliciesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  973. c.accesspolicy = accesspolicy
  974. return c
  975. }
  976. // Fields allows partial responses to be retrieved. See
  977. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  978. // for more information.
  979. func (c *AccessPoliciesCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesCreateCall {
  980. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  981. return c
  982. }
  983. // Context sets the context to be used in this call's Do method. Any
  984. // pending HTTP request will be aborted if the provided context is
  985. // canceled.
  986. func (c *AccessPoliciesCreateCall) Context(ctx context.Context) *AccessPoliciesCreateCall {
  987. c.ctx_ = ctx
  988. return c
  989. }
  990. // Header returns an http.Header that can be modified by the caller to
  991. // add HTTP headers to the request.
  992. func (c *AccessPoliciesCreateCall) Header() http.Header {
  993. if c.header_ == nil {
  994. c.header_ = make(http.Header)
  995. }
  996. return c.header_
  997. }
  998. func (c *AccessPoliciesCreateCall) doRequest(alt string) (*http.Response, error) {
  999. reqHeaders := make(http.Header)
  1000. for k, v := range c.header_ {
  1001. reqHeaders[k] = v
  1002. }
  1003. reqHeaders.Set("User-Agent", c.s.userAgent())
  1004. var body io.Reader = nil
  1005. body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesspolicy)
  1006. if err != nil {
  1007. return nil, err
  1008. }
  1009. reqHeaders.Set("Content-Type", "application/json")
  1010. c.urlParams_.Set("alt", alt)
  1011. c.urlParams_.Set("prettyPrint", "false")
  1012. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/accessPolicies")
  1013. urls += "?" + c.urlParams_.Encode()
  1014. req, err := http.NewRequest("POST", urls, body)
  1015. if err != nil {
  1016. return nil, err
  1017. }
  1018. req.Header = reqHeaders
  1019. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1020. }
  1021. // Do executes the "accesscontextmanager.accessPolicies.create" call.
  1022. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1023. // status code is an error. Response headers are in either
  1024. // *Operation.ServerResponse.Header or (if a response was returned at
  1025. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1026. // to check whether the returned error was because
  1027. // http.StatusNotModified was returned.
  1028. func (c *AccessPoliciesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1029. gensupport.SetOptions(c.urlParams_, opts...)
  1030. res, err := c.doRequest("json")
  1031. if res != nil && res.StatusCode == http.StatusNotModified {
  1032. if res.Body != nil {
  1033. res.Body.Close()
  1034. }
  1035. return nil, &googleapi.Error{
  1036. Code: res.StatusCode,
  1037. Header: res.Header,
  1038. }
  1039. }
  1040. if err != nil {
  1041. return nil, err
  1042. }
  1043. defer googleapi.CloseBody(res)
  1044. if err := googleapi.CheckResponse(res); err != nil {
  1045. return nil, err
  1046. }
  1047. ret := &Operation{
  1048. ServerResponse: googleapi.ServerResponse{
  1049. Header: res.Header,
  1050. HTTPStatusCode: res.StatusCode,
  1051. },
  1052. }
  1053. target := &ret
  1054. if err := gensupport.DecodeResponse(target, res); err != nil {
  1055. return nil, err
  1056. }
  1057. return ret, nil
  1058. // {
  1059. // "description": "Create an `AccessPolicy`. Fails if this organization already has a\n`AccessPolicy`. The longrunning Operation will have a successful status\nonce the `AccessPolicy` has propagated to long-lasting storage.\nSyntactic and basic semantic errors will be returned in `metadata` as a\nBadRequest proto.",
  1060. // "flatPath": "v1/accessPolicies",
  1061. // "httpMethod": "POST",
  1062. // "id": "accesscontextmanager.accessPolicies.create",
  1063. // "parameterOrder": [],
  1064. // "parameters": {},
  1065. // "path": "v1/accessPolicies",
  1066. // "request": {
  1067. // "$ref": "AccessPolicy"
  1068. // },
  1069. // "response": {
  1070. // "$ref": "Operation"
  1071. // },
  1072. // "scopes": [
  1073. // "https://www.googleapis.com/auth/cloud-platform"
  1074. // ]
  1075. // }
  1076. }
  1077. // method id "accesscontextmanager.accessPolicies.delete":
  1078. type AccessPoliciesDeleteCall struct {
  1079. s *Service
  1080. name string
  1081. urlParams_ gensupport.URLParams
  1082. ctx_ context.Context
  1083. header_ http.Header
  1084. }
  1085. // Delete: Delete an AccessPolicy by resource
  1086. // name. The longrunning Operation will have a successful status once
  1087. // the
  1088. // AccessPolicy
  1089. // has been removed from long-lasting storage.
  1090. func (r *AccessPoliciesService) Delete(name string) *AccessPoliciesDeleteCall {
  1091. c := &AccessPoliciesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1092. c.name = name
  1093. return c
  1094. }
  1095. // Fields allows partial responses to be retrieved. See
  1096. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1097. // for more information.
  1098. func (c *AccessPoliciesDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesDeleteCall {
  1099. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1100. return c
  1101. }
  1102. // Context sets the context to be used in this call's Do method. Any
  1103. // pending HTTP request will be aborted if the provided context is
  1104. // canceled.
  1105. func (c *AccessPoliciesDeleteCall) Context(ctx context.Context) *AccessPoliciesDeleteCall {
  1106. c.ctx_ = ctx
  1107. return c
  1108. }
  1109. // Header returns an http.Header that can be modified by the caller to
  1110. // add HTTP headers to the request.
  1111. func (c *AccessPoliciesDeleteCall) Header() http.Header {
  1112. if c.header_ == nil {
  1113. c.header_ = make(http.Header)
  1114. }
  1115. return c.header_
  1116. }
  1117. func (c *AccessPoliciesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1118. reqHeaders := make(http.Header)
  1119. for k, v := range c.header_ {
  1120. reqHeaders[k] = v
  1121. }
  1122. reqHeaders.Set("User-Agent", c.s.userAgent())
  1123. var body io.Reader = nil
  1124. c.urlParams_.Set("alt", alt)
  1125. c.urlParams_.Set("prettyPrint", "false")
  1126. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1127. urls += "?" + c.urlParams_.Encode()
  1128. req, err := http.NewRequest("DELETE", urls, body)
  1129. if err != nil {
  1130. return nil, err
  1131. }
  1132. req.Header = reqHeaders
  1133. googleapi.Expand(req.URL, map[string]string{
  1134. "name": c.name,
  1135. })
  1136. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1137. }
  1138. // Do executes the "accesscontextmanager.accessPolicies.delete" call.
  1139. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1140. // status code is an error. Response headers are in either
  1141. // *Operation.ServerResponse.Header or (if a response was returned at
  1142. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1143. // to check whether the returned error was because
  1144. // http.StatusNotModified was returned.
  1145. func (c *AccessPoliciesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1146. gensupport.SetOptions(c.urlParams_, opts...)
  1147. res, err := c.doRequest("json")
  1148. if res != nil && res.StatusCode == http.StatusNotModified {
  1149. if res.Body != nil {
  1150. res.Body.Close()
  1151. }
  1152. return nil, &googleapi.Error{
  1153. Code: res.StatusCode,
  1154. Header: res.Header,
  1155. }
  1156. }
  1157. if err != nil {
  1158. return nil, err
  1159. }
  1160. defer googleapi.CloseBody(res)
  1161. if err := googleapi.CheckResponse(res); err != nil {
  1162. return nil, err
  1163. }
  1164. ret := &Operation{
  1165. ServerResponse: googleapi.ServerResponse{
  1166. Header: res.Header,
  1167. HTTPStatusCode: res.StatusCode,
  1168. },
  1169. }
  1170. target := &ret
  1171. if err := gensupport.DecodeResponse(target, res); err != nil {
  1172. return nil, err
  1173. }
  1174. return ret, nil
  1175. // {
  1176. // "description": "Delete an AccessPolicy by resource\nname. The longrunning Operation will have a successful status once the\nAccessPolicy\nhas been removed from long-lasting storage.",
  1177. // "flatPath": "v1/accessPolicies/{accessPoliciesId}",
  1178. // "httpMethod": "DELETE",
  1179. // "id": "accesscontextmanager.accessPolicies.delete",
  1180. // "parameterOrder": [
  1181. // "name"
  1182. // ],
  1183. // "parameters": {
  1184. // "name": {
  1185. // "description": "Required. Resource name for the access policy to delete.\n\nFormat `accessPolicies/{policy_id}`",
  1186. // "location": "path",
  1187. // "pattern": "^accessPolicies/[^/]+$",
  1188. // "required": true,
  1189. // "type": "string"
  1190. // }
  1191. // },
  1192. // "path": "v1/{+name}",
  1193. // "response": {
  1194. // "$ref": "Operation"
  1195. // },
  1196. // "scopes": [
  1197. // "https://www.googleapis.com/auth/cloud-platform"
  1198. // ]
  1199. // }
  1200. }
  1201. // method id "accesscontextmanager.accessPolicies.get":
  1202. type AccessPoliciesGetCall struct {
  1203. s *Service
  1204. name string
  1205. urlParams_ gensupport.URLParams
  1206. ifNoneMatch_ string
  1207. ctx_ context.Context
  1208. header_ http.Header
  1209. }
  1210. // Get: Get an AccessPolicy by name.
  1211. func (r *AccessPoliciesService) Get(name string) *AccessPoliciesGetCall {
  1212. c := &AccessPoliciesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1213. c.name = name
  1214. return c
  1215. }
  1216. // Fields allows partial responses to be retrieved. See
  1217. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1218. // for more information.
  1219. func (c *AccessPoliciesGetCall) Fields(s ...googleapi.Field) *AccessPoliciesGetCall {
  1220. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1221. return c
  1222. }
  1223. // IfNoneMatch sets the optional parameter which makes the operation
  1224. // fail if the object's ETag matches the given value. This is useful for
  1225. // getting updates only after the object has changed since the last
  1226. // request. Use googleapi.IsNotModified to check whether the response
  1227. // error from Do is the result of In-None-Match.
  1228. func (c *AccessPoliciesGetCall) IfNoneMatch(entityTag string) *AccessPoliciesGetCall {
  1229. c.ifNoneMatch_ = entityTag
  1230. return c
  1231. }
  1232. // Context sets the context to be used in this call's Do method. Any
  1233. // pending HTTP request will be aborted if the provided context is
  1234. // canceled.
  1235. func (c *AccessPoliciesGetCall) Context(ctx context.Context) *AccessPoliciesGetCall {
  1236. c.ctx_ = ctx
  1237. return c
  1238. }
  1239. // Header returns an http.Header that can be modified by the caller to
  1240. // add HTTP headers to the request.
  1241. func (c *AccessPoliciesGetCall) Header() http.Header {
  1242. if c.header_ == nil {
  1243. c.header_ = make(http.Header)
  1244. }
  1245. return c.header_
  1246. }
  1247. func (c *AccessPoliciesGetCall) doRequest(alt string) (*http.Response, error) {
  1248. reqHeaders := make(http.Header)
  1249. for k, v := range c.header_ {
  1250. reqHeaders[k] = v
  1251. }
  1252. reqHeaders.Set("User-Agent", c.s.userAgent())
  1253. if c.ifNoneMatch_ != "" {
  1254. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1255. }
  1256. var body io.Reader = nil
  1257. c.urlParams_.Set("alt", alt)
  1258. c.urlParams_.Set("prettyPrint", "false")
  1259. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1260. urls += "?" + c.urlParams_.Encode()
  1261. req, err := http.NewRequest("GET", urls, body)
  1262. if err != nil {
  1263. return nil, err
  1264. }
  1265. req.Header = reqHeaders
  1266. googleapi.Expand(req.URL, map[string]string{
  1267. "name": c.name,
  1268. })
  1269. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1270. }
  1271. // Do executes the "accesscontextmanager.accessPolicies.get" call.
  1272. // Exactly one of *AccessPolicy or error will be non-nil. Any non-2xx
  1273. // status code is an error. Response headers are in either
  1274. // *AccessPolicy.ServerResponse.Header or (if a response was returned at
  1275. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1276. // to check whether the returned error was because
  1277. // http.StatusNotModified was returned.
  1278. func (c *AccessPoliciesGetCall) Do(opts ...googleapi.CallOption) (*AccessPolicy, error) {
  1279. gensupport.SetOptions(c.urlParams_, opts...)
  1280. res, err := c.doRequest("json")
  1281. if res != nil && res.StatusCode == http.StatusNotModified {
  1282. if res.Body != nil {
  1283. res.Body.Close()
  1284. }
  1285. return nil, &googleapi.Error{
  1286. Code: res.StatusCode,
  1287. Header: res.Header,
  1288. }
  1289. }
  1290. if err != nil {
  1291. return nil, err
  1292. }
  1293. defer googleapi.CloseBody(res)
  1294. if err := googleapi.CheckResponse(res); err != nil {
  1295. return nil, err
  1296. }
  1297. ret := &AccessPolicy{
  1298. ServerResponse: googleapi.ServerResponse{
  1299. Header: res.Header,
  1300. HTTPStatusCode: res.StatusCode,
  1301. },
  1302. }
  1303. target := &ret
  1304. if err := gensupport.DecodeResponse(target, res); err != nil {
  1305. return nil, err
  1306. }
  1307. return ret, nil
  1308. // {
  1309. // "description": "Get an AccessPolicy by name.",
  1310. // "flatPath": "v1/accessPolicies/{accessPoliciesId}",
  1311. // "httpMethod": "GET",
  1312. // "id": "accesscontextmanager.accessPolicies.get",
  1313. // "parameterOrder": [
  1314. // "name"
  1315. // ],
  1316. // "parameters": {
  1317. // "name": {
  1318. // "description": "Required. Resource name for the access policy to get.\n\nFormat `accessPolicies/{policy_id}`",
  1319. // "location": "path",
  1320. // "pattern": "^accessPolicies/[^/]+$",
  1321. // "required": true,
  1322. // "type": "string"
  1323. // }
  1324. // },
  1325. // "path": "v1/{+name}",
  1326. // "response": {
  1327. // "$ref": "AccessPolicy"
  1328. // },
  1329. // "scopes": [
  1330. // "https://www.googleapis.com/auth/cloud-platform"
  1331. // ]
  1332. // }
  1333. }
  1334. // method id "accesscontextmanager.accessPolicies.list":
  1335. type AccessPoliciesListCall struct {
  1336. s *Service
  1337. urlParams_ gensupport.URLParams
  1338. ifNoneMatch_ string
  1339. ctx_ context.Context
  1340. header_ http.Header
  1341. }
  1342. // List: List all AccessPolicies under a
  1343. // container.
  1344. func (r *AccessPoliciesService) List() *AccessPoliciesListCall {
  1345. c := &AccessPoliciesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1346. return c
  1347. }
  1348. // PageSize sets the optional parameter "pageSize": Number of
  1349. // AccessPolicy instances to include in the list. Default 100.
  1350. func (c *AccessPoliciesListCall) PageSize(pageSize int64) *AccessPoliciesListCall {
  1351. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1352. return c
  1353. }
  1354. // PageToken sets the optional parameter "pageToken": Next page token
  1355. // for the next batch of AccessPolicy instances. Defaults to
  1356. // the first page of results.
  1357. func (c *AccessPoliciesListCall) PageToken(pageToken string) *AccessPoliciesListCall {
  1358. c.urlParams_.Set("pageToken", pageToken)
  1359. return c
  1360. }
  1361. // Parent sets the optional parameter "parent": Required. Resource name
  1362. // for the container to list AccessPolicy
  1363. // instances
  1364. // from.
  1365. //
  1366. // Format:
  1367. // `organizations/{org_id}`
  1368. func (c *AccessPoliciesListCall) Parent(parent string) *AccessPoliciesListCall {
  1369. c.urlParams_.Set("parent", parent)
  1370. return c
  1371. }
  1372. // Fields allows partial responses to be retrieved. See
  1373. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1374. // for more information.
  1375. func (c *AccessPoliciesListCall) Fields(s ...googleapi.Field) *AccessPoliciesListCall {
  1376. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1377. return c
  1378. }
  1379. // IfNoneMatch sets the optional parameter which makes the operation
  1380. // fail if the object's ETag matches the given value. This is useful for
  1381. // getting updates only after the object has changed since the last
  1382. // request. Use googleapi.IsNotModified to check whether the response
  1383. // error from Do is the result of In-None-Match.
  1384. func (c *AccessPoliciesListCall) IfNoneMatch(entityTag string) *AccessPoliciesListCall {
  1385. c.ifNoneMatch_ = entityTag
  1386. return c
  1387. }
  1388. // Context sets the context to be used in this call's Do method. Any
  1389. // pending HTTP request will be aborted if the provided context is
  1390. // canceled.
  1391. func (c *AccessPoliciesListCall) Context(ctx context.Context) *AccessPoliciesListCall {
  1392. c.ctx_ = ctx
  1393. return c
  1394. }
  1395. // Header returns an http.Header that can be modified by the caller to
  1396. // add HTTP headers to the request.
  1397. func (c *AccessPoliciesListCall) Header() http.Header {
  1398. if c.header_ == nil {
  1399. c.header_ = make(http.Header)
  1400. }
  1401. return c.header_
  1402. }
  1403. func (c *AccessPoliciesListCall) doRequest(alt string) (*http.Response, error) {
  1404. reqHeaders := make(http.Header)
  1405. for k, v := range c.header_ {
  1406. reqHeaders[k] = v
  1407. }
  1408. reqHeaders.Set("User-Agent", c.s.userAgent())
  1409. if c.ifNoneMatch_ != "" {
  1410. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1411. }
  1412. var body io.Reader = nil
  1413. c.urlParams_.Set("alt", alt)
  1414. c.urlParams_.Set("prettyPrint", "false")
  1415. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/accessPolicies")
  1416. urls += "?" + c.urlParams_.Encode()
  1417. req, err := http.NewRequest("GET", urls, body)
  1418. if err != nil {
  1419. return nil, err
  1420. }
  1421. req.Header = reqHeaders
  1422. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1423. }
  1424. // Do executes the "accesscontextmanager.accessPolicies.list" call.
  1425. // Exactly one of *ListAccessPoliciesResponse or error will be non-nil.
  1426. // Any non-2xx status code is an error. Response headers are in either
  1427. // *ListAccessPoliciesResponse.ServerResponse.Header or (if a response
  1428. // was returned at all) in error.(*googleapi.Error).Header. Use
  1429. // googleapi.IsNotModified to check whether the returned error was
  1430. // because http.StatusNotModified was returned.
  1431. func (c *AccessPoliciesListCall) Do(opts ...googleapi.CallOption) (*ListAccessPoliciesResponse, error) {
  1432. gensupport.SetOptions(c.urlParams_, opts...)
  1433. res, err := c.doRequest("json")
  1434. if res != nil && res.StatusCode == http.StatusNotModified {
  1435. if res.Body != nil {
  1436. res.Body.Close()
  1437. }
  1438. return nil, &googleapi.Error{
  1439. Code: res.StatusCode,
  1440. Header: res.Header,
  1441. }
  1442. }
  1443. if err != nil {
  1444. return nil, err
  1445. }
  1446. defer googleapi.CloseBody(res)
  1447. if err := googleapi.CheckResponse(res); err != nil {
  1448. return nil, err
  1449. }
  1450. ret := &ListAccessPoliciesResponse{
  1451. ServerResponse: googleapi.ServerResponse{
  1452. Header: res.Header,
  1453. HTTPStatusCode: res.StatusCode,
  1454. },
  1455. }
  1456. target := &ret
  1457. if err := gensupport.DecodeResponse(target, res); err != nil {
  1458. return nil, err
  1459. }
  1460. return ret, nil
  1461. // {
  1462. // "description": "List all AccessPolicies under a\ncontainer.",
  1463. // "flatPath": "v1/accessPolicies",
  1464. // "httpMethod": "GET",
  1465. // "id": "accesscontextmanager.accessPolicies.list",
  1466. // "parameterOrder": [],
  1467. // "parameters": {
  1468. // "pageSize": {
  1469. // "description": "Number of AccessPolicy instances to include in the list. Default 100.",
  1470. // "format": "int32",
  1471. // "location": "query",
  1472. // "type": "integer"
  1473. // },
  1474. // "pageToken": {
  1475. // "description": "Next page token for the next batch of AccessPolicy instances. Defaults to\nthe first page of results.",
  1476. // "location": "query",
  1477. // "type": "string"
  1478. // },
  1479. // "parent": {
  1480. // "description": "Required. Resource name for the container to list AccessPolicy instances\nfrom.\n\nFormat:\n`organizations/{org_id}`",
  1481. // "location": "query",
  1482. // "type": "string"
  1483. // }
  1484. // },
  1485. // "path": "v1/accessPolicies",
  1486. // "response": {
  1487. // "$ref": "ListAccessPoliciesResponse"
  1488. // },
  1489. // "scopes": [
  1490. // "https://www.googleapis.com/auth/cloud-platform"
  1491. // ]
  1492. // }
  1493. }
  1494. // Pages invokes f for each page of results.
  1495. // A non-nil error returned from f will halt the iteration.
  1496. // The provided context supersedes any context provided to the Context method.
  1497. func (c *AccessPoliciesListCall) Pages(ctx context.Context, f func(*ListAccessPoliciesResponse) error) error {
  1498. c.ctx_ = ctx
  1499. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1500. for {
  1501. x, err := c.Do()
  1502. if err != nil {
  1503. return err
  1504. }
  1505. if err := f(x); err != nil {
  1506. return err
  1507. }
  1508. if x.NextPageToken == "" {
  1509. return nil
  1510. }
  1511. c.PageToken(x.NextPageToken)
  1512. }
  1513. }
  1514. // method id "accesscontextmanager.accessPolicies.patch":
  1515. type AccessPoliciesPatchCall struct {
  1516. s *Service
  1517. name string
  1518. accesspolicy *AccessPolicy
  1519. urlParams_ gensupport.URLParams
  1520. ctx_ context.Context
  1521. header_ http.Header
  1522. }
  1523. // Patch: Update an AccessPolicy. The
  1524. // longrunning Operation from this RPC will have a successful status
  1525. // once the
  1526. // changes to the AccessPolicy have propagated
  1527. // to long-lasting storage. Syntactic and basic semantic errors will
  1528. // be
  1529. // returned in `metadata` as a BadRequest proto.
  1530. func (r *AccessPoliciesService) Patch(name string, accesspolicy *AccessPolicy) *AccessPoliciesPatchCall {
  1531. c := &AccessPoliciesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1532. c.name = name
  1533. c.accesspolicy = accesspolicy
  1534. return c
  1535. }
  1536. // UpdateMask sets the optional parameter "updateMask": Required. Mask
  1537. // to control which fields get updated. Must be non-empty.
  1538. func (c *AccessPoliciesPatchCall) UpdateMask(updateMask string) *AccessPoliciesPatchCall {
  1539. c.urlParams_.Set("updateMask", updateMask)
  1540. return c
  1541. }
  1542. // Fields allows partial responses to be retrieved. See
  1543. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1544. // for more information.
  1545. func (c *AccessPoliciesPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesPatchCall {
  1546. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1547. return c
  1548. }
  1549. // Context sets the context to be used in this call's Do method. Any
  1550. // pending HTTP request will be aborted if the provided context is
  1551. // canceled.
  1552. func (c *AccessPoliciesPatchCall) Context(ctx context.Context) *AccessPoliciesPatchCall {
  1553. c.ctx_ = ctx
  1554. return c
  1555. }
  1556. // Header returns an http.Header that can be modified by the caller to
  1557. // add HTTP headers to the request.
  1558. func (c *AccessPoliciesPatchCall) Header() http.Header {
  1559. if c.header_ == nil {
  1560. c.header_ = make(http.Header)
  1561. }
  1562. return c.header_
  1563. }
  1564. func (c *AccessPoliciesPatchCall) doRequest(alt string) (*http.Response, error) {
  1565. reqHeaders := make(http.Header)
  1566. for k, v := range c.header_ {
  1567. reqHeaders[k] = v
  1568. }
  1569. reqHeaders.Set("User-Agent", c.s.userAgent())
  1570. var body io.Reader = nil
  1571. body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesspolicy)
  1572. if err != nil {
  1573. return nil, err
  1574. }
  1575. reqHeaders.Set("Content-Type", "application/json")
  1576. c.urlParams_.Set("alt", alt)
  1577. c.urlParams_.Set("prettyPrint", "false")
  1578. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1579. urls += "?" + c.urlParams_.Encode()
  1580. req, err := http.NewRequest("PATCH", urls, body)
  1581. if err != nil {
  1582. return nil, err
  1583. }
  1584. req.Header = reqHeaders
  1585. googleapi.Expand(req.URL, map[string]string{
  1586. "name": c.name,
  1587. })
  1588. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1589. }
  1590. // Do executes the "accesscontextmanager.accessPolicies.patch" call.
  1591. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1592. // status code is an error. Response headers are in either
  1593. // *Operation.ServerResponse.Header or (if a response was returned at
  1594. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1595. // to check whether the returned error was because
  1596. // http.StatusNotModified was returned.
  1597. func (c *AccessPoliciesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1598. gensupport.SetOptions(c.urlParams_, opts...)
  1599. res, err := c.doRequest("json")
  1600. if res != nil && res.StatusCode == http.StatusNotModified {
  1601. if res.Body != nil {
  1602. res.Body.Close()
  1603. }
  1604. return nil, &googleapi.Error{
  1605. Code: res.StatusCode,
  1606. Header: res.Header,
  1607. }
  1608. }
  1609. if err != nil {
  1610. return nil, err
  1611. }
  1612. defer googleapi.CloseBody(res)
  1613. if err := googleapi.CheckResponse(res); err != nil {
  1614. return nil, err
  1615. }
  1616. ret := &Operation{
  1617. ServerResponse: googleapi.ServerResponse{
  1618. Header: res.Header,
  1619. HTTPStatusCode: res.StatusCode,
  1620. },
  1621. }
  1622. target := &ret
  1623. if err := gensupport.DecodeResponse(target, res); err != nil {
  1624. return nil, err
  1625. }
  1626. return ret, nil
  1627. // {
  1628. // "description": "Update an AccessPolicy. The\nlongrunning Operation from this RPC will have a successful status once the\nchanges to the AccessPolicy have propagated\nto long-lasting storage. Syntactic and basic semantic errors will be\nreturned in `metadata` as a BadRequest proto.",
  1629. // "flatPath": "v1/accessPolicies/{accessPoliciesId}",
  1630. // "httpMethod": "PATCH",
  1631. // "id": "accesscontextmanager.accessPolicies.patch",
  1632. // "parameterOrder": [
  1633. // "name"
  1634. // ],
  1635. // "parameters": {
  1636. // "name": {
  1637. // "description": "Output only. Resource name of the `AccessPolicy`. Format:\n`accessPolicies/{policy_id}`",
  1638. // "location": "path",
  1639. // "pattern": "^accessPolicies/[^/]+$",
  1640. // "required": true,
  1641. // "type": "string"
  1642. // },
  1643. // "updateMask": {
  1644. // "description": "Required. Mask to control which fields get updated. Must be non-empty.",
  1645. // "format": "google-fieldmask",
  1646. // "location": "query",
  1647. // "type": "string"
  1648. // }
  1649. // },
  1650. // "path": "v1/{+name}",
  1651. // "request": {
  1652. // "$ref": "AccessPolicy"
  1653. // },
  1654. // "response": {
  1655. // "$ref": "Operation"
  1656. // },
  1657. // "scopes": [
  1658. // "https://www.googleapis.com/auth/cloud-platform"
  1659. // ]
  1660. // }
  1661. }
  1662. // method id "accesscontextmanager.accessPolicies.accessLevels.create":
  1663. type AccessPoliciesAccessLevelsCreateCall struct {
  1664. s *Service
  1665. parent string
  1666. accesslevel *AccessLevel
  1667. urlParams_ gensupport.URLParams
  1668. ctx_ context.Context
  1669. header_ http.Header
  1670. }
  1671. // Create: Create an Access Level. The longrunning
  1672. // operation from this RPC will have a successful status once the
  1673. // Access
  1674. // Level has
  1675. // propagated to long-lasting storage. Access Levels containing
  1676. // errors will result in an error response for the first error
  1677. // encountered.
  1678. func (r *AccessPoliciesAccessLevelsService) Create(parent string, accesslevel *AccessLevel) *AccessPoliciesAccessLevelsCreateCall {
  1679. c := &AccessPoliciesAccessLevelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1680. c.parent = parent
  1681. c.accesslevel = accesslevel
  1682. return c
  1683. }
  1684. // Fields allows partial responses to be retrieved. See
  1685. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1686. // for more information.
  1687. func (c *AccessPoliciesAccessLevelsCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsCreateCall {
  1688. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1689. return c
  1690. }
  1691. // Context sets the context to be used in this call's Do method. Any
  1692. // pending HTTP request will be aborted if the provided context is
  1693. // canceled.
  1694. func (c *AccessPoliciesAccessLevelsCreateCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsCreateCall {
  1695. c.ctx_ = ctx
  1696. return c
  1697. }
  1698. // Header returns an http.Header that can be modified by the caller to
  1699. // add HTTP headers to the request.
  1700. func (c *AccessPoliciesAccessLevelsCreateCall) Header() http.Header {
  1701. if c.header_ == nil {
  1702. c.header_ = make(http.Header)
  1703. }
  1704. return c.header_
  1705. }
  1706. func (c *AccessPoliciesAccessLevelsCreateCall) doRequest(alt string) (*http.Response, error) {
  1707. reqHeaders := make(http.Header)
  1708. for k, v := range c.header_ {
  1709. reqHeaders[k] = v
  1710. }
  1711. reqHeaders.Set("User-Agent", c.s.userAgent())
  1712. var body io.Reader = nil
  1713. body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesslevel)
  1714. if err != nil {
  1715. return nil, err
  1716. }
  1717. reqHeaders.Set("Content-Type", "application/json")
  1718. c.urlParams_.Set("alt", alt)
  1719. c.urlParams_.Set("prettyPrint", "false")
  1720. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/accessLevels")
  1721. urls += "?" + c.urlParams_.Encode()
  1722. req, err := http.NewRequest("POST", urls, body)
  1723. if err != nil {
  1724. return nil, err
  1725. }
  1726. req.Header = reqHeaders
  1727. googleapi.Expand(req.URL, map[string]string{
  1728. "parent": c.parent,
  1729. })
  1730. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1731. }
  1732. // Do executes the "accesscontextmanager.accessPolicies.accessLevels.create" call.
  1733. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1734. // status code is an error. Response headers are in either
  1735. // *Operation.ServerResponse.Header or (if a response was returned at
  1736. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1737. // to check whether the returned error was because
  1738. // http.StatusNotModified was returned.
  1739. func (c *AccessPoliciesAccessLevelsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1740. gensupport.SetOptions(c.urlParams_, opts...)
  1741. res, err := c.doRequest("json")
  1742. if res != nil && res.StatusCode == http.StatusNotModified {
  1743. if res.Body != nil {
  1744. res.Body.Close()
  1745. }
  1746. return nil, &googleapi.Error{
  1747. Code: res.StatusCode,
  1748. Header: res.Header,
  1749. }
  1750. }
  1751. if err != nil {
  1752. return nil, err
  1753. }
  1754. defer googleapi.CloseBody(res)
  1755. if err := googleapi.CheckResponse(res); err != nil {
  1756. return nil, err
  1757. }
  1758. ret := &Operation{
  1759. ServerResponse: googleapi.ServerResponse{
  1760. Header: res.Header,
  1761. HTTPStatusCode: res.StatusCode,
  1762. },
  1763. }
  1764. target := &ret
  1765. if err := gensupport.DecodeResponse(target, res); err != nil {
  1766. return nil, err
  1767. }
  1768. return ret, nil
  1769. // {
  1770. // "description": "Create an Access Level. The longrunning\noperation from this RPC will have a successful status once the Access\nLevel has\npropagated to long-lasting storage. Access Levels containing\nerrors will result in an error response for the first error encountered.",
  1771. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/accessLevels",
  1772. // "httpMethod": "POST",
  1773. // "id": "accesscontextmanager.accessPolicies.accessLevels.create",
  1774. // "parameterOrder": [
  1775. // "parent"
  1776. // ],
  1777. // "parameters": {
  1778. // "parent": {
  1779. // "description": "Required. Resource name for the access policy which owns this Access\nLevel.\n\nFormat: `accessPolicies/{policy_id}`",
  1780. // "location": "path",
  1781. // "pattern": "^accessPolicies/[^/]+$",
  1782. // "required": true,
  1783. // "type": "string"
  1784. // }
  1785. // },
  1786. // "path": "v1/{+parent}/accessLevels",
  1787. // "request": {
  1788. // "$ref": "AccessLevel"
  1789. // },
  1790. // "response": {
  1791. // "$ref": "Operation"
  1792. // },
  1793. // "scopes": [
  1794. // "https://www.googleapis.com/auth/cloud-platform"
  1795. // ]
  1796. // }
  1797. }
  1798. // method id "accesscontextmanager.accessPolicies.accessLevels.delete":
  1799. type AccessPoliciesAccessLevelsDeleteCall struct {
  1800. s *Service
  1801. name string
  1802. urlParams_ gensupport.URLParams
  1803. ctx_ context.Context
  1804. header_ http.Header
  1805. }
  1806. // Delete: Delete an Access Level by resource
  1807. // name. The longrunning operation from this RPC will have a successful
  1808. // status
  1809. // once the Access Level has been removed
  1810. // from long-lasting storage.
  1811. func (r *AccessPoliciesAccessLevelsService) Delete(name string) *AccessPoliciesAccessLevelsDeleteCall {
  1812. c := &AccessPoliciesAccessLevelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1813. c.name = name
  1814. return c
  1815. }
  1816. // Fields allows partial responses to be retrieved. See
  1817. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1818. // for more information.
  1819. func (c *AccessPoliciesAccessLevelsDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsDeleteCall {
  1820. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1821. return c
  1822. }
  1823. // Context sets the context to be used in this call's Do method. Any
  1824. // pending HTTP request will be aborted if the provided context is
  1825. // canceled.
  1826. func (c *AccessPoliciesAccessLevelsDeleteCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsDeleteCall {
  1827. c.ctx_ = ctx
  1828. return c
  1829. }
  1830. // Header returns an http.Header that can be modified by the caller to
  1831. // add HTTP headers to the request.
  1832. func (c *AccessPoliciesAccessLevelsDeleteCall) Header() http.Header {
  1833. if c.header_ == nil {
  1834. c.header_ = make(http.Header)
  1835. }
  1836. return c.header_
  1837. }
  1838. func (c *AccessPoliciesAccessLevelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1839. reqHeaders := make(http.Header)
  1840. for k, v := range c.header_ {
  1841. reqHeaders[k] = v
  1842. }
  1843. reqHeaders.Set("User-Agent", c.s.userAgent())
  1844. var body io.Reader = nil
  1845. c.urlParams_.Set("alt", alt)
  1846. c.urlParams_.Set("prettyPrint", "false")
  1847. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1848. urls += "?" + c.urlParams_.Encode()
  1849. req, err := http.NewRequest("DELETE", urls, body)
  1850. if err != nil {
  1851. return nil, err
  1852. }
  1853. req.Header = reqHeaders
  1854. googleapi.Expand(req.URL, map[string]string{
  1855. "name": c.name,
  1856. })
  1857. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1858. }
  1859. // Do executes the "accesscontextmanager.accessPolicies.accessLevels.delete" call.
  1860. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1861. // status code is an error. Response headers are in either
  1862. // *Operation.ServerResponse.Header or (if a response was returned at
  1863. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1864. // to check whether the returned error was because
  1865. // http.StatusNotModified was returned.
  1866. func (c *AccessPoliciesAccessLevelsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1867. gensupport.SetOptions(c.urlParams_, opts...)
  1868. res, err := c.doRequest("json")
  1869. if res != nil && res.StatusCode == http.StatusNotModified {
  1870. if res.Body != nil {
  1871. res.Body.Close()
  1872. }
  1873. return nil, &googleapi.Error{
  1874. Code: res.StatusCode,
  1875. Header: res.Header,
  1876. }
  1877. }
  1878. if err != nil {
  1879. return nil, err
  1880. }
  1881. defer googleapi.CloseBody(res)
  1882. if err := googleapi.CheckResponse(res); err != nil {
  1883. return nil, err
  1884. }
  1885. ret := &Operation{
  1886. ServerResponse: googleapi.ServerResponse{
  1887. Header: res.Header,
  1888. HTTPStatusCode: res.StatusCode,
  1889. },
  1890. }
  1891. target := &ret
  1892. if err := gensupport.DecodeResponse(target, res); err != nil {
  1893. return nil, err
  1894. }
  1895. return ret, nil
  1896. // {
  1897. // "description": "Delete an Access Level by resource\nname. The longrunning operation from this RPC will have a successful status\nonce the Access Level has been removed\nfrom long-lasting storage.",
  1898. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}",
  1899. // "httpMethod": "DELETE",
  1900. // "id": "accesscontextmanager.accessPolicies.accessLevels.delete",
  1901. // "parameterOrder": [
  1902. // "name"
  1903. // ],
  1904. // "parameters": {
  1905. // "name": {
  1906. // "description": "Required. Resource name for the Access Level.\n\nFormat:\n`accessPolicies/{policy_id}/accessLevels/{access_level_id}`",
  1907. // "location": "path",
  1908. // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$",
  1909. // "required": true,
  1910. // "type": "string"
  1911. // }
  1912. // },
  1913. // "path": "v1/{+name}",
  1914. // "response": {
  1915. // "$ref": "Operation"
  1916. // },
  1917. // "scopes": [
  1918. // "https://www.googleapis.com/auth/cloud-platform"
  1919. // ]
  1920. // }
  1921. }
  1922. // method id "accesscontextmanager.accessPolicies.accessLevels.get":
  1923. type AccessPoliciesAccessLevelsGetCall struct {
  1924. s *Service
  1925. name string
  1926. urlParams_ gensupport.URLParams
  1927. ifNoneMatch_ string
  1928. ctx_ context.Context
  1929. header_ http.Header
  1930. }
  1931. // Get: Get an Access Level by resource
  1932. // name.
  1933. func (r *AccessPoliciesAccessLevelsService) Get(name string) *AccessPoliciesAccessLevelsGetCall {
  1934. c := &AccessPoliciesAccessLevelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1935. c.name = name
  1936. return c
  1937. }
  1938. // AccessLevelFormat sets the optional parameter "accessLevelFormat":
  1939. // Whether to return `BasicLevels` in the Cloud Common
  1940. // Expression
  1941. // Language rather than as `BasicLevels`. Defaults to AS_DEFINED,
  1942. // where
  1943. // Access Levels
  1944. // are returned as `BasicLevels` or `CustomLevels` based on how they
  1945. // were
  1946. // created. If set to CEL, all Access Levels are returned
  1947. // as
  1948. // `CustomLevels`. In the CEL case, `BasicLevels` are translated to
  1949. // equivalent
  1950. // `CustomLevels`.
  1951. //
  1952. // Possible values:
  1953. // "LEVEL_FORMAT_UNSPECIFIED"
  1954. // "AS_DEFINED"
  1955. // "CEL"
  1956. func (c *AccessPoliciesAccessLevelsGetCall) AccessLevelFormat(accessLevelFormat string) *AccessPoliciesAccessLevelsGetCall {
  1957. c.urlParams_.Set("accessLevelFormat", accessLevelFormat)
  1958. return c
  1959. }
  1960. // Fields allows partial responses to be retrieved. See
  1961. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1962. // for more information.
  1963. func (c *AccessPoliciesAccessLevelsGetCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsGetCall {
  1964. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1965. return c
  1966. }
  1967. // IfNoneMatch sets the optional parameter which makes the operation
  1968. // fail if the object's ETag matches the given value. This is useful for
  1969. // getting updates only after the object has changed since the last
  1970. // request. Use googleapi.IsNotModified to check whether the response
  1971. // error from Do is the result of In-None-Match.
  1972. func (c *AccessPoliciesAccessLevelsGetCall) IfNoneMatch(entityTag string) *AccessPoliciesAccessLevelsGetCall {
  1973. c.ifNoneMatch_ = entityTag
  1974. return c
  1975. }
  1976. // Context sets the context to be used in this call's Do method. Any
  1977. // pending HTTP request will be aborted if the provided context is
  1978. // canceled.
  1979. func (c *AccessPoliciesAccessLevelsGetCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsGetCall {
  1980. c.ctx_ = ctx
  1981. return c
  1982. }
  1983. // Header returns an http.Header that can be modified by the caller to
  1984. // add HTTP headers to the request.
  1985. func (c *AccessPoliciesAccessLevelsGetCall) Header() http.Header {
  1986. if c.header_ == nil {
  1987. c.header_ = make(http.Header)
  1988. }
  1989. return c.header_
  1990. }
  1991. func (c *AccessPoliciesAccessLevelsGetCall) doRequest(alt string) (*http.Response, error) {
  1992. reqHeaders := make(http.Header)
  1993. for k, v := range c.header_ {
  1994. reqHeaders[k] = v
  1995. }
  1996. reqHeaders.Set("User-Agent", c.s.userAgent())
  1997. if c.ifNoneMatch_ != "" {
  1998. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1999. }
  2000. var body io.Reader = nil
  2001. c.urlParams_.Set("alt", alt)
  2002. c.urlParams_.Set("prettyPrint", "false")
  2003. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2004. urls += "?" + c.urlParams_.Encode()
  2005. req, err := http.NewRequest("GET", urls, body)
  2006. if err != nil {
  2007. return nil, err
  2008. }
  2009. req.Header = reqHeaders
  2010. googleapi.Expand(req.URL, map[string]string{
  2011. "name": c.name,
  2012. })
  2013. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2014. }
  2015. // Do executes the "accesscontextmanager.accessPolicies.accessLevels.get" call.
  2016. // Exactly one of *AccessLevel or error will be non-nil. Any non-2xx
  2017. // status code is an error. Response headers are in either
  2018. // *AccessLevel.ServerResponse.Header or (if a response was returned at
  2019. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2020. // to check whether the returned error was because
  2021. // http.StatusNotModified was returned.
  2022. func (c *AccessPoliciesAccessLevelsGetCall) Do(opts ...googleapi.CallOption) (*AccessLevel, error) {
  2023. gensupport.SetOptions(c.urlParams_, opts...)
  2024. res, err := c.doRequest("json")
  2025. if res != nil && res.StatusCode == http.StatusNotModified {
  2026. if res.Body != nil {
  2027. res.Body.Close()
  2028. }
  2029. return nil, &googleapi.Error{
  2030. Code: res.StatusCode,
  2031. Header: res.Header,
  2032. }
  2033. }
  2034. if err != nil {
  2035. return nil, err
  2036. }
  2037. defer googleapi.CloseBody(res)
  2038. if err := googleapi.CheckResponse(res); err != nil {
  2039. return nil, err
  2040. }
  2041. ret := &AccessLevel{
  2042. ServerResponse: googleapi.ServerResponse{
  2043. Header: res.Header,
  2044. HTTPStatusCode: res.StatusCode,
  2045. },
  2046. }
  2047. target := &ret
  2048. if err := gensupport.DecodeResponse(target, res); err != nil {
  2049. return nil, err
  2050. }
  2051. return ret, nil
  2052. // {
  2053. // "description": "Get an Access Level by resource\nname.",
  2054. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}",
  2055. // "httpMethod": "GET",
  2056. // "id": "accesscontextmanager.accessPolicies.accessLevels.get",
  2057. // "parameterOrder": [
  2058. // "name"
  2059. // ],
  2060. // "parameters": {
  2061. // "accessLevelFormat": {
  2062. // "description": "Whether to return `BasicLevels` in the Cloud Common Expression\nLanguage rather than as `BasicLevels`. Defaults to AS_DEFINED, where\nAccess Levels\nare returned as `BasicLevels` or `CustomLevels` based on how they were\ncreated. If set to CEL, all Access Levels are returned as\n`CustomLevels`. In the CEL case, `BasicLevels` are translated to equivalent\n`CustomLevels`.",
  2063. // "enum": [
  2064. // "LEVEL_FORMAT_UNSPECIFIED",
  2065. // "AS_DEFINED",
  2066. // "CEL"
  2067. // ],
  2068. // "location": "query",
  2069. // "type": "string"
  2070. // },
  2071. // "name": {
  2072. // "description": "Required. Resource name for the Access Level.\n\nFormat:\n`accessPolicies/{policy_id}/accessLevels/{access_level_id}`",
  2073. // "location": "path",
  2074. // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$",
  2075. // "required": true,
  2076. // "type": "string"
  2077. // }
  2078. // },
  2079. // "path": "v1/{+name}",
  2080. // "response": {
  2081. // "$ref": "AccessLevel"
  2082. // },
  2083. // "scopes": [
  2084. // "https://www.googleapis.com/auth/cloud-platform"
  2085. // ]
  2086. // }
  2087. }
  2088. // method id "accesscontextmanager.accessPolicies.accessLevels.list":
  2089. type AccessPoliciesAccessLevelsListCall struct {
  2090. s *Service
  2091. parent string
  2092. urlParams_ gensupport.URLParams
  2093. ifNoneMatch_ string
  2094. ctx_ context.Context
  2095. header_ http.Header
  2096. }
  2097. // List: List all Access Levels for an access
  2098. // policy.
  2099. func (r *AccessPoliciesAccessLevelsService) List(parent string) *AccessPoliciesAccessLevelsListCall {
  2100. c := &AccessPoliciesAccessLevelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2101. c.parent = parent
  2102. return c
  2103. }
  2104. // AccessLevelFormat sets the optional parameter "accessLevelFormat":
  2105. // Whether to return `BasicLevels` in the Cloud Common Expression
  2106. // language, as
  2107. // `CustomLevels`, rather than as `BasicLevels`. Defaults to
  2108. // returning
  2109. // `AccessLevels` in the format they were defined.
  2110. //
  2111. // Possible values:
  2112. // "LEVEL_FORMAT_UNSPECIFIED"
  2113. // "AS_DEFINED"
  2114. // "CEL"
  2115. func (c *AccessPoliciesAccessLevelsListCall) AccessLevelFormat(accessLevelFormat string) *AccessPoliciesAccessLevelsListCall {
  2116. c.urlParams_.Set("accessLevelFormat", accessLevelFormat)
  2117. return c
  2118. }
  2119. // PageSize sets the optional parameter "pageSize": Number of Access
  2120. // Levels to include in
  2121. // the list. Default 100.
  2122. func (c *AccessPoliciesAccessLevelsListCall) PageSize(pageSize int64) *AccessPoliciesAccessLevelsListCall {
  2123. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2124. return c
  2125. }
  2126. // PageToken sets the optional parameter "pageToken": Next page token
  2127. // for the next batch of Access Level instances.
  2128. // Defaults to the first page of results.
  2129. func (c *AccessPoliciesAccessLevelsListCall) PageToken(pageToken string) *AccessPoliciesAccessLevelsListCall {
  2130. c.urlParams_.Set("pageToken", pageToken)
  2131. return c
  2132. }
  2133. // Fields allows partial responses to be retrieved. See
  2134. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2135. // for more information.
  2136. func (c *AccessPoliciesAccessLevelsListCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsListCall {
  2137. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2138. return c
  2139. }
  2140. // IfNoneMatch sets the optional parameter which makes the operation
  2141. // fail if the object's ETag matches the given value. This is useful for
  2142. // getting updates only after the object has changed since the last
  2143. // request. Use googleapi.IsNotModified to check whether the response
  2144. // error from Do is the result of In-None-Match.
  2145. func (c *AccessPoliciesAccessLevelsListCall) IfNoneMatch(entityTag string) *AccessPoliciesAccessLevelsListCall {
  2146. c.ifNoneMatch_ = entityTag
  2147. return c
  2148. }
  2149. // Context sets the context to be used in this call's Do method. Any
  2150. // pending HTTP request will be aborted if the provided context is
  2151. // canceled.
  2152. func (c *AccessPoliciesAccessLevelsListCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsListCall {
  2153. c.ctx_ = ctx
  2154. return c
  2155. }
  2156. // Header returns an http.Header that can be modified by the caller to
  2157. // add HTTP headers to the request.
  2158. func (c *AccessPoliciesAccessLevelsListCall) Header() http.Header {
  2159. if c.header_ == nil {
  2160. c.header_ = make(http.Header)
  2161. }
  2162. return c.header_
  2163. }
  2164. func (c *AccessPoliciesAccessLevelsListCall) doRequest(alt string) (*http.Response, error) {
  2165. reqHeaders := make(http.Header)
  2166. for k, v := range c.header_ {
  2167. reqHeaders[k] = v
  2168. }
  2169. reqHeaders.Set("User-Agent", c.s.userAgent())
  2170. if c.ifNoneMatch_ != "" {
  2171. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2172. }
  2173. var body io.Reader = nil
  2174. c.urlParams_.Set("alt", alt)
  2175. c.urlParams_.Set("prettyPrint", "false")
  2176. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/accessLevels")
  2177. urls += "?" + c.urlParams_.Encode()
  2178. req, err := http.NewRequest("GET", urls, body)
  2179. if err != nil {
  2180. return nil, err
  2181. }
  2182. req.Header = reqHeaders
  2183. googleapi.Expand(req.URL, map[string]string{
  2184. "parent": c.parent,
  2185. })
  2186. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2187. }
  2188. // Do executes the "accesscontextmanager.accessPolicies.accessLevels.list" call.
  2189. // Exactly one of *ListAccessLevelsResponse or error will be non-nil.
  2190. // Any non-2xx status code is an error. Response headers are in either
  2191. // *ListAccessLevelsResponse.ServerResponse.Header or (if a response was
  2192. // returned at all) in error.(*googleapi.Error).Header. Use
  2193. // googleapi.IsNotModified to check whether the returned error was
  2194. // because http.StatusNotModified was returned.
  2195. func (c *AccessPoliciesAccessLevelsListCall) Do(opts ...googleapi.CallOption) (*ListAccessLevelsResponse, error) {
  2196. gensupport.SetOptions(c.urlParams_, opts...)
  2197. res, err := c.doRequest("json")
  2198. if res != nil && res.StatusCode == http.StatusNotModified {
  2199. if res.Body != nil {
  2200. res.Body.Close()
  2201. }
  2202. return nil, &googleapi.Error{
  2203. Code: res.StatusCode,
  2204. Header: res.Header,
  2205. }
  2206. }
  2207. if err != nil {
  2208. return nil, err
  2209. }
  2210. defer googleapi.CloseBody(res)
  2211. if err := googleapi.CheckResponse(res); err != nil {
  2212. return nil, err
  2213. }
  2214. ret := &ListAccessLevelsResponse{
  2215. ServerResponse: googleapi.ServerResponse{
  2216. Header: res.Header,
  2217. HTTPStatusCode: res.StatusCode,
  2218. },
  2219. }
  2220. target := &ret
  2221. if err := gensupport.DecodeResponse(target, res); err != nil {
  2222. return nil, err
  2223. }
  2224. return ret, nil
  2225. // {
  2226. // "description": "List all Access Levels for an access\npolicy.",
  2227. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/accessLevels",
  2228. // "httpMethod": "GET",
  2229. // "id": "accesscontextmanager.accessPolicies.accessLevels.list",
  2230. // "parameterOrder": [
  2231. // "parent"
  2232. // ],
  2233. // "parameters": {
  2234. // "accessLevelFormat": {
  2235. // "description": "Whether to return `BasicLevels` in the Cloud Common Expression language, as\n`CustomLevels`, rather than as `BasicLevels`. Defaults to returning\n`AccessLevels` in the format they were defined.",
  2236. // "enum": [
  2237. // "LEVEL_FORMAT_UNSPECIFIED",
  2238. // "AS_DEFINED",
  2239. // "CEL"
  2240. // ],
  2241. // "location": "query",
  2242. // "type": "string"
  2243. // },
  2244. // "pageSize": {
  2245. // "description": "Number of Access Levels to include in\nthe list. Default 100.",
  2246. // "format": "int32",
  2247. // "location": "query",
  2248. // "type": "integer"
  2249. // },
  2250. // "pageToken": {
  2251. // "description": "Next page token for the next batch of Access Level instances.\nDefaults to the first page of results.",
  2252. // "location": "query",
  2253. // "type": "string"
  2254. // },
  2255. // "parent": {
  2256. // "description": "Required. Resource name for the access policy to list Access Levels from.\n\nFormat:\n`accessPolicies/{policy_id}`",
  2257. // "location": "path",
  2258. // "pattern": "^accessPolicies/[^/]+$",
  2259. // "required": true,
  2260. // "type": "string"
  2261. // }
  2262. // },
  2263. // "path": "v1/{+parent}/accessLevels",
  2264. // "response": {
  2265. // "$ref": "ListAccessLevelsResponse"
  2266. // },
  2267. // "scopes": [
  2268. // "https://www.googleapis.com/auth/cloud-platform"
  2269. // ]
  2270. // }
  2271. }
  2272. // Pages invokes f for each page of results.
  2273. // A non-nil error returned from f will halt the iteration.
  2274. // The provided context supersedes any context provided to the Context method.
  2275. func (c *AccessPoliciesAccessLevelsListCall) Pages(ctx context.Context, f func(*ListAccessLevelsResponse) error) error {
  2276. c.ctx_ = ctx
  2277. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2278. for {
  2279. x, err := c.Do()
  2280. if err != nil {
  2281. return err
  2282. }
  2283. if err := f(x); err != nil {
  2284. return err
  2285. }
  2286. if x.NextPageToken == "" {
  2287. return nil
  2288. }
  2289. c.PageToken(x.NextPageToken)
  2290. }
  2291. }
  2292. // method id "accesscontextmanager.accessPolicies.accessLevels.patch":
  2293. type AccessPoliciesAccessLevelsPatchCall struct {
  2294. s *Service
  2295. name string
  2296. accesslevel *AccessLevel
  2297. urlParams_ gensupport.URLParams
  2298. ctx_ context.Context
  2299. header_ http.Header
  2300. }
  2301. // Patch: Update an Access Level. The longrunning
  2302. // operation from this RPC will have a successful status once the
  2303. // changes to
  2304. // the Access Level have propagated
  2305. // to long-lasting storage. Access Levels containing
  2306. // errors will result in an error response for the first error
  2307. // encountered.
  2308. func (r *AccessPoliciesAccessLevelsService) Patch(name string, accesslevel *AccessLevel) *AccessPoliciesAccessLevelsPatchCall {
  2309. c := &AccessPoliciesAccessLevelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2310. c.name = name
  2311. c.accesslevel = accesslevel
  2312. return c
  2313. }
  2314. // UpdateMask sets the optional parameter "updateMask": Required. Mask
  2315. // to control which fields get updated. Must be non-empty.
  2316. func (c *AccessPoliciesAccessLevelsPatchCall) UpdateMask(updateMask string) *AccessPoliciesAccessLevelsPatchCall {
  2317. c.urlParams_.Set("updateMask", updateMask)
  2318. return c
  2319. }
  2320. // Fields allows partial responses to be retrieved. See
  2321. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2322. // for more information.
  2323. func (c *AccessPoliciesAccessLevelsPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesAccessLevelsPatchCall {
  2324. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2325. return c
  2326. }
  2327. // Context sets the context to be used in this call's Do method. Any
  2328. // pending HTTP request will be aborted if the provided context is
  2329. // canceled.
  2330. func (c *AccessPoliciesAccessLevelsPatchCall) Context(ctx context.Context) *AccessPoliciesAccessLevelsPatchCall {
  2331. c.ctx_ = ctx
  2332. return c
  2333. }
  2334. // Header returns an http.Header that can be modified by the caller to
  2335. // add HTTP headers to the request.
  2336. func (c *AccessPoliciesAccessLevelsPatchCall) Header() http.Header {
  2337. if c.header_ == nil {
  2338. c.header_ = make(http.Header)
  2339. }
  2340. return c.header_
  2341. }
  2342. func (c *AccessPoliciesAccessLevelsPatchCall) doRequest(alt string) (*http.Response, error) {
  2343. reqHeaders := make(http.Header)
  2344. for k, v := range c.header_ {
  2345. reqHeaders[k] = v
  2346. }
  2347. reqHeaders.Set("User-Agent", c.s.userAgent())
  2348. var body io.Reader = nil
  2349. body, err := googleapi.WithoutDataWrapper.JSONReader(c.accesslevel)
  2350. if err != nil {
  2351. return nil, err
  2352. }
  2353. reqHeaders.Set("Content-Type", "application/json")
  2354. c.urlParams_.Set("alt", alt)
  2355. c.urlParams_.Set("prettyPrint", "false")
  2356. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2357. urls += "?" + c.urlParams_.Encode()
  2358. req, err := http.NewRequest("PATCH", urls, body)
  2359. if err != nil {
  2360. return nil, err
  2361. }
  2362. req.Header = reqHeaders
  2363. googleapi.Expand(req.URL, map[string]string{
  2364. "name": c.name,
  2365. })
  2366. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2367. }
  2368. // Do executes the "accesscontextmanager.accessPolicies.accessLevels.patch" call.
  2369. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2370. // status code is an error. Response headers are in either
  2371. // *Operation.ServerResponse.Header or (if a response was returned at
  2372. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2373. // to check whether the returned error was because
  2374. // http.StatusNotModified was returned.
  2375. func (c *AccessPoliciesAccessLevelsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2376. gensupport.SetOptions(c.urlParams_, opts...)
  2377. res, err := c.doRequest("json")
  2378. if res != nil && res.StatusCode == http.StatusNotModified {
  2379. if res.Body != nil {
  2380. res.Body.Close()
  2381. }
  2382. return nil, &googleapi.Error{
  2383. Code: res.StatusCode,
  2384. Header: res.Header,
  2385. }
  2386. }
  2387. if err != nil {
  2388. return nil, err
  2389. }
  2390. defer googleapi.CloseBody(res)
  2391. if err := googleapi.CheckResponse(res); err != nil {
  2392. return nil, err
  2393. }
  2394. ret := &Operation{
  2395. ServerResponse: googleapi.ServerResponse{
  2396. Header: res.Header,
  2397. HTTPStatusCode: res.StatusCode,
  2398. },
  2399. }
  2400. target := &ret
  2401. if err := gensupport.DecodeResponse(target, res); err != nil {
  2402. return nil, err
  2403. }
  2404. return ret, nil
  2405. // {
  2406. // "description": "Update an Access Level. The longrunning\noperation from this RPC will have a successful status once the changes to\nthe Access Level have propagated\nto long-lasting storage. Access Levels containing\nerrors will result in an error response for the first error encountered.",
  2407. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/accessLevels/{accessLevelsId}",
  2408. // "httpMethod": "PATCH",
  2409. // "id": "accesscontextmanager.accessPolicies.accessLevels.patch",
  2410. // "parameterOrder": [
  2411. // "name"
  2412. // ],
  2413. // "parameters": {
  2414. // "name": {
  2415. // "description": "Required. Resource name for the Access Level. The `short_name` component\nmust begin with a letter and only include alphanumeric and '_'. Format:\n`accessPolicies/{policy_id}/accessLevels/{short_name}`",
  2416. // "location": "path",
  2417. // "pattern": "^accessPolicies/[^/]+/accessLevels/[^/]+$",
  2418. // "required": true,
  2419. // "type": "string"
  2420. // },
  2421. // "updateMask": {
  2422. // "description": "Required. Mask to control which fields get updated. Must be non-empty.",
  2423. // "format": "google-fieldmask",
  2424. // "location": "query",
  2425. // "type": "string"
  2426. // }
  2427. // },
  2428. // "path": "v1/{+name}",
  2429. // "request": {
  2430. // "$ref": "AccessLevel"
  2431. // },
  2432. // "response": {
  2433. // "$ref": "Operation"
  2434. // },
  2435. // "scopes": [
  2436. // "https://www.googleapis.com/auth/cloud-platform"
  2437. // ]
  2438. // }
  2439. }
  2440. // method id "accesscontextmanager.accessPolicies.servicePerimeters.create":
  2441. type AccessPoliciesServicePerimetersCreateCall struct {
  2442. s *Service
  2443. parent string
  2444. serviceperimeter *ServicePerimeter
  2445. urlParams_ gensupport.URLParams
  2446. ctx_ context.Context
  2447. header_ http.Header
  2448. }
  2449. // Create: Create an Service Perimeter. The
  2450. // longrunning operation from this RPC will have a successful status
  2451. // once the
  2452. // Service Perimeter has
  2453. // propagated to long-lasting storage. Service Perimeters
  2454. // containing
  2455. // errors will result in an error response for the first error
  2456. // encountered.
  2457. func (r *AccessPoliciesServicePerimetersService) Create(parent string, serviceperimeter *ServicePerimeter) *AccessPoliciesServicePerimetersCreateCall {
  2458. c := &AccessPoliciesServicePerimetersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2459. c.parent = parent
  2460. c.serviceperimeter = serviceperimeter
  2461. return c
  2462. }
  2463. // Fields allows partial responses to be retrieved. See
  2464. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2465. // for more information.
  2466. func (c *AccessPoliciesServicePerimetersCreateCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersCreateCall {
  2467. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2468. return c
  2469. }
  2470. // Context sets the context to be used in this call's Do method. Any
  2471. // pending HTTP request will be aborted if the provided context is
  2472. // canceled.
  2473. func (c *AccessPoliciesServicePerimetersCreateCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersCreateCall {
  2474. c.ctx_ = ctx
  2475. return c
  2476. }
  2477. // Header returns an http.Header that can be modified by the caller to
  2478. // add HTTP headers to the request.
  2479. func (c *AccessPoliciesServicePerimetersCreateCall) Header() http.Header {
  2480. if c.header_ == nil {
  2481. c.header_ = make(http.Header)
  2482. }
  2483. return c.header_
  2484. }
  2485. func (c *AccessPoliciesServicePerimetersCreateCall) doRequest(alt string) (*http.Response, error) {
  2486. reqHeaders := make(http.Header)
  2487. for k, v := range c.header_ {
  2488. reqHeaders[k] = v
  2489. }
  2490. reqHeaders.Set("User-Agent", c.s.userAgent())
  2491. var body io.Reader = nil
  2492. body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceperimeter)
  2493. if err != nil {
  2494. return nil, err
  2495. }
  2496. reqHeaders.Set("Content-Type", "application/json")
  2497. c.urlParams_.Set("alt", alt)
  2498. c.urlParams_.Set("prettyPrint", "false")
  2499. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/servicePerimeters")
  2500. urls += "?" + c.urlParams_.Encode()
  2501. req, err := http.NewRequest("POST", urls, body)
  2502. if err != nil {
  2503. return nil, err
  2504. }
  2505. req.Header = reqHeaders
  2506. googleapi.Expand(req.URL, map[string]string{
  2507. "parent": c.parent,
  2508. })
  2509. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2510. }
  2511. // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.create" call.
  2512. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2513. // status code is an error. Response headers are in either
  2514. // *Operation.ServerResponse.Header or (if a response was returned at
  2515. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2516. // to check whether the returned error was because
  2517. // http.StatusNotModified was returned.
  2518. func (c *AccessPoliciesServicePerimetersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2519. gensupport.SetOptions(c.urlParams_, opts...)
  2520. res, err := c.doRequest("json")
  2521. if res != nil && res.StatusCode == http.StatusNotModified {
  2522. if res.Body != nil {
  2523. res.Body.Close()
  2524. }
  2525. return nil, &googleapi.Error{
  2526. Code: res.StatusCode,
  2527. Header: res.Header,
  2528. }
  2529. }
  2530. if err != nil {
  2531. return nil, err
  2532. }
  2533. defer googleapi.CloseBody(res)
  2534. if err := googleapi.CheckResponse(res); err != nil {
  2535. return nil, err
  2536. }
  2537. ret := &Operation{
  2538. ServerResponse: googleapi.ServerResponse{
  2539. Header: res.Header,
  2540. HTTPStatusCode: res.StatusCode,
  2541. },
  2542. }
  2543. target := &ret
  2544. if err := gensupport.DecodeResponse(target, res); err != nil {
  2545. return nil, err
  2546. }
  2547. return ret, nil
  2548. // {
  2549. // "description": "Create an Service Perimeter. The\nlongrunning operation from this RPC will have a successful status once the\nService Perimeter has\npropagated to long-lasting storage. Service Perimeters containing\nerrors will result in an error response for the first error encountered.",
  2550. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/servicePerimeters",
  2551. // "httpMethod": "POST",
  2552. // "id": "accesscontextmanager.accessPolicies.servicePerimeters.create",
  2553. // "parameterOrder": [
  2554. // "parent"
  2555. // ],
  2556. // "parameters": {
  2557. // "parent": {
  2558. // "description": "Required. Resource name for the access policy which owns this Service\nPerimeter.\n\nFormat: `accessPolicies/{policy_id}`",
  2559. // "location": "path",
  2560. // "pattern": "^accessPolicies/[^/]+$",
  2561. // "required": true,
  2562. // "type": "string"
  2563. // }
  2564. // },
  2565. // "path": "v1/{+parent}/servicePerimeters",
  2566. // "request": {
  2567. // "$ref": "ServicePerimeter"
  2568. // },
  2569. // "response": {
  2570. // "$ref": "Operation"
  2571. // },
  2572. // "scopes": [
  2573. // "https://www.googleapis.com/auth/cloud-platform"
  2574. // ]
  2575. // }
  2576. }
  2577. // method id "accesscontextmanager.accessPolicies.servicePerimeters.delete":
  2578. type AccessPoliciesServicePerimetersDeleteCall struct {
  2579. s *Service
  2580. name string
  2581. urlParams_ gensupport.URLParams
  2582. ctx_ context.Context
  2583. header_ http.Header
  2584. }
  2585. // Delete: Delete an Service Perimeter by resource
  2586. // name. The longrunning operation from this RPC will have a successful
  2587. // status
  2588. // once the Service Perimeter has been
  2589. // removed from long-lasting storage.
  2590. func (r *AccessPoliciesServicePerimetersService) Delete(name string) *AccessPoliciesServicePerimetersDeleteCall {
  2591. c := &AccessPoliciesServicePerimetersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2592. c.name = name
  2593. return c
  2594. }
  2595. // Fields allows partial responses to be retrieved. See
  2596. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2597. // for more information.
  2598. func (c *AccessPoliciesServicePerimetersDeleteCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersDeleteCall {
  2599. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2600. return c
  2601. }
  2602. // Context sets the context to be used in this call's Do method. Any
  2603. // pending HTTP request will be aborted if the provided context is
  2604. // canceled.
  2605. func (c *AccessPoliciesServicePerimetersDeleteCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersDeleteCall {
  2606. c.ctx_ = ctx
  2607. return c
  2608. }
  2609. // Header returns an http.Header that can be modified by the caller to
  2610. // add HTTP headers to the request.
  2611. func (c *AccessPoliciesServicePerimetersDeleteCall) Header() http.Header {
  2612. if c.header_ == nil {
  2613. c.header_ = make(http.Header)
  2614. }
  2615. return c.header_
  2616. }
  2617. func (c *AccessPoliciesServicePerimetersDeleteCall) doRequest(alt string) (*http.Response, error) {
  2618. reqHeaders := make(http.Header)
  2619. for k, v := range c.header_ {
  2620. reqHeaders[k] = v
  2621. }
  2622. reqHeaders.Set("User-Agent", c.s.userAgent())
  2623. var body io.Reader = nil
  2624. c.urlParams_.Set("alt", alt)
  2625. c.urlParams_.Set("prettyPrint", "false")
  2626. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2627. urls += "?" + c.urlParams_.Encode()
  2628. req, err := http.NewRequest("DELETE", urls, body)
  2629. if err != nil {
  2630. return nil, err
  2631. }
  2632. req.Header = reqHeaders
  2633. googleapi.Expand(req.URL, map[string]string{
  2634. "name": c.name,
  2635. })
  2636. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2637. }
  2638. // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.delete" call.
  2639. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2640. // status code is an error. Response headers are in either
  2641. // *Operation.ServerResponse.Header or (if a response was returned at
  2642. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2643. // to check whether the returned error was because
  2644. // http.StatusNotModified was returned.
  2645. func (c *AccessPoliciesServicePerimetersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2646. gensupport.SetOptions(c.urlParams_, opts...)
  2647. res, err := c.doRequest("json")
  2648. if res != nil && res.StatusCode == http.StatusNotModified {
  2649. if res.Body != nil {
  2650. res.Body.Close()
  2651. }
  2652. return nil, &googleapi.Error{
  2653. Code: res.StatusCode,
  2654. Header: res.Header,
  2655. }
  2656. }
  2657. if err != nil {
  2658. return nil, err
  2659. }
  2660. defer googleapi.CloseBody(res)
  2661. if err := googleapi.CheckResponse(res); err != nil {
  2662. return nil, err
  2663. }
  2664. ret := &Operation{
  2665. ServerResponse: googleapi.ServerResponse{
  2666. Header: res.Header,
  2667. HTTPStatusCode: res.StatusCode,
  2668. },
  2669. }
  2670. target := &ret
  2671. if err := gensupport.DecodeResponse(target, res); err != nil {
  2672. return nil, err
  2673. }
  2674. return ret, nil
  2675. // {
  2676. // "description": "Delete an Service Perimeter by resource\nname. The longrunning operation from this RPC will have a successful status\nonce the Service Perimeter has been\nremoved from long-lasting storage.",
  2677. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}",
  2678. // "httpMethod": "DELETE",
  2679. // "id": "accesscontextmanager.accessPolicies.servicePerimeters.delete",
  2680. // "parameterOrder": [
  2681. // "name"
  2682. // ],
  2683. // "parameters": {
  2684. // "name": {
  2685. // "description": "Required. Resource name for the Service Perimeter.\n\nFormat:\n`accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`",
  2686. // "location": "path",
  2687. // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$",
  2688. // "required": true,
  2689. // "type": "string"
  2690. // }
  2691. // },
  2692. // "path": "v1/{+name}",
  2693. // "response": {
  2694. // "$ref": "Operation"
  2695. // },
  2696. // "scopes": [
  2697. // "https://www.googleapis.com/auth/cloud-platform"
  2698. // ]
  2699. // }
  2700. }
  2701. // method id "accesscontextmanager.accessPolicies.servicePerimeters.get":
  2702. type AccessPoliciesServicePerimetersGetCall struct {
  2703. s *Service
  2704. name string
  2705. urlParams_ gensupport.URLParams
  2706. ifNoneMatch_ string
  2707. ctx_ context.Context
  2708. header_ http.Header
  2709. }
  2710. // Get: Get an Service Perimeter by resource
  2711. // name.
  2712. func (r *AccessPoliciesServicePerimetersService) Get(name string) *AccessPoliciesServicePerimetersGetCall {
  2713. c := &AccessPoliciesServicePerimetersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2714. c.name = name
  2715. return c
  2716. }
  2717. // Fields allows partial responses to be retrieved. See
  2718. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2719. // for more information.
  2720. func (c *AccessPoliciesServicePerimetersGetCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersGetCall {
  2721. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2722. return c
  2723. }
  2724. // IfNoneMatch sets the optional parameter which makes the operation
  2725. // fail if the object's ETag matches the given value. This is useful for
  2726. // getting updates only after the object has changed since the last
  2727. // request. Use googleapi.IsNotModified to check whether the response
  2728. // error from Do is the result of In-None-Match.
  2729. func (c *AccessPoliciesServicePerimetersGetCall) IfNoneMatch(entityTag string) *AccessPoliciesServicePerimetersGetCall {
  2730. c.ifNoneMatch_ = entityTag
  2731. return c
  2732. }
  2733. // Context sets the context to be used in this call's Do method. Any
  2734. // pending HTTP request will be aborted if the provided context is
  2735. // canceled.
  2736. func (c *AccessPoliciesServicePerimetersGetCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersGetCall {
  2737. c.ctx_ = ctx
  2738. return c
  2739. }
  2740. // Header returns an http.Header that can be modified by the caller to
  2741. // add HTTP headers to the request.
  2742. func (c *AccessPoliciesServicePerimetersGetCall) Header() http.Header {
  2743. if c.header_ == nil {
  2744. c.header_ = make(http.Header)
  2745. }
  2746. return c.header_
  2747. }
  2748. func (c *AccessPoliciesServicePerimetersGetCall) doRequest(alt string) (*http.Response, error) {
  2749. reqHeaders := make(http.Header)
  2750. for k, v := range c.header_ {
  2751. reqHeaders[k] = v
  2752. }
  2753. reqHeaders.Set("User-Agent", c.s.userAgent())
  2754. if c.ifNoneMatch_ != "" {
  2755. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2756. }
  2757. var body io.Reader = nil
  2758. c.urlParams_.Set("alt", alt)
  2759. c.urlParams_.Set("prettyPrint", "false")
  2760. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2761. urls += "?" + c.urlParams_.Encode()
  2762. req, err := http.NewRequest("GET", urls, body)
  2763. if err != nil {
  2764. return nil, err
  2765. }
  2766. req.Header = reqHeaders
  2767. googleapi.Expand(req.URL, map[string]string{
  2768. "name": c.name,
  2769. })
  2770. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2771. }
  2772. // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.get" call.
  2773. // Exactly one of *ServicePerimeter or error will be non-nil. Any
  2774. // non-2xx status code is an error. Response headers are in either
  2775. // *ServicePerimeter.ServerResponse.Header or (if a response was
  2776. // returned at all) in error.(*googleapi.Error).Header. Use
  2777. // googleapi.IsNotModified to check whether the returned error was
  2778. // because http.StatusNotModified was returned.
  2779. func (c *AccessPoliciesServicePerimetersGetCall) Do(opts ...googleapi.CallOption) (*ServicePerimeter, error) {
  2780. gensupport.SetOptions(c.urlParams_, opts...)
  2781. res, err := c.doRequest("json")
  2782. if res != nil && res.StatusCode == http.StatusNotModified {
  2783. if res.Body != nil {
  2784. res.Body.Close()
  2785. }
  2786. return nil, &googleapi.Error{
  2787. Code: res.StatusCode,
  2788. Header: res.Header,
  2789. }
  2790. }
  2791. if err != nil {
  2792. return nil, err
  2793. }
  2794. defer googleapi.CloseBody(res)
  2795. if err := googleapi.CheckResponse(res); err != nil {
  2796. return nil, err
  2797. }
  2798. ret := &ServicePerimeter{
  2799. ServerResponse: googleapi.ServerResponse{
  2800. Header: res.Header,
  2801. HTTPStatusCode: res.StatusCode,
  2802. },
  2803. }
  2804. target := &ret
  2805. if err := gensupport.DecodeResponse(target, res); err != nil {
  2806. return nil, err
  2807. }
  2808. return ret, nil
  2809. // {
  2810. // "description": "Get an Service Perimeter by resource\nname.",
  2811. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}",
  2812. // "httpMethod": "GET",
  2813. // "id": "accesscontextmanager.accessPolicies.servicePerimeters.get",
  2814. // "parameterOrder": [
  2815. // "name"
  2816. // ],
  2817. // "parameters": {
  2818. // "name": {
  2819. // "description": "Required. Resource name for the Service Perimeter.\n\nFormat:\n`accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`",
  2820. // "location": "path",
  2821. // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$",
  2822. // "required": true,
  2823. // "type": "string"
  2824. // }
  2825. // },
  2826. // "path": "v1/{+name}",
  2827. // "response": {
  2828. // "$ref": "ServicePerimeter"
  2829. // },
  2830. // "scopes": [
  2831. // "https://www.googleapis.com/auth/cloud-platform"
  2832. // ]
  2833. // }
  2834. }
  2835. // method id "accesscontextmanager.accessPolicies.servicePerimeters.list":
  2836. type AccessPoliciesServicePerimetersListCall struct {
  2837. s *Service
  2838. parent string
  2839. urlParams_ gensupport.URLParams
  2840. ifNoneMatch_ string
  2841. ctx_ context.Context
  2842. header_ http.Header
  2843. }
  2844. // List: List all Service Perimeters for an
  2845. // access policy.
  2846. func (r *AccessPoliciesServicePerimetersService) List(parent string) *AccessPoliciesServicePerimetersListCall {
  2847. c := &AccessPoliciesServicePerimetersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2848. c.parent = parent
  2849. return c
  2850. }
  2851. // PageSize sets the optional parameter "pageSize": Number of Service
  2852. // Perimeters to include
  2853. // in the list. Default 100.
  2854. func (c *AccessPoliciesServicePerimetersListCall) PageSize(pageSize int64) *AccessPoliciesServicePerimetersListCall {
  2855. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2856. return c
  2857. }
  2858. // PageToken sets the optional parameter "pageToken": Next page token
  2859. // for the next batch of Service Perimeter instances.
  2860. // Defaults to the first page of results.
  2861. func (c *AccessPoliciesServicePerimetersListCall) PageToken(pageToken string) *AccessPoliciesServicePerimetersListCall {
  2862. c.urlParams_.Set("pageToken", pageToken)
  2863. return c
  2864. }
  2865. // Fields allows partial responses to be retrieved. See
  2866. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2867. // for more information.
  2868. func (c *AccessPoliciesServicePerimetersListCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersListCall {
  2869. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2870. return c
  2871. }
  2872. // IfNoneMatch sets the optional parameter which makes the operation
  2873. // fail if the object's ETag matches the given value. This is useful for
  2874. // getting updates only after the object has changed since the last
  2875. // request. Use googleapi.IsNotModified to check whether the response
  2876. // error from Do is the result of In-None-Match.
  2877. func (c *AccessPoliciesServicePerimetersListCall) IfNoneMatch(entityTag string) *AccessPoliciesServicePerimetersListCall {
  2878. c.ifNoneMatch_ = entityTag
  2879. return c
  2880. }
  2881. // Context sets the context to be used in this call's Do method. Any
  2882. // pending HTTP request will be aborted if the provided context is
  2883. // canceled.
  2884. func (c *AccessPoliciesServicePerimetersListCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersListCall {
  2885. c.ctx_ = ctx
  2886. return c
  2887. }
  2888. // Header returns an http.Header that can be modified by the caller to
  2889. // add HTTP headers to the request.
  2890. func (c *AccessPoliciesServicePerimetersListCall) Header() http.Header {
  2891. if c.header_ == nil {
  2892. c.header_ = make(http.Header)
  2893. }
  2894. return c.header_
  2895. }
  2896. func (c *AccessPoliciesServicePerimetersListCall) doRequest(alt string) (*http.Response, error) {
  2897. reqHeaders := make(http.Header)
  2898. for k, v := range c.header_ {
  2899. reqHeaders[k] = v
  2900. }
  2901. reqHeaders.Set("User-Agent", c.s.userAgent())
  2902. if c.ifNoneMatch_ != "" {
  2903. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2904. }
  2905. var body io.Reader = nil
  2906. c.urlParams_.Set("alt", alt)
  2907. c.urlParams_.Set("prettyPrint", "false")
  2908. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/servicePerimeters")
  2909. urls += "?" + c.urlParams_.Encode()
  2910. req, err := http.NewRequest("GET", urls, body)
  2911. if err != nil {
  2912. return nil, err
  2913. }
  2914. req.Header = reqHeaders
  2915. googleapi.Expand(req.URL, map[string]string{
  2916. "parent": c.parent,
  2917. })
  2918. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2919. }
  2920. // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.list" call.
  2921. // Exactly one of *ListServicePerimetersResponse or error will be
  2922. // non-nil. Any non-2xx status code is an error. Response headers are in
  2923. // either *ListServicePerimetersResponse.ServerResponse.Header or (if a
  2924. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2925. // googleapi.IsNotModified to check whether the returned error was
  2926. // because http.StatusNotModified was returned.
  2927. func (c *AccessPoliciesServicePerimetersListCall) Do(opts ...googleapi.CallOption) (*ListServicePerimetersResponse, error) {
  2928. gensupport.SetOptions(c.urlParams_, opts...)
  2929. res, err := c.doRequest("json")
  2930. if res != nil && res.StatusCode == http.StatusNotModified {
  2931. if res.Body != nil {
  2932. res.Body.Close()
  2933. }
  2934. return nil, &googleapi.Error{
  2935. Code: res.StatusCode,
  2936. Header: res.Header,
  2937. }
  2938. }
  2939. if err != nil {
  2940. return nil, err
  2941. }
  2942. defer googleapi.CloseBody(res)
  2943. if err := googleapi.CheckResponse(res); err != nil {
  2944. return nil, err
  2945. }
  2946. ret := &ListServicePerimetersResponse{
  2947. ServerResponse: googleapi.ServerResponse{
  2948. Header: res.Header,
  2949. HTTPStatusCode: res.StatusCode,
  2950. },
  2951. }
  2952. target := &ret
  2953. if err := gensupport.DecodeResponse(target, res); err != nil {
  2954. return nil, err
  2955. }
  2956. return ret, nil
  2957. // {
  2958. // "description": "List all Service Perimeters for an\naccess policy.",
  2959. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/servicePerimeters",
  2960. // "httpMethod": "GET",
  2961. // "id": "accesscontextmanager.accessPolicies.servicePerimeters.list",
  2962. // "parameterOrder": [
  2963. // "parent"
  2964. // ],
  2965. // "parameters": {
  2966. // "pageSize": {
  2967. // "description": "Number of Service Perimeters to include\nin the list. Default 100.",
  2968. // "format": "int32",
  2969. // "location": "query",
  2970. // "type": "integer"
  2971. // },
  2972. // "pageToken": {
  2973. // "description": "Next page token for the next batch of Service Perimeter instances.\nDefaults to the first page of results.",
  2974. // "location": "query",
  2975. // "type": "string"
  2976. // },
  2977. // "parent": {
  2978. // "description": "Required. Resource name for the access policy to list Service Perimeters from.\n\nFormat:\n`accessPolicies/{policy_id}`",
  2979. // "location": "path",
  2980. // "pattern": "^accessPolicies/[^/]+$",
  2981. // "required": true,
  2982. // "type": "string"
  2983. // }
  2984. // },
  2985. // "path": "v1/{+parent}/servicePerimeters",
  2986. // "response": {
  2987. // "$ref": "ListServicePerimetersResponse"
  2988. // },
  2989. // "scopes": [
  2990. // "https://www.googleapis.com/auth/cloud-platform"
  2991. // ]
  2992. // }
  2993. }
  2994. // Pages invokes f for each page of results.
  2995. // A non-nil error returned from f will halt the iteration.
  2996. // The provided context supersedes any context provided to the Context method.
  2997. func (c *AccessPoliciesServicePerimetersListCall) Pages(ctx context.Context, f func(*ListServicePerimetersResponse) error) error {
  2998. c.ctx_ = ctx
  2999. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3000. for {
  3001. x, err := c.Do()
  3002. if err != nil {
  3003. return err
  3004. }
  3005. if err := f(x); err != nil {
  3006. return err
  3007. }
  3008. if x.NextPageToken == "" {
  3009. return nil
  3010. }
  3011. c.PageToken(x.NextPageToken)
  3012. }
  3013. }
  3014. // method id "accesscontextmanager.accessPolicies.servicePerimeters.patch":
  3015. type AccessPoliciesServicePerimetersPatchCall struct {
  3016. s *Service
  3017. name string
  3018. serviceperimeter *ServicePerimeter
  3019. urlParams_ gensupport.URLParams
  3020. ctx_ context.Context
  3021. header_ http.Header
  3022. }
  3023. // Patch: Update an Service Perimeter. The
  3024. // longrunning operation from this RPC will have a successful status
  3025. // once the
  3026. // changes to the Service Perimeter have
  3027. // propagated to long-lasting storage. Service Perimeter
  3028. // containing
  3029. // errors will result in an error response for the first error
  3030. // encountered.
  3031. func (r *AccessPoliciesServicePerimetersService) Patch(name string, serviceperimeter *ServicePerimeter) *AccessPoliciesServicePerimetersPatchCall {
  3032. c := &AccessPoliciesServicePerimetersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3033. c.name = name
  3034. c.serviceperimeter = serviceperimeter
  3035. return c
  3036. }
  3037. // UpdateMask sets the optional parameter "updateMask": Required. Mask
  3038. // to control which fields get updated. Must be non-empty.
  3039. func (c *AccessPoliciesServicePerimetersPatchCall) UpdateMask(updateMask string) *AccessPoliciesServicePerimetersPatchCall {
  3040. c.urlParams_.Set("updateMask", updateMask)
  3041. return c
  3042. }
  3043. // Fields allows partial responses to be retrieved. See
  3044. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3045. // for more information.
  3046. func (c *AccessPoliciesServicePerimetersPatchCall) Fields(s ...googleapi.Field) *AccessPoliciesServicePerimetersPatchCall {
  3047. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3048. return c
  3049. }
  3050. // Context sets the context to be used in this call's Do method. Any
  3051. // pending HTTP request will be aborted if the provided context is
  3052. // canceled.
  3053. func (c *AccessPoliciesServicePerimetersPatchCall) Context(ctx context.Context) *AccessPoliciesServicePerimetersPatchCall {
  3054. c.ctx_ = ctx
  3055. return c
  3056. }
  3057. // Header returns an http.Header that can be modified by the caller to
  3058. // add HTTP headers to the request.
  3059. func (c *AccessPoliciesServicePerimetersPatchCall) Header() http.Header {
  3060. if c.header_ == nil {
  3061. c.header_ = make(http.Header)
  3062. }
  3063. return c.header_
  3064. }
  3065. func (c *AccessPoliciesServicePerimetersPatchCall) doRequest(alt string) (*http.Response, error) {
  3066. reqHeaders := make(http.Header)
  3067. for k, v := range c.header_ {
  3068. reqHeaders[k] = v
  3069. }
  3070. reqHeaders.Set("User-Agent", c.s.userAgent())
  3071. var body io.Reader = nil
  3072. body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceperimeter)
  3073. if err != nil {
  3074. return nil, err
  3075. }
  3076. reqHeaders.Set("Content-Type", "application/json")
  3077. c.urlParams_.Set("alt", alt)
  3078. c.urlParams_.Set("prettyPrint", "false")
  3079. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3080. urls += "?" + c.urlParams_.Encode()
  3081. req, err := http.NewRequest("PATCH", urls, body)
  3082. if err != nil {
  3083. return nil, err
  3084. }
  3085. req.Header = reqHeaders
  3086. googleapi.Expand(req.URL, map[string]string{
  3087. "name": c.name,
  3088. })
  3089. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3090. }
  3091. // Do executes the "accesscontextmanager.accessPolicies.servicePerimeters.patch" call.
  3092. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3093. // status code is an error. Response headers are in either
  3094. // *Operation.ServerResponse.Header or (if a response was returned at
  3095. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3096. // to check whether the returned error was because
  3097. // http.StatusNotModified was returned.
  3098. func (c *AccessPoliciesServicePerimetersPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3099. gensupport.SetOptions(c.urlParams_, opts...)
  3100. res, err := c.doRequest("json")
  3101. if res != nil && res.StatusCode == http.StatusNotModified {
  3102. if res.Body != nil {
  3103. res.Body.Close()
  3104. }
  3105. return nil, &googleapi.Error{
  3106. Code: res.StatusCode,
  3107. Header: res.Header,
  3108. }
  3109. }
  3110. if err != nil {
  3111. return nil, err
  3112. }
  3113. defer googleapi.CloseBody(res)
  3114. if err := googleapi.CheckResponse(res); err != nil {
  3115. return nil, err
  3116. }
  3117. ret := &Operation{
  3118. ServerResponse: googleapi.ServerResponse{
  3119. Header: res.Header,
  3120. HTTPStatusCode: res.StatusCode,
  3121. },
  3122. }
  3123. target := &ret
  3124. if err := gensupport.DecodeResponse(target, res); err != nil {
  3125. return nil, err
  3126. }
  3127. return ret, nil
  3128. // {
  3129. // "description": "Update an Service Perimeter. The\nlongrunning operation from this RPC will have a successful status once the\nchanges to the Service Perimeter have\npropagated to long-lasting storage. Service Perimeter containing\nerrors will result in an error response for the first error encountered.",
  3130. // "flatPath": "v1/accessPolicies/{accessPoliciesId}/servicePerimeters/{servicePerimetersId}",
  3131. // "httpMethod": "PATCH",
  3132. // "id": "accesscontextmanager.accessPolicies.servicePerimeters.patch",
  3133. // "parameterOrder": [
  3134. // "name"
  3135. // ],
  3136. // "parameters": {
  3137. // "name": {
  3138. // "description": "Required. Resource name for the ServicePerimeter. The `short_name`\ncomponent must begin with a letter and only include alphanumeric and '_'.\nFormat: `accessPolicies/{policy_id}/servicePerimeters/{short_name}`",
  3139. // "location": "path",
  3140. // "pattern": "^accessPolicies/[^/]+/servicePerimeters/[^/]+$",
  3141. // "required": true,
  3142. // "type": "string"
  3143. // },
  3144. // "updateMask": {
  3145. // "description": "Required. Mask to control which fields get updated. Must be non-empty.",
  3146. // "format": "google-fieldmask",
  3147. // "location": "query",
  3148. // "type": "string"
  3149. // }
  3150. // },
  3151. // "path": "v1/{+name}",
  3152. // "request": {
  3153. // "$ref": "ServicePerimeter"
  3154. // },
  3155. // "response": {
  3156. // "$ref": "Operation"
  3157. // },
  3158. // "scopes": [
  3159. // "https://www.googleapis.com/auth/cloud-platform"
  3160. // ]
  3161. // }
  3162. }
  3163. // method id "accesscontextmanager.operations.cancel":
  3164. type OperationsCancelCall struct {
  3165. s *Service
  3166. name string
  3167. canceloperationrequest *CancelOperationRequest
  3168. urlParams_ gensupport.URLParams
  3169. ctx_ context.Context
  3170. header_ http.Header
  3171. }
  3172. // Cancel: Starts asynchronous cancellation on a long-running operation.
  3173. // The server
  3174. // makes a best effort to cancel the operation, but success is
  3175. // not
  3176. // guaranteed. If the server doesn't support this method, it
  3177. // returns
  3178. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  3179. // use
  3180. // Operations.GetOperation or
  3181. // other methods to check whether the cancellation succeeded or whether
  3182. // the
  3183. // operation completed despite cancellation. On successful
  3184. // cancellation,
  3185. // the operation is not deleted; instead, it becomes an operation
  3186. // with
  3187. // an Operation.error value with a google.rpc.Status.code of
  3188. // 1,
  3189. // corresponding to `Code.CANCELLED`.
  3190. func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
  3191. c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3192. c.name = name
  3193. c.canceloperationrequest = canceloperationrequest
  3194. return c
  3195. }
  3196. // Fields allows partial responses to be retrieved. See
  3197. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3198. // for more information.
  3199. func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
  3200. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3201. return c
  3202. }
  3203. // Context sets the context to be used in this call's Do method. Any
  3204. // pending HTTP request will be aborted if the provided context is
  3205. // canceled.
  3206. func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
  3207. c.ctx_ = ctx
  3208. return c
  3209. }
  3210. // Header returns an http.Header that can be modified by the caller to
  3211. // add HTTP headers to the request.
  3212. func (c *OperationsCancelCall) Header() http.Header {
  3213. if c.header_ == nil {
  3214. c.header_ = make(http.Header)
  3215. }
  3216. return c.header_
  3217. }
  3218. func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  3219. reqHeaders := make(http.Header)
  3220. for k, v := range c.header_ {
  3221. reqHeaders[k] = v
  3222. }
  3223. reqHeaders.Set("User-Agent", c.s.userAgent())
  3224. var body io.Reader = nil
  3225. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  3226. if err != nil {
  3227. return nil, err
  3228. }
  3229. reqHeaders.Set("Content-Type", "application/json")
  3230. c.urlParams_.Set("alt", alt)
  3231. c.urlParams_.Set("prettyPrint", "false")
  3232. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  3233. urls += "?" + c.urlParams_.Encode()
  3234. req, err := http.NewRequest("POST", urls, body)
  3235. if err != nil {
  3236. return nil, err
  3237. }
  3238. req.Header = reqHeaders
  3239. googleapi.Expand(req.URL, map[string]string{
  3240. "name": c.name,
  3241. })
  3242. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3243. }
  3244. // Do executes the "accesscontextmanager.operations.cancel" call.
  3245. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3246. // code is an error. Response headers are in either
  3247. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3248. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3249. // check whether the returned error was because http.StatusNotModified
  3250. // was returned.
  3251. func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3252. gensupport.SetOptions(c.urlParams_, opts...)
  3253. res, err := c.doRequest("json")
  3254. if res != nil && res.StatusCode == http.StatusNotModified {
  3255. if res.Body != nil {
  3256. res.Body.Close()
  3257. }
  3258. return nil, &googleapi.Error{
  3259. Code: res.StatusCode,
  3260. Header: res.Header,
  3261. }
  3262. }
  3263. if err != nil {
  3264. return nil, err
  3265. }
  3266. defer googleapi.CloseBody(res)
  3267. if err := googleapi.CheckResponse(res); err != nil {
  3268. return nil, err
  3269. }
  3270. ret := &Empty{
  3271. ServerResponse: googleapi.ServerResponse{
  3272. Header: res.Header,
  3273. HTTPStatusCode: res.StatusCode,
  3274. },
  3275. }
  3276. target := &ret
  3277. if err := gensupport.DecodeResponse(target, res); err != nil {
  3278. return nil, err
  3279. }
  3280. return ret, nil
  3281. // {
  3282. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  3283. // "flatPath": "v1/operations/{operationsId}:cancel",
  3284. // "httpMethod": "POST",
  3285. // "id": "accesscontextmanager.operations.cancel",
  3286. // "parameterOrder": [
  3287. // "name"
  3288. // ],
  3289. // "parameters": {
  3290. // "name": {
  3291. // "description": "The name of the operation resource to be cancelled.",
  3292. // "location": "path",
  3293. // "pattern": "^operations/.+$",
  3294. // "required": true,
  3295. // "type": "string"
  3296. // }
  3297. // },
  3298. // "path": "v1/{+name}:cancel",
  3299. // "request": {
  3300. // "$ref": "CancelOperationRequest"
  3301. // },
  3302. // "response": {
  3303. // "$ref": "Empty"
  3304. // },
  3305. // "scopes": [
  3306. // "https://www.googleapis.com/auth/cloud-platform"
  3307. // ]
  3308. // }
  3309. }
  3310. // method id "accesscontextmanager.operations.delete":
  3311. type OperationsDeleteCall struct {
  3312. s *Service
  3313. name string
  3314. urlParams_ gensupport.URLParams
  3315. ctx_ context.Context
  3316. header_ http.Header
  3317. }
  3318. // Delete: Deletes a long-running operation. This method indicates that
  3319. // the client is
  3320. // no longer interested in the operation result. It does not cancel
  3321. // the
  3322. // operation. If the server doesn't support this method, it
  3323. // returns
  3324. // `google.rpc.Code.UNIMPLEMENTED`.
  3325. func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
  3326. c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3327. c.name = name
  3328. return c
  3329. }
  3330. // Fields allows partial responses to be retrieved. See
  3331. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3332. // for more information.
  3333. func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
  3334. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3335. return c
  3336. }
  3337. // Context sets the context to be used in this call's Do method. Any
  3338. // pending HTTP request will be aborted if the provided context is
  3339. // canceled.
  3340. func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
  3341. c.ctx_ = ctx
  3342. return c
  3343. }
  3344. // Header returns an http.Header that can be modified by the caller to
  3345. // add HTTP headers to the request.
  3346. func (c *OperationsDeleteCall) Header() http.Header {
  3347. if c.header_ == nil {
  3348. c.header_ = make(http.Header)
  3349. }
  3350. return c.header_
  3351. }
  3352. func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3353. reqHeaders := make(http.Header)
  3354. for k, v := range c.header_ {
  3355. reqHeaders[k] = v
  3356. }
  3357. reqHeaders.Set("User-Agent", c.s.userAgent())
  3358. var body io.Reader = nil
  3359. c.urlParams_.Set("alt", alt)
  3360. c.urlParams_.Set("prettyPrint", "false")
  3361. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3362. urls += "?" + c.urlParams_.Encode()
  3363. req, err := http.NewRequest("DELETE", urls, body)
  3364. if err != nil {
  3365. return nil, err
  3366. }
  3367. req.Header = reqHeaders
  3368. googleapi.Expand(req.URL, map[string]string{
  3369. "name": c.name,
  3370. })
  3371. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3372. }
  3373. // Do executes the "accesscontextmanager.operations.delete" call.
  3374. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3375. // code is an error. Response headers are in either
  3376. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3377. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3378. // check whether the returned error was because http.StatusNotModified
  3379. // was returned.
  3380. func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3381. gensupport.SetOptions(c.urlParams_, opts...)
  3382. res, err := c.doRequest("json")
  3383. if res != nil && res.StatusCode == http.StatusNotModified {
  3384. if res.Body != nil {
  3385. res.Body.Close()
  3386. }
  3387. return nil, &googleapi.Error{
  3388. Code: res.StatusCode,
  3389. Header: res.Header,
  3390. }
  3391. }
  3392. if err != nil {
  3393. return nil, err
  3394. }
  3395. defer googleapi.CloseBody(res)
  3396. if err := googleapi.CheckResponse(res); err != nil {
  3397. return nil, err
  3398. }
  3399. ret := &Empty{
  3400. ServerResponse: googleapi.ServerResponse{
  3401. Header: res.Header,
  3402. HTTPStatusCode: res.StatusCode,
  3403. },
  3404. }
  3405. target := &ret
  3406. if err := gensupport.DecodeResponse(target, res); err != nil {
  3407. return nil, err
  3408. }
  3409. return ret, nil
  3410. // {
  3411. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  3412. // "flatPath": "v1/operations/{operationsId}",
  3413. // "httpMethod": "DELETE",
  3414. // "id": "accesscontextmanager.operations.delete",
  3415. // "parameterOrder": [
  3416. // "name"
  3417. // ],
  3418. // "parameters": {
  3419. // "name": {
  3420. // "description": "The name of the operation resource to be deleted.",
  3421. // "location": "path",
  3422. // "pattern": "^operations/.+$",
  3423. // "required": true,
  3424. // "type": "string"
  3425. // }
  3426. // },
  3427. // "path": "v1/{+name}",
  3428. // "response": {
  3429. // "$ref": "Empty"
  3430. // },
  3431. // "scopes": [
  3432. // "https://www.googleapis.com/auth/cloud-platform"
  3433. // ]
  3434. // }
  3435. }
  3436. // method id "accesscontextmanager.operations.get":
  3437. type OperationsGetCall struct {
  3438. s *Service
  3439. name string
  3440. urlParams_ gensupport.URLParams
  3441. ifNoneMatch_ string
  3442. ctx_ context.Context
  3443. header_ http.Header
  3444. }
  3445. // Get: Gets the latest state of a long-running operation. Clients can
  3446. // use this
  3447. // method to poll the operation result at intervals as recommended by
  3448. // the API
  3449. // service.
  3450. func (r *OperationsService) Get(name string) *OperationsGetCall {
  3451. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3452. c.name = name
  3453. return c
  3454. }
  3455. // Fields allows partial responses to be retrieved. See
  3456. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3457. // for more information.
  3458. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  3459. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3460. return c
  3461. }
  3462. // IfNoneMatch sets the optional parameter which makes the operation
  3463. // fail if the object's ETag matches the given value. This is useful for
  3464. // getting updates only after the object has changed since the last
  3465. // request. Use googleapi.IsNotModified to check whether the response
  3466. // error from Do is the result of In-None-Match.
  3467. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  3468. c.ifNoneMatch_ = entityTag
  3469. return c
  3470. }
  3471. // Context sets the context to be used in this call's Do method. Any
  3472. // pending HTTP request will be aborted if the provided context is
  3473. // canceled.
  3474. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  3475. c.ctx_ = ctx
  3476. return c
  3477. }
  3478. // Header returns an http.Header that can be modified by the caller to
  3479. // add HTTP headers to the request.
  3480. func (c *OperationsGetCall) Header() http.Header {
  3481. if c.header_ == nil {
  3482. c.header_ = make(http.Header)
  3483. }
  3484. return c.header_
  3485. }
  3486. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  3487. reqHeaders := make(http.Header)
  3488. for k, v := range c.header_ {
  3489. reqHeaders[k] = v
  3490. }
  3491. reqHeaders.Set("User-Agent", c.s.userAgent())
  3492. if c.ifNoneMatch_ != "" {
  3493. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3494. }
  3495. var body io.Reader = nil
  3496. c.urlParams_.Set("alt", alt)
  3497. c.urlParams_.Set("prettyPrint", "false")
  3498. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3499. urls += "?" + c.urlParams_.Encode()
  3500. req, err := http.NewRequest("GET", urls, body)
  3501. if err != nil {
  3502. return nil, err
  3503. }
  3504. req.Header = reqHeaders
  3505. googleapi.Expand(req.URL, map[string]string{
  3506. "name": c.name,
  3507. })
  3508. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3509. }
  3510. // Do executes the "accesscontextmanager.operations.get" call.
  3511. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3512. // status code is an error. Response headers are in either
  3513. // *Operation.ServerResponse.Header or (if a response was returned at
  3514. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3515. // to check whether the returned error was because
  3516. // http.StatusNotModified was returned.
  3517. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3518. gensupport.SetOptions(c.urlParams_, opts...)
  3519. res, err := c.doRequest("json")
  3520. if res != nil && res.StatusCode == http.StatusNotModified {
  3521. if res.Body != nil {
  3522. res.Body.Close()
  3523. }
  3524. return nil, &googleapi.Error{
  3525. Code: res.StatusCode,
  3526. Header: res.Header,
  3527. }
  3528. }
  3529. if err != nil {
  3530. return nil, err
  3531. }
  3532. defer googleapi.CloseBody(res)
  3533. if err := googleapi.CheckResponse(res); err != nil {
  3534. return nil, err
  3535. }
  3536. ret := &Operation{
  3537. ServerResponse: googleapi.ServerResponse{
  3538. Header: res.Header,
  3539. HTTPStatusCode: res.StatusCode,
  3540. },
  3541. }
  3542. target := &ret
  3543. if err := gensupport.DecodeResponse(target, res); err != nil {
  3544. return nil, err
  3545. }
  3546. return ret, nil
  3547. // {
  3548. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  3549. // "flatPath": "v1/operations/{operationsId}",
  3550. // "httpMethod": "GET",
  3551. // "id": "accesscontextmanager.operations.get",
  3552. // "parameterOrder": [
  3553. // "name"
  3554. // ],
  3555. // "parameters": {
  3556. // "name": {
  3557. // "description": "The name of the operation resource.",
  3558. // "location": "path",
  3559. // "pattern": "^operations/.+$",
  3560. // "required": true,
  3561. // "type": "string"
  3562. // }
  3563. // },
  3564. // "path": "v1/{+name}",
  3565. // "response": {
  3566. // "$ref": "Operation"
  3567. // },
  3568. // "scopes": [
  3569. // "https://www.googleapis.com/auth/cloud-platform"
  3570. // ]
  3571. // }
  3572. }
  3573. // method id "accesscontextmanager.operations.list":
  3574. type OperationsListCall struct {
  3575. s *Service
  3576. name string
  3577. urlParams_ gensupport.URLParams
  3578. ifNoneMatch_ string
  3579. ctx_ context.Context
  3580. header_ http.Header
  3581. }
  3582. // List: Lists operations that match the specified filter in the
  3583. // request. If the
  3584. // server doesn't support this method, it returns
  3585. // `UNIMPLEMENTED`.
  3586. //
  3587. // NOTE: the `name` binding allows API services to override the
  3588. // binding
  3589. // to use different resource name schemes, such as `users/*/operations`.
  3590. // To
  3591. // override the binding, API services can add a binding such
  3592. // as
  3593. // "/v1/{name=users/*}/operations" to their service configuration.
  3594. // For backwards compatibility, the default name includes the
  3595. // operations
  3596. // collection id, however overriding users must ensure the name
  3597. // binding
  3598. // is the parent resource, without the operations collection id.
  3599. func (r *OperationsService) List(name string) *OperationsListCall {
  3600. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3601. c.name = name
  3602. return c
  3603. }
  3604. // Filter sets the optional parameter "filter": The standard list
  3605. // filter.
  3606. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  3607. c.urlParams_.Set("filter", filter)
  3608. return c
  3609. }
  3610. // PageSize sets the optional parameter "pageSize": The standard list
  3611. // page size.
  3612. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  3613. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3614. return c
  3615. }
  3616. // PageToken sets the optional parameter "pageToken": The standard list
  3617. // page token.
  3618. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  3619. c.urlParams_.Set("pageToken", pageToken)
  3620. return c
  3621. }
  3622. // Fields allows partial responses to be retrieved. See
  3623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3624. // for more information.
  3625. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  3626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3627. return c
  3628. }
  3629. // IfNoneMatch sets the optional parameter which makes the operation
  3630. // fail if the object's ETag matches the given value. This is useful for
  3631. // getting updates only after the object has changed since the last
  3632. // request. Use googleapi.IsNotModified to check whether the response
  3633. // error from Do is the result of In-None-Match.
  3634. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  3635. c.ifNoneMatch_ = entityTag
  3636. return c
  3637. }
  3638. // Context sets the context to be used in this call's Do method. Any
  3639. // pending HTTP request will be aborted if the provided context is
  3640. // canceled.
  3641. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  3642. c.ctx_ = ctx
  3643. return c
  3644. }
  3645. // Header returns an http.Header that can be modified by the caller to
  3646. // add HTTP headers to the request.
  3647. func (c *OperationsListCall) Header() http.Header {
  3648. if c.header_ == nil {
  3649. c.header_ = make(http.Header)
  3650. }
  3651. return c.header_
  3652. }
  3653. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  3654. reqHeaders := make(http.Header)
  3655. for k, v := range c.header_ {
  3656. reqHeaders[k] = v
  3657. }
  3658. reqHeaders.Set("User-Agent", c.s.userAgent())
  3659. if c.ifNoneMatch_ != "" {
  3660. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3661. }
  3662. var body io.Reader = nil
  3663. c.urlParams_.Set("alt", alt)
  3664. c.urlParams_.Set("prettyPrint", "false")
  3665. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3666. urls += "?" + c.urlParams_.Encode()
  3667. req, err := http.NewRequest("GET", urls, body)
  3668. if err != nil {
  3669. return nil, err
  3670. }
  3671. req.Header = reqHeaders
  3672. googleapi.Expand(req.URL, map[string]string{
  3673. "name": c.name,
  3674. })
  3675. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3676. }
  3677. // Do executes the "accesscontextmanager.operations.list" call.
  3678. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  3679. // non-2xx status code is an error. Response headers are in either
  3680. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  3681. // returned at all) in error.(*googleapi.Error).Header. Use
  3682. // googleapi.IsNotModified to check whether the returned error was
  3683. // because http.StatusNotModified was returned.
  3684. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  3685. gensupport.SetOptions(c.urlParams_, opts...)
  3686. res, err := c.doRequest("json")
  3687. if res != nil && res.StatusCode == http.StatusNotModified {
  3688. if res.Body != nil {
  3689. res.Body.Close()
  3690. }
  3691. return nil, &googleapi.Error{
  3692. Code: res.StatusCode,
  3693. Header: res.Header,
  3694. }
  3695. }
  3696. if err != nil {
  3697. return nil, err
  3698. }
  3699. defer googleapi.CloseBody(res)
  3700. if err := googleapi.CheckResponse(res); err != nil {
  3701. return nil, err
  3702. }
  3703. ret := &ListOperationsResponse{
  3704. ServerResponse: googleapi.ServerResponse{
  3705. Header: res.Header,
  3706. HTTPStatusCode: res.StatusCode,
  3707. },
  3708. }
  3709. target := &ret
  3710. if err := gensupport.DecodeResponse(target, res); err != nil {
  3711. return nil, err
  3712. }
  3713. return ret, nil
  3714. // {
  3715. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  3716. // "flatPath": "v1/operations",
  3717. // "httpMethod": "GET",
  3718. // "id": "accesscontextmanager.operations.list",
  3719. // "parameterOrder": [
  3720. // "name"
  3721. // ],
  3722. // "parameters": {
  3723. // "filter": {
  3724. // "description": "The standard list filter.",
  3725. // "location": "query",
  3726. // "type": "string"
  3727. // },
  3728. // "name": {
  3729. // "description": "The name of the operation's parent resource.",
  3730. // "location": "path",
  3731. // "pattern": "^operations$",
  3732. // "required": true,
  3733. // "type": "string"
  3734. // },
  3735. // "pageSize": {
  3736. // "description": "The standard list page size.",
  3737. // "format": "int32",
  3738. // "location": "query",
  3739. // "type": "integer"
  3740. // },
  3741. // "pageToken": {
  3742. // "description": "The standard list page token.",
  3743. // "location": "query",
  3744. // "type": "string"
  3745. // }
  3746. // },
  3747. // "path": "v1/{+name}",
  3748. // "response": {
  3749. // "$ref": "ListOperationsResponse"
  3750. // },
  3751. // "scopes": [
  3752. // "https://www.googleapis.com/auth/cloud-platform"
  3753. // ]
  3754. // }
  3755. }
  3756. // Pages invokes f for each page of results.
  3757. // A non-nil error returned from f will halt the iteration.
  3758. // The provided context supersedes any context provided to the Context method.
  3759. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  3760. c.ctx_ = ctx
  3761. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3762. for {
  3763. x, err := c.Do()
  3764. if err != nil {
  3765. return err
  3766. }
  3767. if err := f(x); err != nil {
  3768. return err
  3769. }
  3770. if x.NextPageToken == "" {
  3771. return nil
  3772. }
  3773. c.PageToken(x.NextPageToken)
  3774. }
  3775. }