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.
 
 
 

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