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.
 
 
 

6493 line
232 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 cloudkms provides access to the Cloud Key Management Service (KMS) API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/kms/apiv1 instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/kms/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/cloudkms/v1"
  16. // ...
  17. // ctx := context.Background()
  18. // cloudkmsService, err := cloudkms.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // cloudkmsService, err := cloudkms.NewService(ctx, option.WithScopes(cloudkms.CloudkmsScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // cloudkmsService, err := cloudkms.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // cloudkmsService, err := cloudkms.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package cloudkms // import "google.golang.org/api/cloudkms/v1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "cloudkms:v1"
  73. const apiName = "cloudkms"
  74. const apiVersion = "v1"
  75. const basePath = "https://cloudkms.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View and manage your keys and secrets stored in Cloud Key Management
  81. // Service
  82. CloudkmsScope = "https://www.googleapis.com/auth/cloudkms"
  83. )
  84. // NewService creates a new Service.
  85. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  86. scopesOption := option.WithScopes(
  87. "https://www.googleapis.com/auth/cloud-platform",
  88. "https://www.googleapis.com/auth/cloudkms",
  89. )
  90. // NOTE: prepend, so we don't override user-specified scopes.
  91. opts = append([]option.ClientOption{scopesOption}, opts...)
  92. client, endpoint, err := htransport.NewClient(ctx, opts...)
  93. if err != nil {
  94. return nil, err
  95. }
  96. s, err := New(client)
  97. if err != nil {
  98. return nil, err
  99. }
  100. if endpoint != "" {
  101. s.BasePath = endpoint
  102. }
  103. return s, nil
  104. }
  105. // New creates a new Service. It uses the provided http.Client for requests.
  106. //
  107. // Deprecated: please use NewService instead.
  108. // To provide a custom HTTP client, use option.WithHTTPClient.
  109. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  110. func New(client *http.Client) (*Service, error) {
  111. if client == nil {
  112. return nil, errors.New("client is nil")
  113. }
  114. s := &Service{client: client, BasePath: basePath}
  115. s.Projects = NewProjectsService(s)
  116. return s, nil
  117. }
  118. type Service struct {
  119. client *http.Client
  120. BasePath string // API endpoint base URL
  121. UserAgent string // optional additional User-Agent fragment
  122. Projects *ProjectsService
  123. }
  124. func (s *Service) userAgent() string {
  125. if s.UserAgent == "" {
  126. return googleapi.UserAgent
  127. }
  128. return googleapi.UserAgent + " " + s.UserAgent
  129. }
  130. func NewProjectsService(s *Service) *ProjectsService {
  131. rs := &ProjectsService{s: s}
  132. rs.Locations = NewProjectsLocationsService(s)
  133. return rs
  134. }
  135. type ProjectsService struct {
  136. s *Service
  137. Locations *ProjectsLocationsService
  138. }
  139. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  140. rs := &ProjectsLocationsService{s: s}
  141. rs.KeyRings = NewProjectsLocationsKeyRingsService(s)
  142. return rs
  143. }
  144. type ProjectsLocationsService struct {
  145. s *Service
  146. KeyRings *ProjectsLocationsKeyRingsService
  147. }
  148. func NewProjectsLocationsKeyRingsService(s *Service) *ProjectsLocationsKeyRingsService {
  149. rs := &ProjectsLocationsKeyRingsService{s: s}
  150. rs.CryptoKeys = NewProjectsLocationsKeyRingsCryptoKeysService(s)
  151. rs.ImportJobs = NewProjectsLocationsKeyRingsImportJobsService(s)
  152. return rs
  153. }
  154. type ProjectsLocationsKeyRingsService struct {
  155. s *Service
  156. CryptoKeys *ProjectsLocationsKeyRingsCryptoKeysService
  157. ImportJobs *ProjectsLocationsKeyRingsImportJobsService
  158. }
  159. func NewProjectsLocationsKeyRingsCryptoKeysService(s *Service) *ProjectsLocationsKeyRingsCryptoKeysService {
  160. rs := &ProjectsLocationsKeyRingsCryptoKeysService{s: s}
  161. rs.CryptoKeyVersions = NewProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService(s)
  162. return rs
  163. }
  164. type ProjectsLocationsKeyRingsCryptoKeysService struct {
  165. s *Service
  166. CryptoKeyVersions *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService
  167. }
  168. func NewProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService(s *Service) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService {
  169. rs := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService{s: s}
  170. return rs
  171. }
  172. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService struct {
  173. s *Service
  174. }
  175. func NewProjectsLocationsKeyRingsImportJobsService(s *Service) *ProjectsLocationsKeyRingsImportJobsService {
  176. rs := &ProjectsLocationsKeyRingsImportJobsService{s: s}
  177. return rs
  178. }
  179. type ProjectsLocationsKeyRingsImportJobsService struct {
  180. s *Service
  181. }
  182. // AsymmetricDecryptRequest: Request message for
  183. // KeyManagementService.AsymmetricDecrypt.
  184. type AsymmetricDecryptRequest struct {
  185. // Ciphertext: Required. The data encrypted with the named
  186. // CryptoKeyVersion's public
  187. // key using OAEP.
  188. Ciphertext string `json:"ciphertext,omitempty"`
  189. // ForceSendFields is a list of field names (e.g. "Ciphertext") to
  190. // unconditionally include in API requests. By default, fields with
  191. // empty values are omitted from API requests. However, any non-pointer,
  192. // non-interface field appearing in ForceSendFields will be sent to the
  193. // server regardless of whether the field is empty or not. This may be
  194. // used to include empty fields in Patch requests.
  195. ForceSendFields []string `json:"-"`
  196. // NullFields is a list of field names (e.g. "Ciphertext") to include in
  197. // API requests with the JSON null value. By default, fields with empty
  198. // values are omitted from API requests. However, any field with an
  199. // empty value appearing in NullFields will be sent to the server as
  200. // null. It is an error if a field in this list has a non-empty value.
  201. // This may be used to include null fields in Patch requests.
  202. NullFields []string `json:"-"`
  203. }
  204. func (s *AsymmetricDecryptRequest) MarshalJSON() ([]byte, error) {
  205. type NoMethod AsymmetricDecryptRequest
  206. raw := NoMethod(*s)
  207. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  208. }
  209. // AsymmetricDecryptResponse: Response message for
  210. // KeyManagementService.AsymmetricDecrypt.
  211. type AsymmetricDecryptResponse struct {
  212. // Plaintext: The decrypted data originally encrypted with the matching
  213. // public key.
  214. Plaintext string `json:"plaintext,omitempty"`
  215. // ServerResponse contains the HTTP response code and headers from the
  216. // server.
  217. googleapi.ServerResponse `json:"-"`
  218. // ForceSendFields is a list of field names (e.g. "Plaintext") to
  219. // unconditionally include in API requests. By default, fields with
  220. // empty values are omitted from API requests. However, any non-pointer,
  221. // non-interface field appearing in ForceSendFields will be sent to the
  222. // server regardless of whether the field is empty or not. This may be
  223. // used to include empty fields in Patch requests.
  224. ForceSendFields []string `json:"-"`
  225. // NullFields is a list of field names (e.g. "Plaintext") to include in
  226. // API requests with the JSON null value. By default, fields with empty
  227. // values are omitted from API requests. However, any field with an
  228. // empty value appearing in NullFields will be sent to the server as
  229. // null. It is an error if a field in this list has a non-empty value.
  230. // This may be used to include null fields in Patch requests.
  231. NullFields []string `json:"-"`
  232. }
  233. func (s *AsymmetricDecryptResponse) MarshalJSON() ([]byte, error) {
  234. type NoMethod AsymmetricDecryptResponse
  235. raw := NoMethod(*s)
  236. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  237. }
  238. // AsymmetricSignRequest: Request message for
  239. // KeyManagementService.AsymmetricSign.
  240. type AsymmetricSignRequest struct {
  241. // Digest: Required. The digest of the data to sign. The digest must be
  242. // produced with
  243. // the same digest algorithm as specified by the key
  244. // version's
  245. // algorithm.
  246. Digest *Digest `json:"digest,omitempty"`
  247. // ForceSendFields is a list of field names (e.g. "Digest") to
  248. // unconditionally include in API requests. By default, fields with
  249. // empty values are omitted from API requests. However, any non-pointer,
  250. // non-interface field appearing in ForceSendFields will be sent to the
  251. // server regardless of whether the field is empty or not. This may be
  252. // used to include empty fields in Patch requests.
  253. ForceSendFields []string `json:"-"`
  254. // NullFields is a list of field names (e.g. "Digest") to include in API
  255. // requests with the JSON null value. By default, fields with empty
  256. // values are omitted from API requests. However, any field with an
  257. // empty value appearing in NullFields will be sent to the server as
  258. // null. It is an error if a field in this list has a non-empty value.
  259. // This may be used to include null fields in Patch requests.
  260. NullFields []string `json:"-"`
  261. }
  262. func (s *AsymmetricSignRequest) MarshalJSON() ([]byte, error) {
  263. type NoMethod AsymmetricSignRequest
  264. raw := NoMethod(*s)
  265. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  266. }
  267. // AsymmetricSignResponse: Response message for
  268. // KeyManagementService.AsymmetricSign.
  269. type AsymmetricSignResponse struct {
  270. // Signature: The created signature.
  271. Signature string `json:"signature,omitempty"`
  272. // ServerResponse contains the HTTP response code and headers from the
  273. // server.
  274. googleapi.ServerResponse `json:"-"`
  275. // ForceSendFields is a list of field names (e.g. "Signature") to
  276. // unconditionally include in API requests. By default, fields with
  277. // empty values are omitted from API requests. However, any non-pointer,
  278. // non-interface field appearing in ForceSendFields will be sent to the
  279. // server regardless of whether the field is empty or not. This may be
  280. // used to include empty fields in Patch requests.
  281. ForceSendFields []string `json:"-"`
  282. // NullFields is a list of field names (e.g. "Signature") to include in
  283. // API requests with the JSON null value. By default, fields with empty
  284. // values are omitted from API requests. However, any field with an
  285. // empty value appearing in NullFields will be sent to the server as
  286. // null. It is an error if a field in this list has a non-empty value.
  287. // This may be used to include null fields in Patch requests.
  288. NullFields []string `json:"-"`
  289. }
  290. func (s *AsymmetricSignResponse) MarshalJSON() ([]byte, error) {
  291. type NoMethod AsymmetricSignResponse
  292. raw := NoMethod(*s)
  293. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  294. }
  295. // AuditConfig: Specifies the audit configuration for a service.
  296. // The configuration determines which permission types are logged, and
  297. // what
  298. // identities, if any, are exempted from logging.
  299. // An AuditConfig must have one or more AuditLogConfigs.
  300. //
  301. // If there are AuditConfigs for both `allServices` and a specific
  302. // service,
  303. // the union of the two AuditConfigs is used for that service: the
  304. // log_types
  305. // specified in each AuditConfig are enabled, and the exempted_members
  306. // in each
  307. // AuditLogConfig are exempted.
  308. //
  309. // Example Policy with multiple AuditConfigs:
  310. //
  311. // {
  312. // "audit_configs": [
  313. // {
  314. // "service": "allServices"
  315. // "audit_log_configs": [
  316. // {
  317. // "log_type": "DATA_READ",
  318. // "exempted_members": [
  319. // "user:foo@gmail.com"
  320. // ]
  321. // },
  322. // {
  323. // "log_type": "DATA_WRITE",
  324. // },
  325. // {
  326. // "log_type": "ADMIN_READ",
  327. // }
  328. // ]
  329. // },
  330. // {
  331. // "service": "fooservice.googleapis.com"
  332. // "audit_log_configs": [
  333. // {
  334. // "log_type": "DATA_READ",
  335. // },
  336. // {
  337. // "log_type": "DATA_WRITE",
  338. // "exempted_members": [
  339. // "user:bar@gmail.com"
  340. // ]
  341. // }
  342. // ]
  343. // }
  344. // ]
  345. // }
  346. //
  347. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  348. // ADMIN_READ
  349. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  350. // and
  351. // bar@gmail.com from DATA_WRITE logging.
  352. type AuditConfig struct {
  353. // AuditLogConfigs: The configuration for logging of each type of
  354. // permission.
  355. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  356. // Service: Specifies a service that will be enabled for audit
  357. // logging.
  358. // For example, `storage.googleapis.com`,
  359. // `cloudsql.googleapis.com`.
  360. // `allServices` is a special value that covers all services.
  361. Service string `json:"service,omitempty"`
  362. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  363. // unconditionally include in API requests. By default, fields with
  364. // empty values are omitted from API requests. However, any non-pointer,
  365. // non-interface field appearing in ForceSendFields will be sent to the
  366. // server regardless of whether the field is empty or not. This may be
  367. // used to include empty fields in Patch requests.
  368. ForceSendFields []string `json:"-"`
  369. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  370. // include in API requests with the JSON null value. By default, fields
  371. // with empty values are omitted from API requests. However, any field
  372. // with an empty value appearing in NullFields will be sent to the
  373. // server as null. It is an error if a field in this list has a
  374. // non-empty value. This may be used to include null fields in Patch
  375. // requests.
  376. NullFields []string `json:"-"`
  377. }
  378. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  379. type NoMethod AuditConfig
  380. raw := NoMethod(*s)
  381. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  382. }
  383. // AuditLogConfig: Provides the configuration for logging a type of
  384. // permissions.
  385. // Example:
  386. //
  387. // {
  388. // "audit_log_configs": [
  389. // {
  390. // "log_type": "DATA_READ",
  391. // "exempted_members": [
  392. // "user:foo@gmail.com"
  393. // ]
  394. // },
  395. // {
  396. // "log_type": "DATA_WRITE",
  397. // }
  398. // ]
  399. // }
  400. //
  401. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  402. // exempting
  403. // foo@gmail.com from DATA_READ logging.
  404. type AuditLogConfig struct {
  405. // ExemptedMembers: Specifies the identities that do not cause logging
  406. // for this type of
  407. // permission.
  408. // Follows the same format of Binding.members.
  409. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  410. // LogType: The log type that this config enables.
  411. //
  412. // Possible values:
  413. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  414. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  415. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  416. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  417. LogType string `json:"logType,omitempty"`
  418. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  419. // unconditionally include in API requests. By default, fields with
  420. // empty values are omitted from API requests. However, any non-pointer,
  421. // non-interface field appearing in ForceSendFields will be sent to the
  422. // server regardless of whether the field is empty or not. This may be
  423. // used to include empty fields in Patch requests.
  424. ForceSendFields []string `json:"-"`
  425. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  426. // include in API requests with the JSON null value. By default, fields
  427. // with empty values are omitted from API requests. However, any field
  428. // with an empty value appearing in NullFields will be sent to the
  429. // server as null. It is an error if a field in this list has a
  430. // non-empty value. This may be used to include null fields in Patch
  431. // requests.
  432. NullFields []string `json:"-"`
  433. }
  434. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  435. type NoMethod AuditLogConfig
  436. raw := NoMethod(*s)
  437. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  438. }
  439. // Binding: Associates `members` with a `role`.
  440. type Binding struct {
  441. // Condition: Unimplemented. The condition that is associated with this
  442. // binding.
  443. // NOTE: an unsatisfied condition will not allow user access via
  444. // current
  445. // binding. Different bindings, including their conditions, are
  446. // examined
  447. // independently.
  448. Condition *Expr `json:"condition,omitempty"`
  449. // Members: Specifies the identities requesting access for a Cloud
  450. // Platform resource.
  451. // `members` can have the following values:
  452. //
  453. // * `allUsers`: A special identifier that represents anyone who is
  454. // on the internet; with or without a Google account.
  455. //
  456. // * `allAuthenticatedUsers`: A special identifier that represents
  457. // anyone
  458. // who is authenticated with a Google account or a service
  459. // account.
  460. //
  461. // * `user:{emailid}`: An email address that represents a specific
  462. // Google
  463. // account. For example, `alice@gmail.com` .
  464. //
  465. //
  466. // * `serviceAccount:{emailid}`: An email address that represents a
  467. // service
  468. // account. For example,
  469. // `my-other-app@appspot.gserviceaccount.com`.
  470. //
  471. // * `group:{emailid}`: An email address that represents a Google
  472. // group.
  473. // For example, `admins@example.com`.
  474. //
  475. //
  476. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  477. // the
  478. // users of that domain. For example, `google.com` or
  479. // `example.com`.
  480. //
  481. //
  482. Members []string `json:"members,omitempty"`
  483. // Role: Role that is assigned to `members`.
  484. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  485. Role string `json:"role,omitempty"`
  486. // ForceSendFields is a list of field names (e.g. "Condition") to
  487. // unconditionally include in API requests. By default, fields with
  488. // empty values are omitted from API requests. However, any non-pointer,
  489. // non-interface field appearing in ForceSendFields will be sent to the
  490. // server regardless of whether the field is empty or not. This may be
  491. // used to include empty fields in Patch requests.
  492. ForceSendFields []string `json:"-"`
  493. // NullFields is a list of field names (e.g. "Condition") to include in
  494. // API requests with the JSON null value. By default, fields with empty
  495. // values are omitted from API requests. However, any field with an
  496. // empty value appearing in NullFields will be sent to the server as
  497. // null. It is an error if a field in this list has a non-empty value.
  498. // This may be used to include null fields in Patch requests.
  499. NullFields []string `json:"-"`
  500. }
  501. func (s *Binding) MarshalJSON() ([]byte, error) {
  502. type NoMethod Binding
  503. raw := NoMethod(*s)
  504. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  505. }
  506. // CryptoKey: A CryptoKey represents a logical key that can be used for
  507. // cryptographic
  508. // operations.
  509. //
  510. // A CryptoKey is made up of one or more versions, which
  511. // represent the actual key material used in cryptographic operations.
  512. type CryptoKey struct {
  513. // CreateTime: Output only. The time at which this CryptoKey was
  514. // created.
  515. CreateTime string `json:"createTime,omitempty"`
  516. // Labels: Labels with user-defined metadata. For more information,
  517. // see
  518. // [Labeling Keys](/kms/docs/labeling-keys).
  519. Labels map[string]string `json:"labels,omitempty"`
  520. // Name: Output only. The resource name for this CryptoKey in the
  521. // format
  522. // `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
  523. Name string `json:"name,omitempty"`
  524. // NextRotationTime: At next_rotation_time, the Key Management Service
  525. // will automatically:
  526. //
  527. // 1. Create a new version of this CryptoKey.
  528. // 2. Mark the new version as primary.
  529. //
  530. // Key rotations performed manually via
  531. // CreateCryptoKeyVersion and
  532. // UpdateCryptoKeyPrimaryVersion
  533. // do not affect next_rotation_time.
  534. //
  535. // Keys with purpose
  536. // ENCRYPT_DECRYPT support
  537. // automatic rotation. For other keys, this field must be omitted.
  538. NextRotationTime string `json:"nextRotationTime,omitempty"`
  539. // Primary: Output only. A copy of the "primary" CryptoKeyVersion that
  540. // will be used
  541. // by Encrypt when this CryptoKey is given
  542. // in EncryptRequest.name.
  543. //
  544. // The CryptoKey's primary version can be updated
  545. // via
  546. // UpdateCryptoKeyPrimaryVersion.
  547. //
  548. // All keys with purpose
  549. // ENCRYPT_DECRYPT have a
  550. // primary. For other keys, this field will be omitted.
  551. Primary *CryptoKeyVersion `json:"primary,omitempty"`
  552. // Purpose: The immutable purpose of this CryptoKey.
  553. //
  554. // Possible values:
  555. // "CRYPTO_KEY_PURPOSE_UNSPECIFIED" - Not specified.
  556. // "ENCRYPT_DECRYPT" - CryptoKeys with this purpose may be used
  557. // with
  558. // Encrypt and
  559. // Decrypt.
  560. // "ASYMMETRIC_SIGN" - CryptoKeys with this purpose may be used
  561. // with
  562. // AsymmetricSign and
  563. // GetPublicKey.
  564. // "ASYMMETRIC_DECRYPT" - CryptoKeys with this purpose may be used
  565. // with
  566. // AsymmetricDecrypt and
  567. // GetPublicKey.
  568. Purpose string `json:"purpose,omitempty"`
  569. // RotationPeriod: next_rotation_time will be advanced by this period
  570. // when the service
  571. // automatically rotates a key. Must be at least one day.
  572. //
  573. // If rotation_period is set, next_rotation_time must also be set.
  574. //
  575. // Keys with purpose
  576. // ENCRYPT_DECRYPT support
  577. // automatic rotation. For other keys, this field must be omitted.
  578. RotationPeriod string `json:"rotationPeriod,omitempty"`
  579. // VersionTemplate: A template describing settings for new
  580. // CryptoKeyVersion instances.
  581. // The properties of new CryptoKeyVersion instances created by
  582. // either
  583. // CreateCryptoKeyVersion or
  584. // auto-rotation are controlled by this template.
  585. VersionTemplate *CryptoKeyVersionTemplate `json:"versionTemplate,omitempty"`
  586. // ServerResponse contains the HTTP response code and headers from the
  587. // server.
  588. googleapi.ServerResponse `json:"-"`
  589. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  590. // unconditionally include in API requests. By default, fields with
  591. // empty values are omitted from API requests. However, any non-pointer,
  592. // non-interface field appearing in ForceSendFields will be sent to the
  593. // server regardless of whether the field is empty or not. This may be
  594. // used to include empty fields in Patch requests.
  595. ForceSendFields []string `json:"-"`
  596. // NullFields is a list of field names (e.g. "CreateTime") to include in
  597. // API requests with the JSON null value. By default, fields with empty
  598. // values are omitted from API requests. However, any field with an
  599. // empty value appearing in NullFields will be sent to the server as
  600. // null. It is an error if a field in this list has a non-empty value.
  601. // This may be used to include null fields in Patch requests.
  602. NullFields []string `json:"-"`
  603. }
  604. func (s *CryptoKey) MarshalJSON() ([]byte, error) {
  605. type NoMethod CryptoKey
  606. raw := NoMethod(*s)
  607. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  608. }
  609. // CryptoKeyVersion: A CryptoKeyVersion represents an individual
  610. // cryptographic key, and the
  611. // associated key material.
  612. //
  613. // An ENABLED version can be
  614. // used for cryptographic operations.
  615. //
  616. // For security reasons, the raw cryptographic key material represented
  617. // by a
  618. // CryptoKeyVersion can never be viewed or exported. It can only be used
  619. // to
  620. // encrypt, decrypt, or sign data when an authorized user or application
  621. // invokes
  622. // Cloud KMS.
  623. type CryptoKeyVersion struct {
  624. // Algorithm: Output only. The CryptoKeyVersionAlgorithm that
  625. // this
  626. // CryptoKeyVersion supports.
  627. //
  628. // Possible values:
  629. // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified.
  630. // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys.
  631. // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256
  632. // digest.
  633. // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256
  634. // digest.
  635. // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256
  636. // digest.
  637. // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512
  638. // digest.
  639. // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit
  640. // key and a SHA256 digest.
  641. // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit
  642. // key and a SHA256 digest.
  643. // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit
  644. // key and a SHA256 digest.
  645. // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit
  646. // key and a SHA512 digest.
  647. // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a
  648. // SHA256 digest.
  649. // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a
  650. // SHA256 digest.
  651. // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a
  652. // SHA256 digest.
  653. // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a
  654. // SHA512 digest.
  655. // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256
  656. // digest.
  657. // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384
  658. // digest.
  659. Algorithm string `json:"algorithm,omitempty"`
  660. // Attestation: Output only. Statement that was generated and signed by
  661. // the HSM at key
  662. // creation time. Use this statement to verify attributes of the key as
  663. // stored
  664. // on the HSM, independently of Google. Only provided for key versions
  665. // with
  666. // protection_level HSM.
  667. Attestation *KeyOperationAttestation `json:"attestation,omitempty"`
  668. // CreateTime: Output only. The time at which this CryptoKeyVersion was
  669. // created.
  670. CreateTime string `json:"createTime,omitempty"`
  671. // DestroyEventTime: Output only. The time this CryptoKeyVersion's key
  672. // material was
  673. // destroyed. Only present if state is
  674. // DESTROYED.
  675. DestroyEventTime string `json:"destroyEventTime,omitempty"`
  676. // DestroyTime: Output only. The time this CryptoKeyVersion's key
  677. // material is scheduled
  678. // for destruction. Only present if state is
  679. // DESTROY_SCHEDULED.
  680. DestroyTime string `json:"destroyTime,omitempty"`
  681. // GenerateTime: Output only. The time this CryptoKeyVersion's key
  682. // material was
  683. // generated.
  684. GenerateTime string `json:"generateTime,omitempty"`
  685. // Name: Output only. The resource name for this CryptoKeyVersion in the
  686. // format
  687. // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersio
  688. // ns/*`.
  689. Name string `json:"name,omitempty"`
  690. // ProtectionLevel: Output only. The ProtectionLevel describing how
  691. // crypto operations are
  692. // performed with this CryptoKeyVersion.
  693. //
  694. // Possible values:
  695. // "PROTECTION_LEVEL_UNSPECIFIED" - Not specified.
  696. // "SOFTWARE" - Crypto operations are performed in software.
  697. // "HSM" - Crypto operations are performed in a Hardware Security
  698. // Module.
  699. ProtectionLevel string `json:"protectionLevel,omitempty"`
  700. // State: The current state of the CryptoKeyVersion.
  701. //
  702. // Possible values:
  703. // "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" - Not specified.
  704. // "PENDING_GENERATION" - This version is still being generated. It
  705. // may not be used, enabled,
  706. // disabled, or destroyed yet. Cloud KMS will automatically mark
  707. // this
  708. // version ENABLED as soon as the version is ready.
  709. // "ENABLED" - This version may be used for cryptographic operations.
  710. // "DISABLED" - This version may not be used, but the key material is
  711. // still available,
  712. // and the version can be placed back into the ENABLED state.
  713. // "DESTROYED" - This version is destroyed, and the key material is no
  714. // longer stored.
  715. // A version may not leave this state once entered.
  716. // "DESTROY_SCHEDULED" - This version is scheduled for destruction,
  717. // and will be destroyed soon.
  718. // Call
  719. // RestoreCryptoKeyVersion
  720. // to put it back into the DISABLED state.
  721. State string `json:"state,omitempty"`
  722. // ServerResponse contains the HTTP response code and headers from the
  723. // server.
  724. googleapi.ServerResponse `json:"-"`
  725. // ForceSendFields is a list of field names (e.g. "Algorithm") to
  726. // unconditionally include in API requests. By default, fields with
  727. // empty values are omitted from API requests. However, any non-pointer,
  728. // non-interface field appearing in ForceSendFields will be sent to the
  729. // server regardless of whether the field is empty or not. This may be
  730. // used to include empty fields in Patch requests.
  731. ForceSendFields []string `json:"-"`
  732. // NullFields is a list of field names (e.g. "Algorithm") to include in
  733. // API requests with the JSON null value. By default, fields with empty
  734. // values are omitted from API requests. However, any field with an
  735. // empty value appearing in NullFields will be sent to the server as
  736. // null. It is an error if a field in this list has a non-empty value.
  737. // This may be used to include null fields in Patch requests.
  738. NullFields []string `json:"-"`
  739. }
  740. func (s *CryptoKeyVersion) MarshalJSON() ([]byte, error) {
  741. type NoMethod CryptoKeyVersion
  742. raw := NoMethod(*s)
  743. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  744. }
  745. // CryptoKeyVersionTemplate: A CryptoKeyVersionTemplate specifies the
  746. // properties to use when creating
  747. // a new CryptoKeyVersion, either manually with
  748. // CreateCryptoKeyVersion or
  749. // automatically as a result of auto-rotation.
  750. type CryptoKeyVersionTemplate struct {
  751. // Algorithm: Required. Algorithm to use
  752. // when creating a CryptoKeyVersion based on this template.
  753. //
  754. // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied
  755. // if both
  756. // this field is omitted and CryptoKey.purpose is
  757. // ENCRYPT_DECRYPT.
  758. //
  759. // Possible values:
  760. // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified.
  761. // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys.
  762. // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256
  763. // digest.
  764. // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256
  765. // digest.
  766. // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256
  767. // digest.
  768. // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512
  769. // digest.
  770. // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit
  771. // key and a SHA256 digest.
  772. // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit
  773. // key and a SHA256 digest.
  774. // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit
  775. // key and a SHA256 digest.
  776. // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit
  777. // key and a SHA512 digest.
  778. // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a
  779. // SHA256 digest.
  780. // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a
  781. // SHA256 digest.
  782. // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a
  783. // SHA256 digest.
  784. // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a
  785. // SHA512 digest.
  786. // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256
  787. // digest.
  788. // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384
  789. // digest.
  790. Algorithm string `json:"algorithm,omitempty"`
  791. // ProtectionLevel: ProtectionLevel to use when creating a
  792. // CryptoKeyVersion based on
  793. // this template. Immutable. Defaults to SOFTWARE.
  794. //
  795. // Possible values:
  796. // "PROTECTION_LEVEL_UNSPECIFIED" - Not specified.
  797. // "SOFTWARE" - Crypto operations are performed in software.
  798. // "HSM" - Crypto operations are performed in a Hardware Security
  799. // Module.
  800. ProtectionLevel string `json:"protectionLevel,omitempty"`
  801. // ForceSendFields is a list of field names (e.g. "Algorithm") to
  802. // unconditionally include in API requests. By default, fields with
  803. // empty values are omitted from API requests. However, any non-pointer,
  804. // non-interface field appearing in ForceSendFields will be sent to the
  805. // server regardless of whether the field is empty or not. This may be
  806. // used to include empty fields in Patch requests.
  807. ForceSendFields []string `json:"-"`
  808. // NullFields is a list of field names (e.g. "Algorithm") to include in
  809. // API requests with the JSON null value. By default, fields with empty
  810. // values are omitted from API requests. However, any field with an
  811. // empty value appearing in NullFields will be sent to the server as
  812. // null. It is an error if a field in this list has a non-empty value.
  813. // This may be used to include null fields in Patch requests.
  814. NullFields []string `json:"-"`
  815. }
  816. func (s *CryptoKeyVersionTemplate) MarshalJSON() ([]byte, error) {
  817. type NoMethod CryptoKeyVersionTemplate
  818. raw := NoMethod(*s)
  819. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  820. }
  821. // DecryptRequest: Request message for KeyManagementService.Decrypt.
  822. type DecryptRequest struct {
  823. // AdditionalAuthenticatedData: Optional data that must match the data
  824. // originally supplied in
  825. // EncryptRequest.additional_authenticated_data.
  826. AdditionalAuthenticatedData string `json:"additionalAuthenticatedData,omitempty"`
  827. // Ciphertext: Required. The encrypted data originally returned
  828. // in
  829. // EncryptResponse.ciphertext.
  830. Ciphertext string `json:"ciphertext,omitempty"`
  831. // ForceSendFields is a list of field names (e.g.
  832. // "AdditionalAuthenticatedData") to unconditionally include in API
  833. // requests. By default, fields with empty values are omitted from API
  834. // requests. However, any non-pointer, non-interface field appearing in
  835. // ForceSendFields will be sent to the server regardless of whether the
  836. // field is empty or not. This may be used to include empty fields in
  837. // Patch requests.
  838. ForceSendFields []string `json:"-"`
  839. // NullFields is a list of field names (e.g.
  840. // "AdditionalAuthenticatedData") to include in API requests with the
  841. // JSON null value. By default, fields with empty values are omitted
  842. // from API requests. However, any field with an empty value appearing
  843. // in NullFields will be sent to the server as null. It is an error if a
  844. // field in this list has a non-empty value. This may be used to include
  845. // null fields in Patch requests.
  846. NullFields []string `json:"-"`
  847. }
  848. func (s *DecryptRequest) MarshalJSON() ([]byte, error) {
  849. type NoMethod DecryptRequest
  850. raw := NoMethod(*s)
  851. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  852. }
  853. // DecryptResponse: Response message for KeyManagementService.Decrypt.
  854. type DecryptResponse struct {
  855. // Plaintext: The decrypted data originally supplied in
  856. // EncryptRequest.plaintext.
  857. Plaintext string `json:"plaintext,omitempty"`
  858. // ServerResponse contains the HTTP response code and headers from the
  859. // server.
  860. googleapi.ServerResponse `json:"-"`
  861. // ForceSendFields is a list of field names (e.g. "Plaintext") to
  862. // unconditionally include in API requests. By default, fields with
  863. // empty values are omitted from API requests. However, any non-pointer,
  864. // non-interface field appearing in ForceSendFields will be sent to the
  865. // server regardless of whether the field is empty or not. This may be
  866. // used to include empty fields in Patch requests.
  867. ForceSendFields []string `json:"-"`
  868. // NullFields is a list of field names (e.g. "Plaintext") to include in
  869. // API requests with the JSON null value. By default, fields with empty
  870. // values are omitted from API requests. However, any field with an
  871. // empty value appearing in NullFields will be sent to the server as
  872. // null. It is an error if a field in this list has a non-empty value.
  873. // This may be used to include null fields in Patch requests.
  874. NullFields []string `json:"-"`
  875. }
  876. func (s *DecryptResponse) MarshalJSON() ([]byte, error) {
  877. type NoMethod DecryptResponse
  878. raw := NoMethod(*s)
  879. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  880. }
  881. // DestroyCryptoKeyVersionRequest: Request message for
  882. // KeyManagementService.DestroyCryptoKeyVersion.
  883. type DestroyCryptoKeyVersionRequest struct {
  884. }
  885. // Digest: A Digest holds a cryptographic message digest.
  886. type Digest struct {
  887. // Sha256: A message digest produced with the SHA-256 algorithm.
  888. Sha256 string `json:"sha256,omitempty"`
  889. // Sha384: A message digest produced with the SHA-384 algorithm.
  890. Sha384 string `json:"sha384,omitempty"`
  891. // Sha512: A message digest produced with the SHA-512 algorithm.
  892. Sha512 string `json:"sha512,omitempty"`
  893. // ForceSendFields is a list of field names (e.g. "Sha256") to
  894. // unconditionally include in API requests. By default, fields with
  895. // empty values are omitted from API requests. However, any non-pointer,
  896. // non-interface field appearing in ForceSendFields will be sent to the
  897. // server regardless of whether the field is empty or not. This may be
  898. // used to include empty fields in Patch requests.
  899. ForceSendFields []string `json:"-"`
  900. // NullFields is a list of field names (e.g. "Sha256") to include in API
  901. // requests with the JSON null value. By default, fields with empty
  902. // values are omitted from API requests. However, any field with an
  903. // empty value appearing in NullFields will be sent to the server as
  904. // null. It is an error if a field in this list has a non-empty value.
  905. // This may be used to include null fields in Patch requests.
  906. NullFields []string `json:"-"`
  907. }
  908. func (s *Digest) MarshalJSON() ([]byte, error) {
  909. type NoMethod Digest
  910. raw := NoMethod(*s)
  911. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  912. }
  913. // EncryptRequest: Request message for KeyManagementService.Encrypt.
  914. type EncryptRequest struct {
  915. // AdditionalAuthenticatedData: Optional data that, if specified, must
  916. // also be provided during decryption
  917. // through DecryptRequest.additional_authenticated_data.
  918. //
  919. // The maximum size depends on the key version's
  920. // protection_level. For
  921. // SOFTWARE keys, the AAD must be no larger than
  922. // 64KiB. For HSM keys, the combined length of the
  923. // plaintext and additional_authenticated_data fields must be no larger
  924. // than
  925. // 8KiB.
  926. AdditionalAuthenticatedData string `json:"additionalAuthenticatedData,omitempty"`
  927. // Plaintext: Required. The data to encrypt. Must be no larger than
  928. // 64KiB.
  929. //
  930. // The maximum size depends on the key version's
  931. // protection_level. For
  932. // SOFTWARE keys, the plaintext must be no larger
  933. // than 64KiB. For HSM keys, the combined length of the
  934. // plaintext and additional_authenticated_data fields must be no larger
  935. // than
  936. // 8KiB.
  937. Plaintext string `json:"plaintext,omitempty"`
  938. // ForceSendFields is a list of field names (e.g.
  939. // "AdditionalAuthenticatedData") to unconditionally include in API
  940. // requests. By default, fields with empty values are omitted from API
  941. // requests. However, any non-pointer, non-interface field appearing in
  942. // ForceSendFields will be sent to the server regardless of whether the
  943. // field is empty or not. This may be used to include empty fields in
  944. // Patch requests.
  945. ForceSendFields []string `json:"-"`
  946. // NullFields is a list of field names (e.g.
  947. // "AdditionalAuthenticatedData") to include in API requests with the
  948. // JSON null value. By default, fields with empty values are omitted
  949. // from API requests. However, any field with an empty value appearing
  950. // in NullFields will be sent to the server as null. It is an error if a
  951. // field in this list has a non-empty value. This may be used to include
  952. // null fields in Patch requests.
  953. NullFields []string `json:"-"`
  954. }
  955. func (s *EncryptRequest) MarshalJSON() ([]byte, error) {
  956. type NoMethod EncryptRequest
  957. raw := NoMethod(*s)
  958. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  959. }
  960. // EncryptResponse: Response message for KeyManagementService.Encrypt.
  961. type EncryptResponse struct {
  962. // Ciphertext: The encrypted data.
  963. Ciphertext string `json:"ciphertext,omitempty"`
  964. // Name: The resource name of the CryptoKeyVersion used in encryption.
  965. Name string `json:"name,omitempty"`
  966. // ServerResponse contains the HTTP response code and headers from the
  967. // server.
  968. googleapi.ServerResponse `json:"-"`
  969. // ForceSendFields is a list of field names (e.g. "Ciphertext") to
  970. // unconditionally include in API requests. By default, fields with
  971. // empty values are omitted from API requests. However, any non-pointer,
  972. // non-interface field appearing in ForceSendFields will be sent to the
  973. // server regardless of whether the field is empty or not. This may be
  974. // used to include empty fields in Patch requests.
  975. ForceSendFields []string `json:"-"`
  976. // NullFields is a list of field names (e.g. "Ciphertext") to include in
  977. // API requests with the JSON null value. By default, fields with empty
  978. // values are omitted from API requests. However, any field with an
  979. // empty value appearing in NullFields will be sent to the server as
  980. // null. It is an error if a field in this list has a non-empty value.
  981. // This may be used to include null fields in Patch requests.
  982. NullFields []string `json:"-"`
  983. }
  984. func (s *EncryptResponse) MarshalJSON() ([]byte, error) {
  985. type NoMethod EncryptResponse
  986. raw := NoMethod(*s)
  987. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  988. }
  989. // Expr: Represents an expression text. Example:
  990. //
  991. // title: "User account presence"
  992. // description: "Determines whether the request has a user account"
  993. // expression: "size(request.user) > 0"
  994. type Expr struct {
  995. // Description: An optional description of the expression. This is a
  996. // longer text which
  997. // describes the expression, e.g. when hovered over it in a UI.
  998. Description string `json:"description,omitempty"`
  999. // Expression: Textual representation of an expression in
  1000. // Common Expression Language syntax.
  1001. //
  1002. // The application context of the containing message determines
  1003. // which
  1004. // well-known feature set of CEL is supported.
  1005. Expression string `json:"expression,omitempty"`
  1006. // Location: An optional string indicating the location of the
  1007. // expression for error
  1008. // reporting, e.g. a file name and a position in the file.
  1009. Location string `json:"location,omitempty"`
  1010. // Title: An optional title for the expression, i.e. a short string
  1011. // describing
  1012. // its purpose. This can be used e.g. in UIs which allow to enter
  1013. // the
  1014. // expression.
  1015. Title string `json:"title,omitempty"`
  1016. // ForceSendFields is a list of field names (e.g. "Description") to
  1017. // unconditionally include in API requests. By default, fields with
  1018. // empty values are omitted from API requests. However, any non-pointer,
  1019. // non-interface field appearing in ForceSendFields will be sent to the
  1020. // server regardless of whether the field is empty or not. This may be
  1021. // used to include empty fields in Patch requests.
  1022. ForceSendFields []string `json:"-"`
  1023. // NullFields is a list of field names (e.g. "Description") to include
  1024. // in API requests with the JSON null value. By default, fields with
  1025. // empty values are omitted from API requests. However, any field with
  1026. // an empty value appearing in NullFields will be sent to the server as
  1027. // null. It is an error if a field in this list has a non-empty value.
  1028. // This may be used to include null fields in Patch requests.
  1029. NullFields []string `json:"-"`
  1030. }
  1031. func (s *Expr) MarshalJSON() ([]byte, error) {
  1032. type NoMethod Expr
  1033. raw := NoMethod(*s)
  1034. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1035. }
  1036. // KeyOperationAttestation: Contains an HSM-generated attestation about
  1037. // a key operation. For more
  1038. // information, see [Verifying
  1039. // attestations]
  1040. // (https://cloud.google.com/kms/docs/attest-key).
  1041. type KeyOperationAttestation struct {
  1042. // Content: Output only. The attestation data provided by the HSM when
  1043. // the key
  1044. // operation was performed.
  1045. Content string `json:"content,omitempty"`
  1046. // Format: Output only. The format of the attestation data.
  1047. //
  1048. // Possible values:
  1049. // "ATTESTATION_FORMAT_UNSPECIFIED" - Not specified.
  1050. // "CAVIUM_V1_COMPRESSED" - Cavium HSM attestation compressed with
  1051. // gzip. Note that this format is
  1052. // defined by Cavium and subject to change at any time.
  1053. // "CAVIUM_V2_COMPRESSED" - Cavium HSM attestation V2 compressed with
  1054. // gzip. This is a new format
  1055. // introduced in Cavium's version 3.2-08.
  1056. Format string `json:"format,omitempty"`
  1057. // ForceSendFields is a list of field names (e.g. "Content") to
  1058. // unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. // NullFields is a list of field names (e.g. "Content") to include in
  1065. // API requests with the JSON null value. By default, fields with empty
  1066. // values are omitted from API requests. However, any field with an
  1067. // empty value appearing in NullFields will be sent to the server as
  1068. // null. It is an error if a field in this list has a non-empty value.
  1069. // This may be used to include null fields in Patch requests.
  1070. NullFields []string `json:"-"`
  1071. }
  1072. func (s *KeyOperationAttestation) MarshalJSON() ([]byte, error) {
  1073. type NoMethod KeyOperationAttestation
  1074. raw := NoMethod(*s)
  1075. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1076. }
  1077. // KeyRing: A KeyRing is a toplevel logical grouping of CryptoKeys.
  1078. type KeyRing struct {
  1079. // CreateTime: Output only. The time at which this KeyRing was created.
  1080. CreateTime string `json:"createTime,omitempty"`
  1081. // Name: Output only. The resource name for the KeyRing in the
  1082. // format
  1083. // `projects/*/locations/*/keyRings/*`.
  1084. Name string `json:"name,omitempty"`
  1085. // ServerResponse contains the HTTP response code and headers from the
  1086. // server.
  1087. googleapi.ServerResponse `json:"-"`
  1088. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1089. // unconditionally include in API requests. By default, fields with
  1090. // empty values are omitted from API requests. However, any non-pointer,
  1091. // non-interface field appearing in ForceSendFields will be sent to the
  1092. // server regardless of whether the field is empty or not. This may be
  1093. // used to include empty fields in Patch requests.
  1094. ForceSendFields []string `json:"-"`
  1095. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1096. // API requests with the JSON null value. By default, fields with empty
  1097. // values are omitted from API requests. However, any field with an
  1098. // empty value appearing in NullFields will be sent to the server as
  1099. // null. It is an error if a field in this list has a non-empty value.
  1100. // This may be used to include null fields in Patch requests.
  1101. NullFields []string `json:"-"`
  1102. }
  1103. func (s *KeyRing) MarshalJSON() ([]byte, error) {
  1104. type NoMethod KeyRing
  1105. raw := NoMethod(*s)
  1106. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1107. }
  1108. // ListCryptoKeyVersionsResponse: Response message for
  1109. // KeyManagementService.ListCryptoKeyVersions.
  1110. type ListCryptoKeyVersionsResponse struct {
  1111. // CryptoKeyVersions: The list of CryptoKeyVersions.
  1112. CryptoKeyVersions []*CryptoKeyVersion `json:"cryptoKeyVersions,omitempty"`
  1113. // NextPageToken: A token to retrieve next page of results. Pass this
  1114. // value in
  1115. // ListCryptoKeyVersionsRequest.page_token to retrieve the next page
  1116. // of
  1117. // results.
  1118. NextPageToken string `json:"nextPageToken,omitempty"`
  1119. // TotalSize: The total number of CryptoKeyVersions that matched
  1120. // the
  1121. // query.
  1122. TotalSize int64 `json:"totalSize,omitempty"`
  1123. // ServerResponse contains the HTTP response code and headers from the
  1124. // server.
  1125. googleapi.ServerResponse `json:"-"`
  1126. // ForceSendFields is a list of field names (e.g. "CryptoKeyVersions")
  1127. // to unconditionally include in API requests. By default, fields with
  1128. // empty values are omitted from API requests. However, any non-pointer,
  1129. // non-interface field appearing in ForceSendFields will be sent to the
  1130. // server regardless of whether the field is empty or not. This may be
  1131. // used to include empty fields in Patch requests.
  1132. ForceSendFields []string `json:"-"`
  1133. // NullFields is a list of field names (e.g. "CryptoKeyVersions") to
  1134. // include in API requests with the JSON null value. By default, fields
  1135. // with empty values are omitted from API requests. However, any field
  1136. // with an empty value appearing in NullFields will be sent to the
  1137. // server as null. It is an error if a field in this list has a
  1138. // non-empty value. This may be used to include null fields in Patch
  1139. // requests.
  1140. NullFields []string `json:"-"`
  1141. }
  1142. func (s *ListCryptoKeyVersionsResponse) MarshalJSON() ([]byte, error) {
  1143. type NoMethod ListCryptoKeyVersionsResponse
  1144. raw := NoMethod(*s)
  1145. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1146. }
  1147. // ListCryptoKeysResponse: Response message for
  1148. // KeyManagementService.ListCryptoKeys.
  1149. type ListCryptoKeysResponse struct {
  1150. // CryptoKeys: The list of CryptoKeys.
  1151. CryptoKeys []*CryptoKey `json:"cryptoKeys,omitempty"`
  1152. // NextPageToken: A token to retrieve next page of results. Pass this
  1153. // value in
  1154. // ListCryptoKeysRequest.page_token to retrieve the next page of
  1155. // results.
  1156. NextPageToken string `json:"nextPageToken,omitempty"`
  1157. // TotalSize: The total number of CryptoKeys that matched the query.
  1158. TotalSize int64 `json:"totalSize,omitempty"`
  1159. // ServerResponse contains the HTTP response code and headers from the
  1160. // server.
  1161. googleapi.ServerResponse `json:"-"`
  1162. // ForceSendFields is a list of field names (e.g. "CryptoKeys") to
  1163. // unconditionally include in API requests. By default, fields with
  1164. // empty values are omitted from API requests. However, any non-pointer,
  1165. // non-interface field appearing in ForceSendFields will be sent to the
  1166. // server regardless of whether the field is empty or not. This may be
  1167. // used to include empty fields in Patch requests.
  1168. ForceSendFields []string `json:"-"`
  1169. // NullFields is a list of field names (e.g. "CryptoKeys") to include in
  1170. // API requests with the JSON null value. By default, fields with empty
  1171. // values are omitted from API requests. However, any field with an
  1172. // empty value appearing in NullFields will be sent to the server as
  1173. // null. It is an error if a field in this list has a non-empty value.
  1174. // This may be used to include null fields in Patch requests.
  1175. NullFields []string `json:"-"`
  1176. }
  1177. func (s *ListCryptoKeysResponse) MarshalJSON() ([]byte, error) {
  1178. type NoMethod ListCryptoKeysResponse
  1179. raw := NoMethod(*s)
  1180. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1181. }
  1182. // ListKeyRingsResponse: Response message for
  1183. // KeyManagementService.ListKeyRings.
  1184. type ListKeyRingsResponse struct {
  1185. // KeyRings: The list of KeyRings.
  1186. KeyRings []*KeyRing `json:"keyRings,omitempty"`
  1187. // NextPageToken: A token to retrieve next page of results. Pass this
  1188. // value in
  1189. // ListKeyRingsRequest.page_token to retrieve the next page of results.
  1190. NextPageToken string `json:"nextPageToken,omitempty"`
  1191. // TotalSize: The total number of KeyRings that matched the query.
  1192. TotalSize int64 `json:"totalSize,omitempty"`
  1193. // ServerResponse contains the HTTP response code and headers from the
  1194. // server.
  1195. googleapi.ServerResponse `json:"-"`
  1196. // ForceSendFields is a list of field names (e.g. "KeyRings") to
  1197. // unconditionally include in API requests. By default, fields with
  1198. // empty values are omitted from API requests. However, any non-pointer,
  1199. // non-interface field appearing in ForceSendFields will be sent to the
  1200. // server regardless of whether the field is empty or not. This may be
  1201. // used to include empty fields in Patch requests.
  1202. ForceSendFields []string `json:"-"`
  1203. // NullFields is a list of field names (e.g. "KeyRings") to include in
  1204. // API requests with the JSON null value. By default, fields with empty
  1205. // values are omitted from API requests. However, any field with an
  1206. // empty value appearing in NullFields will be sent to the server as
  1207. // null. It is an error if a field in this list has a non-empty value.
  1208. // This may be used to include null fields in Patch requests.
  1209. NullFields []string `json:"-"`
  1210. }
  1211. func (s *ListKeyRingsResponse) MarshalJSON() ([]byte, error) {
  1212. type NoMethod ListKeyRingsResponse
  1213. raw := NoMethod(*s)
  1214. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1215. }
  1216. // ListLocationsResponse: The response message for
  1217. // Locations.ListLocations.
  1218. type ListLocationsResponse struct {
  1219. // Locations: A list of locations that matches the specified filter in
  1220. // the request.
  1221. Locations []*Location `json:"locations,omitempty"`
  1222. // NextPageToken: The standard List next-page token.
  1223. NextPageToken string `json:"nextPageToken,omitempty"`
  1224. // ServerResponse contains the HTTP response code and headers from the
  1225. // server.
  1226. googleapi.ServerResponse `json:"-"`
  1227. // ForceSendFields is a list of field names (e.g. "Locations") to
  1228. // unconditionally include in API requests. By default, fields with
  1229. // empty values are omitted from API requests. However, any non-pointer,
  1230. // non-interface field appearing in ForceSendFields will be sent to the
  1231. // server regardless of whether the field is empty or not. This may be
  1232. // used to include empty fields in Patch requests.
  1233. ForceSendFields []string `json:"-"`
  1234. // NullFields is a list of field names (e.g. "Locations") to include in
  1235. // API requests with the JSON null value. By default, fields with empty
  1236. // values are omitted from API requests. However, any field with an
  1237. // empty value appearing in NullFields will be sent to the server as
  1238. // null. It is an error if a field in this list has a non-empty value.
  1239. // This may be used to include null fields in Patch requests.
  1240. NullFields []string `json:"-"`
  1241. }
  1242. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  1243. type NoMethod ListLocationsResponse
  1244. raw := NoMethod(*s)
  1245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1246. }
  1247. // Location: A resource that represents Google Cloud Platform location.
  1248. type Location struct {
  1249. // DisplayName: The friendly name for this location, typically a nearby
  1250. // city name.
  1251. // For example, "Tokyo".
  1252. DisplayName string `json:"displayName,omitempty"`
  1253. // Labels: Cross-service attributes for the location. For example
  1254. //
  1255. // {"cloud.googleapis.com/region": "us-east1"}
  1256. Labels map[string]string `json:"labels,omitempty"`
  1257. // LocationId: The canonical id for this location. For example:
  1258. // "us-east1".
  1259. LocationId string `json:"locationId,omitempty"`
  1260. // Metadata: Service-specific metadata. For example the available
  1261. // capacity at the given
  1262. // location.
  1263. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1264. // Name: Resource name for the location, which may vary between
  1265. // implementations.
  1266. // For example: "projects/example-project/locations/us-east1"
  1267. Name string `json:"name,omitempty"`
  1268. // ServerResponse contains the HTTP response code and headers from the
  1269. // server.
  1270. googleapi.ServerResponse `json:"-"`
  1271. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1272. // unconditionally include in API requests. By default, fields with
  1273. // empty values are omitted from API requests. However, any non-pointer,
  1274. // non-interface field appearing in ForceSendFields will be sent to the
  1275. // server regardless of whether the field is empty or not. This may be
  1276. // used to include empty fields in Patch requests.
  1277. ForceSendFields []string `json:"-"`
  1278. // NullFields is a list of field names (e.g. "DisplayName") to include
  1279. // in API requests with the JSON null value. By default, fields with
  1280. // empty values are omitted from API requests. However, any field with
  1281. // an empty value appearing in NullFields will be sent to the server as
  1282. // null. It is an error if a field in this list has a non-empty value.
  1283. // This may be used to include null fields in Patch requests.
  1284. NullFields []string `json:"-"`
  1285. }
  1286. func (s *Location) MarshalJSON() ([]byte, error) {
  1287. type NoMethod Location
  1288. raw := NoMethod(*s)
  1289. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1290. }
  1291. // LocationMetadata: Cloud KMS metadata for the given
  1292. // google.cloud.location.Location.
  1293. type LocationMetadata struct {
  1294. // HsmAvailable: Indicates whether CryptoKeys with
  1295. // protection_level
  1296. // HSM can be created in this location.
  1297. HsmAvailable bool `json:"hsmAvailable,omitempty"`
  1298. // ForceSendFields is a list of field names (e.g. "HsmAvailable") to
  1299. // unconditionally include in API requests. By default, fields with
  1300. // empty values are omitted from API requests. However, any non-pointer,
  1301. // non-interface field appearing in ForceSendFields will be sent to the
  1302. // server regardless of whether the field is empty or not. This may be
  1303. // used to include empty fields in Patch requests.
  1304. ForceSendFields []string `json:"-"`
  1305. // NullFields is a list of field names (e.g. "HsmAvailable") to include
  1306. // in API requests with the JSON null value. By default, fields with
  1307. // empty values are omitted from API requests. However, any field with
  1308. // an empty value appearing in NullFields will be sent to the server as
  1309. // null. It is an error if a field in this list has a non-empty value.
  1310. // This may be used to include null fields in Patch requests.
  1311. NullFields []string `json:"-"`
  1312. }
  1313. func (s *LocationMetadata) MarshalJSON() ([]byte, error) {
  1314. type NoMethod LocationMetadata
  1315. raw := NoMethod(*s)
  1316. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1317. }
  1318. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1319. // used to
  1320. // specify access control policies for Cloud Platform resources.
  1321. //
  1322. //
  1323. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1324. // of
  1325. // `members` to a `role`, where the members can be user accounts, Google
  1326. // groups,
  1327. // Google domains, and service accounts. A `role` is a named list of
  1328. // permissions
  1329. // defined by IAM.
  1330. //
  1331. // **JSON Example**
  1332. //
  1333. // {
  1334. // "bindings": [
  1335. // {
  1336. // "role": "roles/owner",
  1337. // "members": [
  1338. // "user:mike@example.com",
  1339. // "group:admins@example.com",
  1340. // "domain:google.com",
  1341. //
  1342. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1343. // ]
  1344. // },
  1345. // {
  1346. // "role": "roles/viewer",
  1347. // "members": ["user:sean@example.com"]
  1348. // }
  1349. // ]
  1350. // }
  1351. //
  1352. // **YAML Example**
  1353. //
  1354. // bindings:
  1355. // - members:
  1356. // - user:mike@example.com
  1357. // - group:admins@example.com
  1358. // - domain:google.com
  1359. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1360. // role: roles/owner
  1361. // - members:
  1362. // - user:sean@example.com
  1363. // role: roles/viewer
  1364. //
  1365. //
  1366. // For a description of IAM and its features, see the
  1367. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1368. type Policy struct {
  1369. // AuditConfigs: Specifies cloud audit logging configuration for this
  1370. // policy.
  1371. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  1372. // Bindings: Associates a list of `members` to a `role`.
  1373. // `bindings` with no members will result in an error.
  1374. Bindings []*Binding `json:"bindings,omitempty"`
  1375. // Etag: `etag` is used for optimistic concurrency control as a way to
  1376. // help
  1377. // prevent simultaneous updates of a policy from overwriting each
  1378. // other.
  1379. // It is strongly suggested that systems make use of the `etag` in
  1380. // the
  1381. // read-modify-write cycle to perform policy updates in order to avoid
  1382. // race
  1383. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1384. // and
  1385. // systems are expected to put that etag in the request to
  1386. // `setIamPolicy` to
  1387. // ensure that their change will be applied to the same version of the
  1388. // policy.
  1389. //
  1390. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1391. // existing
  1392. // policy is overwritten blindly.
  1393. Etag string `json:"etag,omitempty"`
  1394. // Version: Deprecated.
  1395. Version int64 `json:"version,omitempty"`
  1396. // ServerResponse contains the HTTP response code and headers from the
  1397. // server.
  1398. googleapi.ServerResponse `json:"-"`
  1399. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  1400. // unconditionally include in API requests. By default, fields with
  1401. // empty values are omitted from API requests. However, any non-pointer,
  1402. // non-interface field appearing in ForceSendFields will be sent to the
  1403. // server regardless of whether the field is empty or not. This may be
  1404. // used to include empty fields in Patch requests.
  1405. ForceSendFields []string `json:"-"`
  1406. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  1407. // in API requests with the JSON null value. By default, fields with
  1408. // empty values are omitted from API requests. However, any field with
  1409. // an empty value appearing in NullFields will be sent to the server as
  1410. // null. It is an error if a field in this list has a non-empty value.
  1411. // This may be used to include null fields in Patch requests.
  1412. NullFields []string `json:"-"`
  1413. }
  1414. func (s *Policy) MarshalJSON() ([]byte, error) {
  1415. type NoMethod Policy
  1416. raw := NoMethod(*s)
  1417. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1418. }
  1419. // PublicKey: The public key for a given CryptoKeyVersion. Obtained
  1420. // via
  1421. // GetPublicKey.
  1422. type PublicKey struct {
  1423. // Algorithm: The Algorithm associated
  1424. // with this key.
  1425. //
  1426. // Possible values:
  1427. // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified.
  1428. // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys.
  1429. // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256
  1430. // digest.
  1431. // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256
  1432. // digest.
  1433. // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256
  1434. // digest.
  1435. // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512
  1436. // digest.
  1437. // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit
  1438. // key and a SHA256 digest.
  1439. // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit
  1440. // key and a SHA256 digest.
  1441. // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit
  1442. // key and a SHA256 digest.
  1443. // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit
  1444. // key and a SHA512 digest.
  1445. // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a
  1446. // SHA256 digest.
  1447. // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a
  1448. // SHA256 digest.
  1449. // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a
  1450. // SHA256 digest.
  1451. // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a
  1452. // SHA512 digest.
  1453. // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256
  1454. // digest.
  1455. // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384
  1456. // digest.
  1457. Algorithm string `json:"algorithm,omitempty"`
  1458. // Pem: The public key, encoded in PEM format. For more information, see
  1459. // the
  1460. // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
  1461. // [General
  1462. // Considerations](https://tools.ietf.org/html/rfc7468#section-2)
  1463. // and
  1464. // [Textual Encoding of Subject Public Key
  1465. // Info]
  1466. // (https://tools.ietf.org/html/rfc7468#section-13).
  1467. Pem string `json:"pem,omitempty"`
  1468. // ServerResponse contains the HTTP response code and headers from the
  1469. // server.
  1470. googleapi.ServerResponse `json:"-"`
  1471. // ForceSendFields is a list of field names (e.g. "Algorithm") to
  1472. // unconditionally include in API requests. By default, fields with
  1473. // empty values are omitted from API requests. However, any non-pointer,
  1474. // non-interface field appearing in ForceSendFields will be sent to the
  1475. // server regardless of whether the field is empty or not. This may be
  1476. // used to include empty fields in Patch requests.
  1477. ForceSendFields []string `json:"-"`
  1478. // NullFields is a list of field names (e.g. "Algorithm") to include in
  1479. // API requests with the JSON null value. By default, fields with empty
  1480. // values are omitted from API requests. However, any field with an
  1481. // empty value appearing in NullFields will be sent to the server as
  1482. // null. It is an error if a field in this list has a non-empty value.
  1483. // This may be used to include null fields in Patch requests.
  1484. NullFields []string `json:"-"`
  1485. }
  1486. func (s *PublicKey) MarshalJSON() ([]byte, error) {
  1487. type NoMethod PublicKey
  1488. raw := NoMethod(*s)
  1489. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1490. }
  1491. // RestoreCryptoKeyVersionRequest: Request message for
  1492. // KeyManagementService.RestoreCryptoKeyVersion.
  1493. type RestoreCryptoKeyVersionRequest struct {
  1494. }
  1495. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1496. type SetIamPolicyRequest struct {
  1497. // Policy: REQUIRED: The complete policy to be applied to the
  1498. // `resource`. The size of
  1499. // the policy is limited to a few 10s of KB. An empty policy is a
  1500. // valid policy but certain Cloud Platform services (such as
  1501. // Projects)
  1502. // might reject them.
  1503. Policy *Policy `json:"policy,omitempty"`
  1504. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1505. // policy to modify. Only
  1506. // the fields in the mask will be modified. If no mask is provided,
  1507. // the
  1508. // following default mask is used:
  1509. // paths: "bindings, etag"
  1510. // This field is only used by Cloud IAM.
  1511. UpdateMask string `json:"updateMask,omitempty"`
  1512. // ForceSendFields is a list of field names (e.g. "Policy") to
  1513. // unconditionally include in API requests. By default, fields with
  1514. // empty values are omitted from API requests. However, any non-pointer,
  1515. // non-interface field appearing in ForceSendFields will be sent to the
  1516. // server regardless of whether the field is empty or not. This may be
  1517. // used to include empty fields in Patch requests.
  1518. ForceSendFields []string `json:"-"`
  1519. // NullFields is a list of field names (e.g. "Policy") to include in API
  1520. // requests with the JSON null value. By default, fields with empty
  1521. // values are omitted from API requests. However, any field with an
  1522. // empty value appearing in NullFields will be sent to the server as
  1523. // null. It is an error if a field in this list has a non-empty value.
  1524. // This may be used to include null fields in Patch requests.
  1525. NullFields []string `json:"-"`
  1526. }
  1527. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1528. type NoMethod SetIamPolicyRequest
  1529. raw := NoMethod(*s)
  1530. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1531. }
  1532. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1533. // method.
  1534. type TestIamPermissionsRequest struct {
  1535. // Permissions: The set of permissions to check for the `resource`.
  1536. // Permissions with
  1537. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1538. // more
  1539. // information see
  1540. // [IAM
  1541. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1542. Permissions []string `json:"permissions,omitempty"`
  1543. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1544. // unconditionally include in API requests. By default, fields with
  1545. // empty values are omitted from API requests. However, any non-pointer,
  1546. // non-interface field appearing in ForceSendFields will be sent to the
  1547. // server regardless of whether the field is empty or not. This may be
  1548. // used to include empty fields in Patch requests.
  1549. ForceSendFields []string `json:"-"`
  1550. // NullFields is a list of field names (e.g. "Permissions") to include
  1551. // in API requests with the JSON null value. By default, fields with
  1552. // empty values are omitted from API requests. However, any field with
  1553. // an empty value appearing in NullFields will be sent to the server as
  1554. // null. It is an error if a field in this list has a non-empty value.
  1555. // This may be used to include null fields in Patch requests.
  1556. NullFields []string `json:"-"`
  1557. }
  1558. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1559. type NoMethod TestIamPermissionsRequest
  1560. raw := NoMethod(*s)
  1561. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1562. }
  1563. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1564. // method.
  1565. type TestIamPermissionsResponse struct {
  1566. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1567. // the caller is
  1568. // allowed.
  1569. Permissions []string `json:"permissions,omitempty"`
  1570. // ServerResponse contains the HTTP response code and headers from the
  1571. // server.
  1572. googleapi.ServerResponse `json:"-"`
  1573. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1574. // unconditionally include in API requests. By default, fields with
  1575. // empty values are omitted from API requests. However, any non-pointer,
  1576. // non-interface field appearing in ForceSendFields will be sent to the
  1577. // server regardless of whether the field is empty or not. This may be
  1578. // used to include empty fields in Patch requests.
  1579. ForceSendFields []string `json:"-"`
  1580. // NullFields is a list of field names (e.g. "Permissions") to include
  1581. // in API requests with the JSON null value. By default, fields with
  1582. // empty values are omitted from API requests. However, any field with
  1583. // an empty value appearing in NullFields will be sent to the server as
  1584. // null. It is an error if a field in this list has a non-empty value.
  1585. // This may be used to include null fields in Patch requests.
  1586. NullFields []string `json:"-"`
  1587. }
  1588. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1589. type NoMethod TestIamPermissionsResponse
  1590. raw := NoMethod(*s)
  1591. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1592. }
  1593. // UpdateCryptoKeyPrimaryVersionRequest: Request message for
  1594. // KeyManagementService.UpdateCryptoKeyPrimaryVersion.
  1595. type UpdateCryptoKeyPrimaryVersionRequest struct {
  1596. // CryptoKeyVersionId: The id of the child CryptoKeyVersion to use as
  1597. // primary.
  1598. CryptoKeyVersionId string `json:"cryptoKeyVersionId,omitempty"`
  1599. // ForceSendFields is a list of field names (e.g. "CryptoKeyVersionId")
  1600. // to unconditionally include in API requests. By default, fields with
  1601. // empty values are omitted from API requests. However, any non-pointer,
  1602. // non-interface field appearing in ForceSendFields will be sent to the
  1603. // server regardless of whether the field is empty or not. This may be
  1604. // used to include empty fields in Patch requests.
  1605. ForceSendFields []string `json:"-"`
  1606. // NullFields is a list of field names (e.g. "CryptoKeyVersionId") to
  1607. // include in API requests with the JSON null value. By default, fields
  1608. // with empty values are omitted from API requests. However, any field
  1609. // with an empty value appearing in NullFields will be sent to the
  1610. // server as null. It is an error if a field in this list has a
  1611. // non-empty value. This may be used to include null fields in Patch
  1612. // requests.
  1613. NullFields []string `json:"-"`
  1614. }
  1615. func (s *UpdateCryptoKeyPrimaryVersionRequest) MarshalJSON() ([]byte, error) {
  1616. type NoMethod UpdateCryptoKeyPrimaryVersionRequest
  1617. raw := NoMethod(*s)
  1618. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1619. }
  1620. // method id "cloudkms.projects.locations.get":
  1621. type ProjectsLocationsGetCall struct {
  1622. s *Service
  1623. name string
  1624. urlParams_ gensupport.URLParams
  1625. ifNoneMatch_ string
  1626. ctx_ context.Context
  1627. header_ http.Header
  1628. }
  1629. // Get: Gets information about a location.
  1630. func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
  1631. c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1632. c.name = name
  1633. return c
  1634. }
  1635. // Fields allows partial responses to be retrieved. See
  1636. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1637. // for more information.
  1638. func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
  1639. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1640. return c
  1641. }
  1642. // IfNoneMatch sets the optional parameter which makes the operation
  1643. // fail if the object's ETag matches the given value. This is useful for
  1644. // getting updates only after the object has changed since the last
  1645. // request. Use googleapi.IsNotModified to check whether the response
  1646. // error from Do is the result of In-None-Match.
  1647. func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
  1648. c.ifNoneMatch_ = entityTag
  1649. return c
  1650. }
  1651. // Context sets the context to be used in this call's Do method. Any
  1652. // pending HTTP request will be aborted if the provided context is
  1653. // canceled.
  1654. func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
  1655. c.ctx_ = ctx
  1656. return c
  1657. }
  1658. // Header returns an http.Header that can be modified by the caller to
  1659. // add HTTP headers to the request.
  1660. func (c *ProjectsLocationsGetCall) Header() http.Header {
  1661. if c.header_ == nil {
  1662. c.header_ = make(http.Header)
  1663. }
  1664. return c.header_
  1665. }
  1666. func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
  1667. reqHeaders := make(http.Header)
  1668. for k, v := range c.header_ {
  1669. reqHeaders[k] = v
  1670. }
  1671. reqHeaders.Set("User-Agent", c.s.userAgent())
  1672. if c.ifNoneMatch_ != "" {
  1673. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1674. }
  1675. var body io.Reader = nil
  1676. c.urlParams_.Set("alt", alt)
  1677. c.urlParams_.Set("prettyPrint", "false")
  1678. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1679. urls += "?" + c.urlParams_.Encode()
  1680. req, err := http.NewRequest("GET", urls, body)
  1681. if err != nil {
  1682. return nil, err
  1683. }
  1684. req.Header = reqHeaders
  1685. googleapi.Expand(req.URL, map[string]string{
  1686. "name": c.name,
  1687. })
  1688. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1689. }
  1690. // Do executes the "cloudkms.projects.locations.get" call.
  1691. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  1692. // code is an error. Response headers are in either
  1693. // *Location.ServerResponse.Header or (if a response was returned at
  1694. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1695. // to check whether the returned error was because
  1696. // http.StatusNotModified was returned.
  1697. func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  1698. gensupport.SetOptions(c.urlParams_, opts...)
  1699. res, err := c.doRequest("json")
  1700. if res != nil && res.StatusCode == http.StatusNotModified {
  1701. if res.Body != nil {
  1702. res.Body.Close()
  1703. }
  1704. return nil, &googleapi.Error{
  1705. Code: res.StatusCode,
  1706. Header: res.Header,
  1707. }
  1708. }
  1709. if err != nil {
  1710. return nil, err
  1711. }
  1712. defer googleapi.CloseBody(res)
  1713. if err := googleapi.CheckResponse(res); err != nil {
  1714. return nil, err
  1715. }
  1716. ret := &Location{
  1717. ServerResponse: googleapi.ServerResponse{
  1718. Header: res.Header,
  1719. HTTPStatusCode: res.StatusCode,
  1720. },
  1721. }
  1722. target := &ret
  1723. if err := gensupport.DecodeResponse(target, res); err != nil {
  1724. return nil, err
  1725. }
  1726. return ret, nil
  1727. // {
  1728. // "description": "Gets information about a location.",
  1729. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}",
  1730. // "httpMethod": "GET",
  1731. // "id": "cloudkms.projects.locations.get",
  1732. // "parameterOrder": [
  1733. // "name"
  1734. // ],
  1735. // "parameters": {
  1736. // "name": {
  1737. // "description": "Resource name for the location.",
  1738. // "location": "path",
  1739. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1740. // "required": true,
  1741. // "type": "string"
  1742. // }
  1743. // },
  1744. // "path": "v1/{+name}",
  1745. // "response": {
  1746. // "$ref": "Location"
  1747. // },
  1748. // "scopes": [
  1749. // "https://www.googleapis.com/auth/cloud-platform",
  1750. // "https://www.googleapis.com/auth/cloudkms"
  1751. // ]
  1752. // }
  1753. }
  1754. // method id "cloudkms.projects.locations.list":
  1755. type ProjectsLocationsListCall struct {
  1756. s *Service
  1757. name string
  1758. urlParams_ gensupport.URLParams
  1759. ifNoneMatch_ string
  1760. ctx_ context.Context
  1761. header_ http.Header
  1762. }
  1763. // List: Lists information about the supported locations for this
  1764. // service.
  1765. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  1766. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1767. c.name = name
  1768. return c
  1769. }
  1770. // Filter sets the optional parameter "filter": The standard list
  1771. // filter.
  1772. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  1773. c.urlParams_.Set("filter", filter)
  1774. return c
  1775. }
  1776. // PageSize sets the optional parameter "pageSize": The standard list
  1777. // page size.
  1778. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  1779. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1780. return c
  1781. }
  1782. // PageToken sets the optional parameter "pageToken": The standard list
  1783. // page token.
  1784. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  1785. c.urlParams_.Set("pageToken", pageToken)
  1786. return c
  1787. }
  1788. // Fields allows partial responses to be retrieved. See
  1789. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1790. // for more information.
  1791. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  1792. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1793. return c
  1794. }
  1795. // IfNoneMatch sets the optional parameter which makes the operation
  1796. // fail if the object's ETag matches the given value. This is useful for
  1797. // getting updates only after the object has changed since the last
  1798. // request. Use googleapi.IsNotModified to check whether the response
  1799. // error from Do is the result of In-None-Match.
  1800. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  1801. c.ifNoneMatch_ = entityTag
  1802. return c
  1803. }
  1804. // Context sets the context to be used in this call's Do method. Any
  1805. // pending HTTP request will be aborted if the provided context is
  1806. // canceled.
  1807. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  1808. c.ctx_ = ctx
  1809. return c
  1810. }
  1811. // Header returns an http.Header that can be modified by the caller to
  1812. // add HTTP headers to the request.
  1813. func (c *ProjectsLocationsListCall) Header() http.Header {
  1814. if c.header_ == nil {
  1815. c.header_ = make(http.Header)
  1816. }
  1817. return c.header_
  1818. }
  1819. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  1820. reqHeaders := make(http.Header)
  1821. for k, v := range c.header_ {
  1822. reqHeaders[k] = v
  1823. }
  1824. reqHeaders.Set("User-Agent", c.s.userAgent())
  1825. if c.ifNoneMatch_ != "" {
  1826. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1827. }
  1828. var body io.Reader = nil
  1829. c.urlParams_.Set("alt", alt)
  1830. c.urlParams_.Set("prettyPrint", "false")
  1831. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations")
  1832. urls += "?" + c.urlParams_.Encode()
  1833. req, err := http.NewRequest("GET", urls, body)
  1834. if err != nil {
  1835. return nil, err
  1836. }
  1837. req.Header = reqHeaders
  1838. googleapi.Expand(req.URL, map[string]string{
  1839. "name": c.name,
  1840. })
  1841. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1842. }
  1843. // Do executes the "cloudkms.projects.locations.list" call.
  1844. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  1845. // non-2xx status code is an error. Response headers are in either
  1846. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  1847. // returned at all) in error.(*googleapi.Error).Header. Use
  1848. // googleapi.IsNotModified to check whether the returned error was
  1849. // because http.StatusNotModified was returned.
  1850. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  1851. gensupport.SetOptions(c.urlParams_, opts...)
  1852. res, err := c.doRequest("json")
  1853. if res != nil && res.StatusCode == http.StatusNotModified {
  1854. if res.Body != nil {
  1855. res.Body.Close()
  1856. }
  1857. return nil, &googleapi.Error{
  1858. Code: res.StatusCode,
  1859. Header: res.Header,
  1860. }
  1861. }
  1862. if err != nil {
  1863. return nil, err
  1864. }
  1865. defer googleapi.CloseBody(res)
  1866. if err := googleapi.CheckResponse(res); err != nil {
  1867. return nil, err
  1868. }
  1869. ret := &ListLocationsResponse{
  1870. ServerResponse: googleapi.ServerResponse{
  1871. Header: res.Header,
  1872. HTTPStatusCode: res.StatusCode,
  1873. },
  1874. }
  1875. target := &ret
  1876. if err := gensupport.DecodeResponse(target, res); err != nil {
  1877. return nil, err
  1878. }
  1879. return ret, nil
  1880. // {
  1881. // "description": "Lists information about the supported locations for this service.",
  1882. // "flatPath": "v1/projects/{projectsId}/locations",
  1883. // "httpMethod": "GET",
  1884. // "id": "cloudkms.projects.locations.list",
  1885. // "parameterOrder": [
  1886. // "name"
  1887. // ],
  1888. // "parameters": {
  1889. // "filter": {
  1890. // "description": "The standard list filter.",
  1891. // "location": "query",
  1892. // "type": "string"
  1893. // },
  1894. // "name": {
  1895. // "description": "The resource that owns the locations collection, if applicable.",
  1896. // "location": "path",
  1897. // "pattern": "^projects/[^/]+$",
  1898. // "required": true,
  1899. // "type": "string"
  1900. // },
  1901. // "pageSize": {
  1902. // "description": "The standard list page size.",
  1903. // "format": "int32",
  1904. // "location": "query",
  1905. // "type": "integer"
  1906. // },
  1907. // "pageToken": {
  1908. // "description": "The standard list page token.",
  1909. // "location": "query",
  1910. // "type": "string"
  1911. // }
  1912. // },
  1913. // "path": "v1/{+name}/locations",
  1914. // "response": {
  1915. // "$ref": "ListLocationsResponse"
  1916. // },
  1917. // "scopes": [
  1918. // "https://www.googleapis.com/auth/cloud-platform",
  1919. // "https://www.googleapis.com/auth/cloudkms"
  1920. // ]
  1921. // }
  1922. }
  1923. // Pages invokes f for each page of results.
  1924. // A non-nil error returned from f will halt the iteration.
  1925. // The provided context supersedes any context provided to the Context method.
  1926. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  1927. c.ctx_ = ctx
  1928. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1929. for {
  1930. x, err := c.Do()
  1931. if err != nil {
  1932. return err
  1933. }
  1934. if err := f(x); err != nil {
  1935. return err
  1936. }
  1937. if x.NextPageToken == "" {
  1938. return nil
  1939. }
  1940. c.PageToken(x.NextPageToken)
  1941. }
  1942. }
  1943. // method id "cloudkms.projects.locations.keyRings.create":
  1944. type ProjectsLocationsKeyRingsCreateCall struct {
  1945. s *Service
  1946. parent string
  1947. keyring *KeyRing
  1948. urlParams_ gensupport.URLParams
  1949. ctx_ context.Context
  1950. header_ http.Header
  1951. }
  1952. // Create: Create a new KeyRing in a given Project and Location.
  1953. func (r *ProjectsLocationsKeyRingsService) Create(parent string, keyring *KeyRing) *ProjectsLocationsKeyRingsCreateCall {
  1954. c := &ProjectsLocationsKeyRingsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1955. c.parent = parent
  1956. c.keyring = keyring
  1957. return c
  1958. }
  1959. // KeyRingId sets the optional parameter "keyRingId": Required. It must
  1960. // be unique within a location and match the regular
  1961. // expression `[a-zA-Z0-9_-]{1,63}`
  1962. func (c *ProjectsLocationsKeyRingsCreateCall) KeyRingId(keyRingId string) *ProjectsLocationsKeyRingsCreateCall {
  1963. c.urlParams_.Set("keyRingId", keyRingId)
  1964. return c
  1965. }
  1966. // Fields allows partial responses to be retrieved. See
  1967. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1968. // for more information.
  1969. func (c *ProjectsLocationsKeyRingsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCreateCall {
  1970. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1971. return c
  1972. }
  1973. // Context sets the context to be used in this call's Do method. Any
  1974. // pending HTTP request will be aborted if the provided context is
  1975. // canceled.
  1976. func (c *ProjectsLocationsKeyRingsCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCreateCall {
  1977. c.ctx_ = ctx
  1978. return c
  1979. }
  1980. // Header returns an http.Header that can be modified by the caller to
  1981. // add HTTP headers to the request.
  1982. func (c *ProjectsLocationsKeyRingsCreateCall) Header() http.Header {
  1983. if c.header_ == nil {
  1984. c.header_ = make(http.Header)
  1985. }
  1986. return c.header_
  1987. }
  1988. func (c *ProjectsLocationsKeyRingsCreateCall) doRequest(alt string) (*http.Response, error) {
  1989. reqHeaders := make(http.Header)
  1990. for k, v := range c.header_ {
  1991. reqHeaders[k] = v
  1992. }
  1993. reqHeaders.Set("User-Agent", c.s.userAgent())
  1994. var body io.Reader = nil
  1995. body, err := googleapi.WithoutDataWrapper.JSONReader(c.keyring)
  1996. if err != nil {
  1997. return nil, err
  1998. }
  1999. reqHeaders.Set("Content-Type", "application/json")
  2000. c.urlParams_.Set("alt", alt)
  2001. c.urlParams_.Set("prettyPrint", "false")
  2002. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/keyRings")
  2003. urls += "?" + c.urlParams_.Encode()
  2004. req, err := http.NewRequest("POST", urls, body)
  2005. if err != nil {
  2006. return nil, err
  2007. }
  2008. req.Header = reqHeaders
  2009. googleapi.Expand(req.URL, map[string]string{
  2010. "parent": c.parent,
  2011. })
  2012. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2013. }
  2014. // Do executes the "cloudkms.projects.locations.keyRings.create" call.
  2015. // Exactly one of *KeyRing or error will be non-nil. Any non-2xx status
  2016. // code is an error. Response headers are in either
  2017. // *KeyRing.ServerResponse.Header or (if a response was returned at all)
  2018. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2019. // check whether the returned error was because http.StatusNotModified
  2020. // was returned.
  2021. func (c *ProjectsLocationsKeyRingsCreateCall) Do(opts ...googleapi.CallOption) (*KeyRing, error) {
  2022. gensupport.SetOptions(c.urlParams_, opts...)
  2023. res, err := c.doRequest("json")
  2024. if res != nil && res.StatusCode == http.StatusNotModified {
  2025. if res.Body != nil {
  2026. res.Body.Close()
  2027. }
  2028. return nil, &googleapi.Error{
  2029. Code: res.StatusCode,
  2030. Header: res.Header,
  2031. }
  2032. }
  2033. if err != nil {
  2034. return nil, err
  2035. }
  2036. defer googleapi.CloseBody(res)
  2037. if err := googleapi.CheckResponse(res); err != nil {
  2038. return nil, err
  2039. }
  2040. ret := &KeyRing{
  2041. ServerResponse: googleapi.ServerResponse{
  2042. Header: res.Header,
  2043. HTTPStatusCode: res.StatusCode,
  2044. },
  2045. }
  2046. target := &ret
  2047. if err := gensupport.DecodeResponse(target, res); err != nil {
  2048. return nil, err
  2049. }
  2050. return ret, nil
  2051. // {
  2052. // "description": "Create a new KeyRing in a given Project and Location.",
  2053. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings",
  2054. // "httpMethod": "POST",
  2055. // "id": "cloudkms.projects.locations.keyRings.create",
  2056. // "parameterOrder": [
  2057. // "parent"
  2058. // ],
  2059. // "parameters": {
  2060. // "keyRingId": {
  2061. // "description": "Required. It must be unique within a location and match the regular\nexpression `[a-zA-Z0-9_-]{1,63}`",
  2062. // "location": "query",
  2063. // "type": "string"
  2064. // },
  2065. // "parent": {
  2066. // "description": "Required. The resource name of the location associated with the\nKeyRings, in the format `projects/*/locations/*`.",
  2067. // "location": "path",
  2068. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2069. // "required": true,
  2070. // "type": "string"
  2071. // }
  2072. // },
  2073. // "path": "v1/{+parent}/keyRings",
  2074. // "request": {
  2075. // "$ref": "KeyRing"
  2076. // },
  2077. // "response": {
  2078. // "$ref": "KeyRing"
  2079. // },
  2080. // "scopes": [
  2081. // "https://www.googleapis.com/auth/cloud-platform",
  2082. // "https://www.googleapis.com/auth/cloudkms"
  2083. // ]
  2084. // }
  2085. }
  2086. // method id "cloudkms.projects.locations.keyRings.get":
  2087. type ProjectsLocationsKeyRingsGetCall struct {
  2088. s *Service
  2089. name string
  2090. urlParams_ gensupport.URLParams
  2091. ifNoneMatch_ string
  2092. ctx_ context.Context
  2093. header_ http.Header
  2094. }
  2095. // Get: Returns metadata for a given KeyRing.
  2096. func (r *ProjectsLocationsKeyRingsService) Get(name string) *ProjectsLocationsKeyRingsGetCall {
  2097. c := &ProjectsLocationsKeyRingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2098. c.name = name
  2099. return c
  2100. }
  2101. // Fields allows partial responses to be retrieved. See
  2102. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2103. // for more information.
  2104. func (c *ProjectsLocationsKeyRingsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsGetCall {
  2105. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2106. return c
  2107. }
  2108. // IfNoneMatch sets the optional parameter which makes the operation
  2109. // fail if the object's ETag matches the given value. This is useful for
  2110. // getting updates only after the object has changed since the last
  2111. // request. Use googleapi.IsNotModified to check whether the response
  2112. // error from Do is the result of In-None-Match.
  2113. func (c *ProjectsLocationsKeyRingsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsGetCall {
  2114. c.ifNoneMatch_ = entityTag
  2115. return c
  2116. }
  2117. // Context sets the context to be used in this call's Do method. Any
  2118. // pending HTTP request will be aborted if the provided context is
  2119. // canceled.
  2120. func (c *ProjectsLocationsKeyRingsGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsGetCall {
  2121. c.ctx_ = ctx
  2122. return c
  2123. }
  2124. // Header returns an http.Header that can be modified by the caller to
  2125. // add HTTP headers to the request.
  2126. func (c *ProjectsLocationsKeyRingsGetCall) Header() http.Header {
  2127. if c.header_ == nil {
  2128. c.header_ = make(http.Header)
  2129. }
  2130. return c.header_
  2131. }
  2132. func (c *ProjectsLocationsKeyRingsGetCall) doRequest(alt string) (*http.Response, error) {
  2133. reqHeaders := make(http.Header)
  2134. for k, v := range c.header_ {
  2135. reqHeaders[k] = v
  2136. }
  2137. reqHeaders.Set("User-Agent", c.s.userAgent())
  2138. if c.ifNoneMatch_ != "" {
  2139. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2140. }
  2141. var body io.Reader = nil
  2142. c.urlParams_.Set("alt", alt)
  2143. c.urlParams_.Set("prettyPrint", "false")
  2144. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2145. urls += "?" + c.urlParams_.Encode()
  2146. req, err := http.NewRequest("GET", urls, body)
  2147. if err != nil {
  2148. return nil, err
  2149. }
  2150. req.Header = reqHeaders
  2151. googleapi.Expand(req.URL, map[string]string{
  2152. "name": c.name,
  2153. })
  2154. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2155. }
  2156. // Do executes the "cloudkms.projects.locations.keyRings.get" call.
  2157. // Exactly one of *KeyRing or error will be non-nil. Any non-2xx status
  2158. // code is an error. Response headers are in either
  2159. // *KeyRing.ServerResponse.Header or (if a response was returned at all)
  2160. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2161. // check whether the returned error was because http.StatusNotModified
  2162. // was returned.
  2163. func (c *ProjectsLocationsKeyRingsGetCall) Do(opts ...googleapi.CallOption) (*KeyRing, error) {
  2164. gensupport.SetOptions(c.urlParams_, opts...)
  2165. res, err := c.doRequest("json")
  2166. if res != nil && res.StatusCode == http.StatusNotModified {
  2167. if res.Body != nil {
  2168. res.Body.Close()
  2169. }
  2170. return nil, &googleapi.Error{
  2171. Code: res.StatusCode,
  2172. Header: res.Header,
  2173. }
  2174. }
  2175. if err != nil {
  2176. return nil, err
  2177. }
  2178. defer googleapi.CloseBody(res)
  2179. if err := googleapi.CheckResponse(res); err != nil {
  2180. return nil, err
  2181. }
  2182. ret := &KeyRing{
  2183. ServerResponse: googleapi.ServerResponse{
  2184. Header: res.Header,
  2185. HTTPStatusCode: res.StatusCode,
  2186. },
  2187. }
  2188. target := &ret
  2189. if err := gensupport.DecodeResponse(target, res); err != nil {
  2190. return nil, err
  2191. }
  2192. return ret, nil
  2193. // {
  2194. // "description": "Returns metadata for a given KeyRing.",
  2195. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}",
  2196. // "httpMethod": "GET",
  2197. // "id": "cloudkms.projects.locations.keyRings.get",
  2198. // "parameterOrder": [
  2199. // "name"
  2200. // ],
  2201. // "parameters": {
  2202. // "name": {
  2203. // "description": "The name of the KeyRing to get.",
  2204. // "location": "path",
  2205. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  2206. // "required": true,
  2207. // "type": "string"
  2208. // }
  2209. // },
  2210. // "path": "v1/{+name}",
  2211. // "response": {
  2212. // "$ref": "KeyRing"
  2213. // },
  2214. // "scopes": [
  2215. // "https://www.googleapis.com/auth/cloud-platform",
  2216. // "https://www.googleapis.com/auth/cloudkms"
  2217. // ]
  2218. // }
  2219. }
  2220. // method id "cloudkms.projects.locations.keyRings.getIamPolicy":
  2221. type ProjectsLocationsKeyRingsGetIamPolicyCall struct {
  2222. s *Service
  2223. resource string
  2224. urlParams_ gensupport.URLParams
  2225. ifNoneMatch_ string
  2226. ctx_ context.Context
  2227. header_ http.Header
  2228. }
  2229. // GetIamPolicy: Gets the access control policy for a resource.
  2230. // Returns an empty policy if the resource exists and does not have a
  2231. // policy
  2232. // set.
  2233. func (r *ProjectsLocationsKeyRingsService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsGetIamPolicyCall {
  2234. c := &ProjectsLocationsKeyRingsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2235. c.resource = resource
  2236. return c
  2237. }
  2238. // Fields allows partial responses to be retrieved. See
  2239. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2240. // for more information.
  2241. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsGetIamPolicyCall {
  2242. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2243. return c
  2244. }
  2245. // IfNoneMatch sets the optional parameter which makes the operation
  2246. // fail if the object's ETag matches the given value. This is useful for
  2247. // getting updates only after the object has changed since the last
  2248. // request. Use googleapi.IsNotModified to check whether the response
  2249. // error from Do is the result of In-None-Match.
  2250. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsGetIamPolicyCall {
  2251. c.ifNoneMatch_ = entityTag
  2252. return c
  2253. }
  2254. // Context sets the context to be used in this call's Do method. Any
  2255. // pending HTTP request will be aborted if the provided context is
  2256. // canceled.
  2257. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsGetIamPolicyCall {
  2258. c.ctx_ = ctx
  2259. return c
  2260. }
  2261. // Header returns an http.Header that can be modified by the caller to
  2262. // add HTTP headers to the request.
  2263. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Header() http.Header {
  2264. if c.header_ == nil {
  2265. c.header_ = make(http.Header)
  2266. }
  2267. return c.header_
  2268. }
  2269. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2270. reqHeaders := make(http.Header)
  2271. for k, v := range c.header_ {
  2272. reqHeaders[k] = v
  2273. }
  2274. reqHeaders.Set("User-Agent", c.s.userAgent())
  2275. if c.ifNoneMatch_ != "" {
  2276. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2277. }
  2278. var body io.Reader = nil
  2279. c.urlParams_.Set("alt", alt)
  2280. c.urlParams_.Set("prettyPrint", "false")
  2281. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  2282. urls += "?" + c.urlParams_.Encode()
  2283. req, err := http.NewRequest("GET", urls, body)
  2284. if err != nil {
  2285. return nil, err
  2286. }
  2287. req.Header = reqHeaders
  2288. googleapi.Expand(req.URL, map[string]string{
  2289. "resource": c.resource,
  2290. })
  2291. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2292. }
  2293. // Do executes the "cloudkms.projects.locations.keyRings.getIamPolicy" call.
  2294. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2295. // code is an error. Response headers are in either
  2296. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2297. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2298. // check whether the returned error was because http.StatusNotModified
  2299. // was returned.
  2300. func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2301. gensupport.SetOptions(c.urlParams_, opts...)
  2302. res, err := c.doRequest("json")
  2303. if res != nil && res.StatusCode == http.StatusNotModified {
  2304. if res.Body != nil {
  2305. res.Body.Close()
  2306. }
  2307. return nil, &googleapi.Error{
  2308. Code: res.StatusCode,
  2309. Header: res.Header,
  2310. }
  2311. }
  2312. if err != nil {
  2313. return nil, err
  2314. }
  2315. defer googleapi.CloseBody(res)
  2316. if err := googleapi.CheckResponse(res); err != nil {
  2317. return nil, err
  2318. }
  2319. ret := &Policy{
  2320. ServerResponse: googleapi.ServerResponse{
  2321. Header: res.Header,
  2322. HTTPStatusCode: res.StatusCode,
  2323. },
  2324. }
  2325. target := &ret
  2326. if err := gensupport.DecodeResponse(target, res); err != nil {
  2327. return nil, err
  2328. }
  2329. return ret, nil
  2330. // {
  2331. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  2332. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:getIamPolicy",
  2333. // "httpMethod": "GET",
  2334. // "id": "cloudkms.projects.locations.keyRings.getIamPolicy",
  2335. // "parameterOrder": [
  2336. // "resource"
  2337. // ],
  2338. // "parameters": {
  2339. // "resource": {
  2340. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2341. // "location": "path",
  2342. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  2343. // "required": true,
  2344. // "type": "string"
  2345. // }
  2346. // },
  2347. // "path": "v1/{+resource}:getIamPolicy",
  2348. // "response": {
  2349. // "$ref": "Policy"
  2350. // },
  2351. // "scopes": [
  2352. // "https://www.googleapis.com/auth/cloud-platform",
  2353. // "https://www.googleapis.com/auth/cloudkms"
  2354. // ]
  2355. // }
  2356. }
  2357. // method id "cloudkms.projects.locations.keyRings.list":
  2358. type ProjectsLocationsKeyRingsListCall struct {
  2359. s *Service
  2360. parent string
  2361. urlParams_ gensupport.URLParams
  2362. ifNoneMatch_ string
  2363. ctx_ context.Context
  2364. header_ http.Header
  2365. }
  2366. // List: Lists KeyRings.
  2367. func (r *ProjectsLocationsKeyRingsService) List(parent string) *ProjectsLocationsKeyRingsListCall {
  2368. c := &ProjectsLocationsKeyRingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2369. c.parent = parent
  2370. return c
  2371. }
  2372. // PageSize sets the optional parameter "pageSize": Optional limit on
  2373. // the number of KeyRings to include in the
  2374. // response. Further KeyRings can subsequently be obtained by
  2375. // including the ListKeyRingsResponse.next_page_token in a
  2376. // subsequent
  2377. // request. If unspecified, the server will pick an appropriate
  2378. // default.
  2379. func (c *ProjectsLocationsKeyRingsListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsListCall {
  2380. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2381. return c
  2382. }
  2383. // PageToken sets the optional parameter "pageToken": Optional
  2384. // pagination token, returned earlier
  2385. // via
  2386. // ListKeyRingsResponse.next_page_token.
  2387. func (c *ProjectsLocationsKeyRingsListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsListCall {
  2388. c.urlParams_.Set("pageToken", pageToken)
  2389. return c
  2390. }
  2391. // Fields allows partial responses to be retrieved. See
  2392. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2393. // for more information.
  2394. func (c *ProjectsLocationsKeyRingsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsListCall {
  2395. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2396. return c
  2397. }
  2398. // IfNoneMatch sets the optional parameter which makes the operation
  2399. // fail if the object's ETag matches the given value. This is useful for
  2400. // getting updates only after the object has changed since the last
  2401. // request. Use googleapi.IsNotModified to check whether the response
  2402. // error from Do is the result of In-None-Match.
  2403. func (c *ProjectsLocationsKeyRingsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsListCall {
  2404. c.ifNoneMatch_ = entityTag
  2405. return c
  2406. }
  2407. // Context sets the context to be used in this call's Do method. Any
  2408. // pending HTTP request will be aborted if the provided context is
  2409. // canceled.
  2410. func (c *ProjectsLocationsKeyRingsListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsListCall {
  2411. c.ctx_ = ctx
  2412. return c
  2413. }
  2414. // Header returns an http.Header that can be modified by the caller to
  2415. // add HTTP headers to the request.
  2416. func (c *ProjectsLocationsKeyRingsListCall) Header() http.Header {
  2417. if c.header_ == nil {
  2418. c.header_ = make(http.Header)
  2419. }
  2420. return c.header_
  2421. }
  2422. func (c *ProjectsLocationsKeyRingsListCall) doRequest(alt string) (*http.Response, error) {
  2423. reqHeaders := make(http.Header)
  2424. for k, v := range c.header_ {
  2425. reqHeaders[k] = v
  2426. }
  2427. reqHeaders.Set("User-Agent", c.s.userAgent())
  2428. if c.ifNoneMatch_ != "" {
  2429. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2430. }
  2431. var body io.Reader = nil
  2432. c.urlParams_.Set("alt", alt)
  2433. c.urlParams_.Set("prettyPrint", "false")
  2434. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/keyRings")
  2435. urls += "?" + c.urlParams_.Encode()
  2436. req, err := http.NewRequest("GET", urls, body)
  2437. if err != nil {
  2438. return nil, err
  2439. }
  2440. req.Header = reqHeaders
  2441. googleapi.Expand(req.URL, map[string]string{
  2442. "parent": c.parent,
  2443. })
  2444. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2445. }
  2446. // Do executes the "cloudkms.projects.locations.keyRings.list" call.
  2447. // Exactly one of *ListKeyRingsResponse or error will be non-nil. Any
  2448. // non-2xx status code is an error. Response headers are in either
  2449. // *ListKeyRingsResponse.ServerResponse.Header or (if a response was
  2450. // returned at all) in error.(*googleapi.Error).Header. Use
  2451. // googleapi.IsNotModified to check whether the returned error was
  2452. // because http.StatusNotModified was returned.
  2453. func (c *ProjectsLocationsKeyRingsListCall) Do(opts ...googleapi.CallOption) (*ListKeyRingsResponse, error) {
  2454. gensupport.SetOptions(c.urlParams_, opts...)
  2455. res, err := c.doRequest("json")
  2456. if res != nil && res.StatusCode == http.StatusNotModified {
  2457. if res.Body != nil {
  2458. res.Body.Close()
  2459. }
  2460. return nil, &googleapi.Error{
  2461. Code: res.StatusCode,
  2462. Header: res.Header,
  2463. }
  2464. }
  2465. if err != nil {
  2466. return nil, err
  2467. }
  2468. defer googleapi.CloseBody(res)
  2469. if err := googleapi.CheckResponse(res); err != nil {
  2470. return nil, err
  2471. }
  2472. ret := &ListKeyRingsResponse{
  2473. ServerResponse: googleapi.ServerResponse{
  2474. Header: res.Header,
  2475. HTTPStatusCode: res.StatusCode,
  2476. },
  2477. }
  2478. target := &ret
  2479. if err := gensupport.DecodeResponse(target, res); err != nil {
  2480. return nil, err
  2481. }
  2482. return ret, nil
  2483. // {
  2484. // "description": "Lists KeyRings.",
  2485. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings",
  2486. // "httpMethod": "GET",
  2487. // "id": "cloudkms.projects.locations.keyRings.list",
  2488. // "parameterOrder": [
  2489. // "parent"
  2490. // ],
  2491. // "parameters": {
  2492. // "pageSize": {
  2493. // "description": "Optional limit on the number of KeyRings to include in the\nresponse. Further KeyRings can subsequently be obtained by\nincluding the ListKeyRingsResponse.next_page_token in a subsequent\nrequest. If unspecified, the server will pick an appropriate default.",
  2494. // "format": "int32",
  2495. // "location": "query",
  2496. // "type": "integer"
  2497. // },
  2498. // "pageToken": {
  2499. // "description": "Optional pagination token, returned earlier via\nListKeyRingsResponse.next_page_token.",
  2500. // "location": "query",
  2501. // "type": "string"
  2502. // },
  2503. // "parent": {
  2504. // "description": "Required. The resource name of the location associated with the\nKeyRings, in the format `projects/*/locations/*`.",
  2505. // "location": "path",
  2506. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2507. // "required": true,
  2508. // "type": "string"
  2509. // }
  2510. // },
  2511. // "path": "v1/{+parent}/keyRings",
  2512. // "response": {
  2513. // "$ref": "ListKeyRingsResponse"
  2514. // },
  2515. // "scopes": [
  2516. // "https://www.googleapis.com/auth/cloud-platform",
  2517. // "https://www.googleapis.com/auth/cloudkms"
  2518. // ]
  2519. // }
  2520. }
  2521. // Pages invokes f for each page of results.
  2522. // A non-nil error returned from f will halt the iteration.
  2523. // The provided context supersedes any context provided to the Context method.
  2524. func (c *ProjectsLocationsKeyRingsListCall) Pages(ctx context.Context, f func(*ListKeyRingsResponse) error) error {
  2525. c.ctx_ = ctx
  2526. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2527. for {
  2528. x, err := c.Do()
  2529. if err != nil {
  2530. return err
  2531. }
  2532. if err := f(x); err != nil {
  2533. return err
  2534. }
  2535. if x.NextPageToken == "" {
  2536. return nil
  2537. }
  2538. c.PageToken(x.NextPageToken)
  2539. }
  2540. }
  2541. // method id "cloudkms.projects.locations.keyRings.setIamPolicy":
  2542. type ProjectsLocationsKeyRingsSetIamPolicyCall struct {
  2543. s *Service
  2544. resource string
  2545. setiampolicyrequest *SetIamPolicyRequest
  2546. urlParams_ gensupport.URLParams
  2547. ctx_ context.Context
  2548. header_ http.Header
  2549. }
  2550. // SetIamPolicy: Sets the access control policy on the specified
  2551. // resource. Replaces any
  2552. // existing policy.
  2553. func (r *ProjectsLocationsKeyRingsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsSetIamPolicyCall {
  2554. c := &ProjectsLocationsKeyRingsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2555. c.resource = resource
  2556. c.setiampolicyrequest = setiampolicyrequest
  2557. return c
  2558. }
  2559. // Fields allows partial responses to be retrieved. See
  2560. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2561. // for more information.
  2562. func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsSetIamPolicyCall {
  2563. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2564. return c
  2565. }
  2566. // Context sets the context to be used in this call's Do method. Any
  2567. // pending HTTP request will be aborted if the provided context is
  2568. // canceled.
  2569. func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsSetIamPolicyCall {
  2570. c.ctx_ = ctx
  2571. return c
  2572. }
  2573. // Header returns an http.Header that can be modified by the caller to
  2574. // add HTTP headers to the request.
  2575. func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Header() http.Header {
  2576. if c.header_ == nil {
  2577. c.header_ = make(http.Header)
  2578. }
  2579. return c.header_
  2580. }
  2581. func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2582. reqHeaders := make(http.Header)
  2583. for k, v := range c.header_ {
  2584. reqHeaders[k] = v
  2585. }
  2586. reqHeaders.Set("User-Agent", c.s.userAgent())
  2587. var body io.Reader = nil
  2588. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2589. if err != nil {
  2590. return nil, err
  2591. }
  2592. reqHeaders.Set("Content-Type", "application/json")
  2593. c.urlParams_.Set("alt", alt)
  2594. c.urlParams_.Set("prettyPrint", "false")
  2595. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2596. urls += "?" + c.urlParams_.Encode()
  2597. req, err := http.NewRequest("POST", urls, body)
  2598. if err != nil {
  2599. return nil, err
  2600. }
  2601. req.Header = reqHeaders
  2602. googleapi.Expand(req.URL, map[string]string{
  2603. "resource": c.resource,
  2604. })
  2605. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2606. }
  2607. // Do executes the "cloudkms.projects.locations.keyRings.setIamPolicy" call.
  2608. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2609. // code is an error. Response headers are in either
  2610. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2611. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2612. // check whether the returned error was because http.StatusNotModified
  2613. // was returned.
  2614. func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2615. gensupport.SetOptions(c.urlParams_, opts...)
  2616. res, err := c.doRequest("json")
  2617. if res != nil && res.StatusCode == http.StatusNotModified {
  2618. if res.Body != nil {
  2619. res.Body.Close()
  2620. }
  2621. return nil, &googleapi.Error{
  2622. Code: res.StatusCode,
  2623. Header: res.Header,
  2624. }
  2625. }
  2626. if err != nil {
  2627. return nil, err
  2628. }
  2629. defer googleapi.CloseBody(res)
  2630. if err := googleapi.CheckResponse(res); err != nil {
  2631. return nil, err
  2632. }
  2633. ret := &Policy{
  2634. ServerResponse: googleapi.ServerResponse{
  2635. Header: res.Header,
  2636. HTTPStatusCode: res.StatusCode,
  2637. },
  2638. }
  2639. target := &ret
  2640. if err := gensupport.DecodeResponse(target, res); err != nil {
  2641. return nil, err
  2642. }
  2643. return ret, nil
  2644. // {
  2645. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2646. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:setIamPolicy",
  2647. // "httpMethod": "POST",
  2648. // "id": "cloudkms.projects.locations.keyRings.setIamPolicy",
  2649. // "parameterOrder": [
  2650. // "resource"
  2651. // ],
  2652. // "parameters": {
  2653. // "resource": {
  2654. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2655. // "location": "path",
  2656. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  2657. // "required": true,
  2658. // "type": "string"
  2659. // }
  2660. // },
  2661. // "path": "v1/{+resource}:setIamPolicy",
  2662. // "request": {
  2663. // "$ref": "SetIamPolicyRequest"
  2664. // },
  2665. // "response": {
  2666. // "$ref": "Policy"
  2667. // },
  2668. // "scopes": [
  2669. // "https://www.googleapis.com/auth/cloud-platform",
  2670. // "https://www.googleapis.com/auth/cloudkms"
  2671. // ]
  2672. // }
  2673. }
  2674. // method id "cloudkms.projects.locations.keyRings.testIamPermissions":
  2675. type ProjectsLocationsKeyRingsTestIamPermissionsCall struct {
  2676. s *Service
  2677. resource string
  2678. testiampermissionsrequest *TestIamPermissionsRequest
  2679. urlParams_ gensupport.URLParams
  2680. ctx_ context.Context
  2681. header_ http.Header
  2682. }
  2683. // TestIamPermissions: Returns permissions that a caller has on the
  2684. // specified resource.
  2685. // If the resource does not exist, this will return an empty set
  2686. // of
  2687. // permissions, not a NOT_FOUND error.
  2688. //
  2689. // Note: This operation is designed to be used for building
  2690. // permission-aware
  2691. // UIs and command-line tools, not for authorization checking. This
  2692. // operation
  2693. // may "fail open" without warning.
  2694. func (r *ProjectsLocationsKeyRingsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsTestIamPermissionsCall {
  2695. c := &ProjectsLocationsKeyRingsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2696. c.resource = resource
  2697. c.testiampermissionsrequest = testiampermissionsrequest
  2698. return c
  2699. }
  2700. // Fields allows partial responses to be retrieved. See
  2701. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2702. // for more information.
  2703. func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsTestIamPermissionsCall {
  2704. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2705. return c
  2706. }
  2707. // Context sets the context to be used in this call's Do method. Any
  2708. // pending HTTP request will be aborted if the provided context is
  2709. // canceled.
  2710. func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsTestIamPermissionsCall {
  2711. c.ctx_ = ctx
  2712. return c
  2713. }
  2714. // Header returns an http.Header that can be modified by the caller to
  2715. // add HTTP headers to the request.
  2716. func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Header() http.Header {
  2717. if c.header_ == nil {
  2718. c.header_ = make(http.Header)
  2719. }
  2720. return c.header_
  2721. }
  2722. func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2723. reqHeaders := make(http.Header)
  2724. for k, v := range c.header_ {
  2725. reqHeaders[k] = v
  2726. }
  2727. reqHeaders.Set("User-Agent", c.s.userAgent())
  2728. var body io.Reader = nil
  2729. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2730. if err != nil {
  2731. return nil, err
  2732. }
  2733. reqHeaders.Set("Content-Type", "application/json")
  2734. c.urlParams_.Set("alt", alt)
  2735. c.urlParams_.Set("prettyPrint", "false")
  2736. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2737. urls += "?" + c.urlParams_.Encode()
  2738. req, err := http.NewRequest("POST", urls, body)
  2739. if err != nil {
  2740. return nil, err
  2741. }
  2742. req.Header = reqHeaders
  2743. googleapi.Expand(req.URL, map[string]string{
  2744. "resource": c.resource,
  2745. })
  2746. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2747. }
  2748. // Do executes the "cloudkms.projects.locations.keyRings.testIamPermissions" call.
  2749. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2750. // Any non-2xx status code is an error. Response headers are in either
  2751. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2752. // was returned at all) in error.(*googleapi.Error).Header. Use
  2753. // googleapi.IsNotModified to check whether the returned error was
  2754. // because http.StatusNotModified was returned.
  2755. func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2756. gensupport.SetOptions(c.urlParams_, opts...)
  2757. res, err := c.doRequest("json")
  2758. if res != nil && res.StatusCode == http.StatusNotModified {
  2759. if res.Body != nil {
  2760. res.Body.Close()
  2761. }
  2762. return nil, &googleapi.Error{
  2763. Code: res.StatusCode,
  2764. Header: res.Header,
  2765. }
  2766. }
  2767. if err != nil {
  2768. return nil, err
  2769. }
  2770. defer googleapi.CloseBody(res)
  2771. if err := googleapi.CheckResponse(res); err != nil {
  2772. return nil, err
  2773. }
  2774. ret := &TestIamPermissionsResponse{
  2775. ServerResponse: googleapi.ServerResponse{
  2776. Header: res.Header,
  2777. HTTPStatusCode: res.StatusCode,
  2778. },
  2779. }
  2780. target := &ret
  2781. if err := gensupport.DecodeResponse(target, res); err != nil {
  2782. return nil, err
  2783. }
  2784. return ret, nil
  2785. // {
  2786. // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
  2787. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:testIamPermissions",
  2788. // "httpMethod": "POST",
  2789. // "id": "cloudkms.projects.locations.keyRings.testIamPermissions",
  2790. // "parameterOrder": [
  2791. // "resource"
  2792. // ],
  2793. // "parameters": {
  2794. // "resource": {
  2795. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2796. // "location": "path",
  2797. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  2798. // "required": true,
  2799. // "type": "string"
  2800. // }
  2801. // },
  2802. // "path": "v1/{+resource}:testIamPermissions",
  2803. // "request": {
  2804. // "$ref": "TestIamPermissionsRequest"
  2805. // },
  2806. // "response": {
  2807. // "$ref": "TestIamPermissionsResponse"
  2808. // },
  2809. // "scopes": [
  2810. // "https://www.googleapis.com/auth/cloud-platform",
  2811. // "https://www.googleapis.com/auth/cloudkms"
  2812. // ]
  2813. // }
  2814. }
  2815. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.create":
  2816. type ProjectsLocationsKeyRingsCryptoKeysCreateCall struct {
  2817. s *Service
  2818. parent string
  2819. cryptokey *CryptoKey
  2820. urlParams_ gensupport.URLParams
  2821. ctx_ context.Context
  2822. header_ http.Header
  2823. }
  2824. // Create: Create a new CryptoKey within a KeyRing.
  2825. //
  2826. // CryptoKey.purpose and
  2827. // CryptoKey.version_template.algorithm
  2828. // are required.
  2829. func (r *ProjectsLocationsKeyRingsCryptoKeysService) Create(parent string, cryptokey *CryptoKey) *ProjectsLocationsKeyRingsCryptoKeysCreateCall {
  2830. c := &ProjectsLocationsKeyRingsCryptoKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2831. c.parent = parent
  2832. c.cryptokey = cryptokey
  2833. return c
  2834. }
  2835. // CryptoKeyId sets the optional parameter "cryptoKeyId": Required. It
  2836. // must be unique within a KeyRing and match the regular
  2837. // expression `[a-zA-Z0-9_-]{1,63}`
  2838. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) CryptoKeyId(cryptoKeyId string) *ProjectsLocationsKeyRingsCryptoKeysCreateCall {
  2839. c.urlParams_.Set("cryptoKeyId", cryptoKeyId)
  2840. return c
  2841. }
  2842. // Fields allows partial responses to be retrieved. See
  2843. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2844. // for more information.
  2845. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCreateCall {
  2846. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2847. return c
  2848. }
  2849. // Context sets the context to be used in this call's Do method. Any
  2850. // pending HTTP request will be aborted if the provided context is
  2851. // canceled.
  2852. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCreateCall {
  2853. c.ctx_ = ctx
  2854. return c
  2855. }
  2856. // Header returns an http.Header that can be modified by the caller to
  2857. // add HTTP headers to the request.
  2858. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Header() http.Header {
  2859. if c.header_ == nil {
  2860. c.header_ = make(http.Header)
  2861. }
  2862. return c.header_
  2863. }
  2864. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  2865. reqHeaders := make(http.Header)
  2866. for k, v := range c.header_ {
  2867. reqHeaders[k] = v
  2868. }
  2869. reqHeaders.Set("User-Agent", c.s.userAgent())
  2870. var body io.Reader = nil
  2871. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokey)
  2872. if err != nil {
  2873. return nil, err
  2874. }
  2875. reqHeaders.Set("Content-Type", "application/json")
  2876. c.urlParams_.Set("alt", alt)
  2877. c.urlParams_.Set("prettyPrint", "false")
  2878. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeys")
  2879. urls += "?" + c.urlParams_.Encode()
  2880. req, err := http.NewRequest("POST", urls, body)
  2881. if err != nil {
  2882. return nil, err
  2883. }
  2884. req.Header = reqHeaders
  2885. googleapi.Expand(req.URL, map[string]string{
  2886. "parent": c.parent,
  2887. })
  2888. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2889. }
  2890. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.create" call.
  2891. // Exactly one of *CryptoKey or error will be non-nil. Any non-2xx
  2892. // status code is an error. Response headers are in either
  2893. // *CryptoKey.ServerResponse.Header or (if a response was returned at
  2894. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2895. // to check whether the returned error was because
  2896. // http.StatusNotModified was returned.
  2897. func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) {
  2898. gensupport.SetOptions(c.urlParams_, opts...)
  2899. res, err := c.doRequest("json")
  2900. if res != nil && res.StatusCode == http.StatusNotModified {
  2901. if res.Body != nil {
  2902. res.Body.Close()
  2903. }
  2904. return nil, &googleapi.Error{
  2905. Code: res.StatusCode,
  2906. Header: res.Header,
  2907. }
  2908. }
  2909. if err != nil {
  2910. return nil, err
  2911. }
  2912. defer googleapi.CloseBody(res)
  2913. if err := googleapi.CheckResponse(res); err != nil {
  2914. return nil, err
  2915. }
  2916. ret := &CryptoKey{
  2917. ServerResponse: googleapi.ServerResponse{
  2918. Header: res.Header,
  2919. HTTPStatusCode: res.StatusCode,
  2920. },
  2921. }
  2922. target := &ret
  2923. if err := gensupport.DecodeResponse(target, res); err != nil {
  2924. return nil, err
  2925. }
  2926. return ret, nil
  2927. // {
  2928. // "description": "Create a new CryptoKey within a KeyRing.\n\nCryptoKey.purpose and\nCryptoKey.version_template.algorithm\nare required.",
  2929. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys",
  2930. // "httpMethod": "POST",
  2931. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.create",
  2932. // "parameterOrder": [
  2933. // "parent"
  2934. // ],
  2935. // "parameters": {
  2936. // "cryptoKeyId": {
  2937. // "description": "Required. It must be unique within a KeyRing and match the regular\nexpression `[a-zA-Z0-9_-]{1,63}`",
  2938. // "location": "query",
  2939. // "type": "string"
  2940. // },
  2941. // "parent": {
  2942. // "description": "Required. The name of the KeyRing associated with the\nCryptoKeys.",
  2943. // "location": "path",
  2944. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  2945. // "required": true,
  2946. // "type": "string"
  2947. // }
  2948. // },
  2949. // "path": "v1/{+parent}/cryptoKeys",
  2950. // "request": {
  2951. // "$ref": "CryptoKey"
  2952. // },
  2953. // "response": {
  2954. // "$ref": "CryptoKey"
  2955. // },
  2956. // "scopes": [
  2957. // "https://www.googleapis.com/auth/cloud-platform",
  2958. // "https://www.googleapis.com/auth/cloudkms"
  2959. // ]
  2960. // }
  2961. }
  2962. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt":
  2963. type ProjectsLocationsKeyRingsCryptoKeysDecryptCall struct {
  2964. s *Service
  2965. name string
  2966. decryptrequest *DecryptRequest
  2967. urlParams_ gensupport.URLParams
  2968. ctx_ context.Context
  2969. header_ http.Header
  2970. }
  2971. // Decrypt: Decrypts data that was protected by Encrypt. The
  2972. // CryptoKey.purpose
  2973. // must be ENCRYPT_DECRYPT.
  2974. func (r *ProjectsLocationsKeyRingsCryptoKeysService) Decrypt(name string, decryptrequest *DecryptRequest) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall {
  2975. c := &ProjectsLocationsKeyRingsCryptoKeysDecryptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2976. c.name = name
  2977. c.decryptrequest = decryptrequest
  2978. return c
  2979. }
  2980. // Fields allows partial responses to be retrieved. See
  2981. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2982. // for more information.
  2983. func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall {
  2984. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2985. return c
  2986. }
  2987. // Context sets the context to be used in this call's Do method. Any
  2988. // pending HTTP request will be aborted if the provided context is
  2989. // canceled.
  2990. func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall {
  2991. c.ctx_ = ctx
  2992. return c
  2993. }
  2994. // Header returns an http.Header that can be modified by the caller to
  2995. // add HTTP headers to the request.
  2996. func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Header() http.Header {
  2997. if c.header_ == nil {
  2998. c.header_ = make(http.Header)
  2999. }
  3000. return c.header_
  3001. }
  3002. func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) doRequest(alt string) (*http.Response, error) {
  3003. reqHeaders := make(http.Header)
  3004. for k, v := range c.header_ {
  3005. reqHeaders[k] = v
  3006. }
  3007. reqHeaders.Set("User-Agent", c.s.userAgent())
  3008. var body io.Reader = nil
  3009. body, err := googleapi.WithoutDataWrapper.JSONReader(c.decryptrequest)
  3010. if err != nil {
  3011. return nil, err
  3012. }
  3013. reqHeaders.Set("Content-Type", "application/json")
  3014. c.urlParams_.Set("alt", alt)
  3015. c.urlParams_.Set("prettyPrint", "false")
  3016. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:decrypt")
  3017. urls += "?" + c.urlParams_.Encode()
  3018. req, err := http.NewRequest("POST", urls, body)
  3019. if err != nil {
  3020. return nil, err
  3021. }
  3022. req.Header = reqHeaders
  3023. googleapi.Expand(req.URL, map[string]string{
  3024. "name": c.name,
  3025. })
  3026. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3027. }
  3028. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt" call.
  3029. // Exactly one of *DecryptResponse or error will be non-nil. Any non-2xx
  3030. // status code is an error. Response headers are in either
  3031. // *DecryptResponse.ServerResponse.Header or (if a response was returned
  3032. // at all) in error.(*googleapi.Error).Header. Use
  3033. // googleapi.IsNotModified to check whether the returned error was
  3034. // because http.StatusNotModified was returned.
  3035. func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Do(opts ...googleapi.CallOption) (*DecryptResponse, error) {
  3036. gensupport.SetOptions(c.urlParams_, opts...)
  3037. res, err := c.doRequest("json")
  3038. if res != nil && res.StatusCode == http.StatusNotModified {
  3039. if res.Body != nil {
  3040. res.Body.Close()
  3041. }
  3042. return nil, &googleapi.Error{
  3043. Code: res.StatusCode,
  3044. Header: res.Header,
  3045. }
  3046. }
  3047. if err != nil {
  3048. return nil, err
  3049. }
  3050. defer googleapi.CloseBody(res)
  3051. if err := googleapi.CheckResponse(res); err != nil {
  3052. return nil, err
  3053. }
  3054. ret := &DecryptResponse{
  3055. ServerResponse: googleapi.ServerResponse{
  3056. Header: res.Header,
  3057. HTTPStatusCode: res.StatusCode,
  3058. },
  3059. }
  3060. target := &ret
  3061. if err := gensupport.DecodeResponse(target, res); err != nil {
  3062. return nil, err
  3063. }
  3064. return ret, nil
  3065. // {
  3066. // "description": "Decrypts data that was protected by Encrypt. The CryptoKey.purpose\nmust be ENCRYPT_DECRYPT.",
  3067. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:decrypt",
  3068. // "httpMethod": "POST",
  3069. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt",
  3070. // "parameterOrder": [
  3071. // "name"
  3072. // ],
  3073. // "parameters": {
  3074. // "name": {
  3075. // "description": "Required. The resource name of the CryptoKey to use for decryption.\nThe server will choose the appropriate version.",
  3076. // "location": "path",
  3077. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  3078. // "required": true,
  3079. // "type": "string"
  3080. // }
  3081. // },
  3082. // "path": "v1/{+name}:decrypt",
  3083. // "request": {
  3084. // "$ref": "DecryptRequest"
  3085. // },
  3086. // "response": {
  3087. // "$ref": "DecryptResponse"
  3088. // },
  3089. // "scopes": [
  3090. // "https://www.googleapis.com/auth/cloud-platform",
  3091. // "https://www.googleapis.com/auth/cloudkms"
  3092. // ]
  3093. // }
  3094. }
  3095. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt":
  3096. type ProjectsLocationsKeyRingsCryptoKeysEncryptCall struct {
  3097. s *Service
  3098. name string
  3099. encryptrequest *EncryptRequest
  3100. urlParams_ gensupport.URLParams
  3101. ctx_ context.Context
  3102. header_ http.Header
  3103. }
  3104. // Encrypt: Encrypts data, so that it can only be recovered by a call to
  3105. // Decrypt.
  3106. // The CryptoKey.purpose must be
  3107. // ENCRYPT_DECRYPT.
  3108. func (r *ProjectsLocationsKeyRingsCryptoKeysService) Encrypt(name string, encryptrequest *EncryptRequest) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall {
  3109. c := &ProjectsLocationsKeyRingsCryptoKeysEncryptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3110. c.name = name
  3111. c.encryptrequest = encryptrequest
  3112. return c
  3113. }
  3114. // Fields allows partial responses to be retrieved. See
  3115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3116. // for more information.
  3117. func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall {
  3118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3119. return c
  3120. }
  3121. // Context sets the context to be used in this call's Do method. Any
  3122. // pending HTTP request will be aborted if the provided context is
  3123. // canceled.
  3124. func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall {
  3125. c.ctx_ = ctx
  3126. return c
  3127. }
  3128. // Header returns an http.Header that can be modified by the caller to
  3129. // add HTTP headers to the request.
  3130. func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Header() http.Header {
  3131. if c.header_ == nil {
  3132. c.header_ = make(http.Header)
  3133. }
  3134. return c.header_
  3135. }
  3136. func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) doRequest(alt string) (*http.Response, error) {
  3137. reqHeaders := make(http.Header)
  3138. for k, v := range c.header_ {
  3139. reqHeaders[k] = v
  3140. }
  3141. reqHeaders.Set("User-Agent", c.s.userAgent())
  3142. var body io.Reader = nil
  3143. body, err := googleapi.WithoutDataWrapper.JSONReader(c.encryptrequest)
  3144. if err != nil {
  3145. return nil, err
  3146. }
  3147. reqHeaders.Set("Content-Type", "application/json")
  3148. c.urlParams_.Set("alt", alt)
  3149. c.urlParams_.Set("prettyPrint", "false")
  3150. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:encrypt")
  3151. urls += "?" + c.urlParams_.Encode()
  3152. req, err := http.NewRequest("POST", urls, body)
  3153. if err != nil {
  3154. return nil, err
  3155. }
  3156. req.Header = reqHeaders
  3157. googleapi.Expand(req.URL, map[string]string{
  3158. "name": c.name,
  3159. })
  3160. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3161. }
  3162. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt" call.
  3163. // Exactly one of *EncryptResponse or error will be non-nil. Any non-2xx
  3164. // status code is an error. Response headers are in either
  3165. // *EncryptResponse.ServerResponse.Header or (if a response was returned
  3166. // at all) in error.(*googleapi.Error).Header. Use
  3167. // googleapi.IsNotModified to check whether the returned error was
  3168. // because http.StatusNotModified was returned.
  3169. func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Do(opts ...googleapi.CallOption) (*EncryptResponse, error) {
  3170. gensupport.SetOptions(c.urlParams_, opts...)
  3171. res, err := c.doRequest("json")
  3172. if res != nil && res.StatusCode == http.StatusNotModified {
  3173. if res.Body != nil {
  3174. res.Body.Close()
  3175. }
  3176. return nil, &googleapi.Error{
  3177. Code: res.StatusCode,
  3178. Header: res.Header,
  3179. }
  3180. }
  3181. if err != nil {
  3182. return nil, err
  3183. }
  3184. defer googleapi.CloseBody(res)
  3185. if err := googleapi.CheckResponse(res); err != nil {
  3186. return nil, err
  3187. }
  3188. ret := &EncryptResponse{
  3189. ServerResponse: googleapi.ServerResponse{
  3190. Header: res.Header,
  3191. HTTPStatusCode: res.StatusCode,
  3192. },
  3193. }
  3194. target := &ret
  3195. if err := gensupport.DecodeResponse(target, res); err != nil {
  3196. return nil, err
  3197. }
  3198. return ret, nil
  3199. // {
  3200. // "description": "Encrypts data, so that it can only be recovered by a call to Decrypt.\nThe CryptoKey.purpose must be\nENCRYPT_DECRYPT.",
  3201. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:encrypt",
  3202. // "httpMethod": "POST",
  3203. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt",
  3204. // "parameterOrder": [
  3205. // "name"
  3206. // ],
  3207. // "parameters": {
  3208. // "name": {
  3209. // "description": "Required. The resource name of the CryptoKey or CryptoKeyVersion\nto use for encryption.\n\nIf a CryptoKey is specified, the server will use its\nprimary version.",
  3210. // "location": "path",
  3211. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/.+$",
  3212. // "required": true,
  3213. // "type": "string"
  3214. // }
  3215. // },
  3216. // "path": "v1/{+name}:encrypt",
  3217. // "request": {
  3218. // "$ref": "EncryptRequest"
  3219. // },
  3220. // "response": {
  3221. // "$ref": "EncryptResponse"
  3222. // },
  3223. // "scopes": [
  3224. // "https://www.googleapis.com/auth/cloud-platform",
  3225. // "https://www.googleapis.com/auth/cloudkms"
  3226. // ]
  3227. // }
  3228. }
  3229. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.get":
  3230. type ProjectsLocationsKeyRingsCryptoKeysGetCall struct {
  3231. s *Service
  3232. name string
  3233. urlParams_ gensupport.URLParams
  3234. ifNoneMatch_ string
  3235. ctx_ context.Context
  3236. header_ http.Header
  3237. }
  3238. // Get: Returns metadata for a given CryptoKey, as well as its
  3239. // primary CryptoKeyVersion.
  3240. func (r *ProjectsLocationsKeyRingsCryptoKeysService) Get(name string) *ProjectsLocationsKeyRingsCryptoKeysGetCall {
  3241. c := &ProjectsLocationsKeyRingsCryptoKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3242. c.name = name
  3243. return c
  3244. }
  3245. // Fields allows partial responses to be retrieved. See
  3246. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3247. // for more information.
  3248. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysGetCall {
  3249. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3250. return c
  3251. }
  3252. // IfNoneMatch sets the optional parameter which makes the operation
  3253. // fail if the object's ETag matches the given value. This is useful for
  3254. // getting updates only after the object has changed since the last
  3255. // request. Use googleapi.IsNotModified to check whether the response
  3256. // error from Do is the result of In-None-Match.
  3257. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysGetCall {
  3258. c.ifNoneMatch_ = entityTag
  3259. return c
  3260. }
  3261. // Context sets the context to be used in this call's Do method. Any
  3262. // pending HTTP request will be aborted if the provided context is
  3263. // canceled.
  3264. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysGetCall {
  3265. c.ctx_ = ctx
  3266. return c
  3267. }
  3268. // Header returns an http.Header that can be modified by the caller to
  3269. // add HTTP headers to the request.
  3270. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Header() http.Header {
  3271. if c.header_ == nil {
  3272. c.header_ = make(http.Header)
  3273. }
  3274. return c.header_
  3275. }
  3276. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) doRequest(alt string) (*http.Response, error) {
  3277. reqHeaders := make(http.Header)
  3278. for k, v := range c.header_ {
  3279. reqHeaders[k] = v
  3280. }
  3281. reqHeaders.Set("User-Agent", c.s.userAgent())
  3282. if c.ifNoneMatch_ != "" {
  3283. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3284. }
  3285. var body io.Reader = nil
  3286. c.urlParams_.Set("alt", alt)
  3287. c.urlParams_.Set("prettyPrint", "false")
  3288. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3289. urls += "?" + c.urlParams_.Encode()
  3290. req, err := http.NewRequest("GET", urls, body)
  3291. if err != nil {
  3292. return nil, err
  3293. }
  3294. req.Header = reqHeaders
  3295. googleapi.Expand(req.URL, map[string]string{
  3296. "name": c.name,
  3297. })
  3298. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3299. }
  3300. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.get" call.
  3301. // Exactly one of *CryptoKey or error will be non-nil. Any non-2xx
  3302. // status code is an error. Response headers are in either
  3303. // *CryptoKey.ServerResponse.Header or (if a response was returned at
  3304. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3305. // to check whether the returned error was because
  3306. // http.StatusNotModified was returned.
  3307. func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) {
  3308. gensupport.SetOptions(c.urlParams_, opts...)
  3309. res, err := c.doRequest("json")
  3310. if res != nil && res.StatusCode == http.StatusNotModified {
  3311. if res.Body != nil {
  3312. res.Body.Close()
  3313. }
  3314. return nil, &googleapi.Error{
  3315. Code: res.StatusCode,
  3316. Header: res.Header,
  3317. }
  3318. }
  3319. if err != nil {
  3320. return nil, err
  3321. }
  3322. defer googleapi.CloseBody(res)
  3323. if err := googleapi.CheckResponse(res); err != nil {
  3324. return nil, err
  3325. }
  3326. ret := &CryptoKey{
  3327. ServerResponse: googleapi.ServerResponse{
  3328. Header: res.Header,
  3329. HTTPStatusCode: res.StatusCode,
  3330. },
  3331. }
  3332. target := &ret
  3333. if err := gensupport.DecodeResponse(target, res); err != nil {
  3334. return nil, err
  3335. }
  3336. return ret, nil
  3337. // {
  3338. // "description": "Returns metadata for a given CryptoKey, as well as its\nprimary CryptoKeyVersion.",
  3339. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}",
  3340. // "httpMethod": "GET",
  3341. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.get",
  3342. // "parameterOrder": [
  3343. // "name"
  3344. // ],
  3345. // "parameters": {
  3346. // "name": {
  3347. // "description": "The name of the CryptoKey to get.",
  3348. // "location": "path",
  3349. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  3350. // "required": true,
  3351. // "type": "string"
  3352. // }
  3353. // },
  3354. // "path": "v1/{+name}",
  3355. // "response": {
  3356. // "$ref": "CryptoKey"
  3357. // },
  3358. // "scopes": [
  3359. // "https://www.googleapis.com/auth/cloud-platform",
  3360. // "https://www.googleapis.com/auth/cloudkms"
  3361. // ]
  3362. // }
  3363. }
  3364. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy":
  3365. type ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall struct {
  3366. s *Service
  3367. resource string
  3368. urlParams_ gensupport.URLParams
  3369. ifNoneMatch_ string
  3370. ctx_ context.Context
  3371. header_ http.Header
  3372. }
  3373. // GetIamPolicy: Gets the access control policy for a resource.
  3374. // Returns an empty policy if the resource exists and does not have a
  3375. // policy
  3376. // set.
  3377. func (r *ProjectsLocationsKeyRingsCryptoKeysService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall {
  3378. c := &ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3379. c.resource = resource
  3380. return c
  3381. }
  3382. // Fields allows partial responses to be retrieved. See
  3383. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3384. // for more information.
  3385. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall {
  3386. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3387. return c
  3388. }
  3389. // IfNoneMatch sets the optional parameter which makes the operation
  3390. // fail if the object's ETag matches the given value. This is useful for
  3391. // getting updates only after the object has changed since the last
  3392. // request. Use googleapi.IsNotModified to check whether the response
  3393. // error from Do is the result of In-None-Match.
  3394. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall {
  3395. c.ifNoneMatch_ = entityTag
  3396. return c
  3397. }
  3398. // Context sets the context to be used in this call's Do method. Any
  3399. // pending HTTP request will be aborted if the provided context is
  3400. // canceled.
  3401. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall {
  3402. c.ctx_ = ctx
  3403. return c
  3404. }
  3405. // Header returns an http.Header that can be modified by the caller to
  3406. // add HTTP headers to the request.
  3407. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Header() http.Header {
  3408. if c.header_ == nil {
  3409. c.header_ = make(http.Header)
  3410. }
  3411. return c.header_
  3412. }
  3413. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3414. reqHeaders := make(http.Header)
  3415. for k, v := range c.header_ {
  3416. reqHeaders[k] = v
  3417. }
  3418. reqHeaders.Set("User-Agent", c.s.userAgent())
  3419. if c.ifNoneMatch_ != "" {
  3420. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3421. }
  3422. var body io.Reader = nil
  3423. c.urlParams_.Set("alt", alt)
  3424. c.urlParams_.Set("prettyPrint", "false")
  3425. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  3426. urls += "?" + c.urlParams_.Encode()
  3427. req, err := http.NewRequest("GET", urls, body)
  3428. if err != nil {
  3429. return nil, err
  3430. }
  3431. req.Header = reqHeaders
  3432. googleapi.Expand(req.URL, map[string]string{
  3433. "resource": c.resource,
  3434. })
  3435. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3436. }
  3437. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy" call.
  3438. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3439. // code is an error. Response headers are in either
  3440. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3441. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3442. // check whether the returned error was because http.StatusNotModified
  3443. // was returned.
  3444. func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3445. gensupport.SetOptions(c.urlParams_, opts...)
  3446. res, err := c.doRequest("json")
  3447. if res != nil && res.StatusCode == http.StatusNotModified {
  3448. if res.Body != nil {
  3449. res.Body.Close()
  3450. }
  3451. return nil, &googleapi.Error{
  3452. Code: res.StatusCode,
  3453. Header: res.Header,
  3454. }
  3455. }
  3456. if err != nil {
  3457. return nil, err
  3458. }
  3459. defer googleapi.CloseBody(res)
  3460. if err := googleapi.CheckResponse(res); err != nil {
  3461. return nil, err
  3462. }
  3463. ret := &Policy{
  3464. ServerResponse: googleapi.ServerResponse{
  3465. Header: res.Header,
  3466. HTTPStatusCode: res.StatusCode,
  3467. },
  3468. }
  3469. target := &ret
  3470. if err := gensupport.DecodeResponse(target, res); err != nil {
  3471. return nil, err
  3472. }
  3473. return ret, nil
  3474. // {
  3475. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  3476. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:getIamPolicy",
  3477. // "httpMethod": "GET",
  3478. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy",
  3479. // "parameterOrder": [
  3480. // "resource"
  3481. // ],
  3482. // "parameters": {
  3483. // "resource": {
  3484. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3485. // "location": "path",
  3486. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  3487. // "required": true,
  3488. // "type": "string"
  3489. // }
  3490. // },
  3491. // "path": "v1/{+resource}:getIamPolicy",
  3492. // "response": {
  3493. // "$ref": "Policy"
  3494. // },
  3495. // "scopes": [
  3496. // "https://www.googleapis.com/auth/cloud-platform",
  3497. // "https://www.googleapis.com/auth/cloudkms"
  3498. // ]
  3499. // }
  3500. }
  3501. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.list":
  3502. type ProjectsLocationsKeyRingsCryptoKeysListCall struct {
  3503. s *Service
  3504. parent string
  3505. urlParams_ gensupport.URLParams
  3506. ifNoneMatch_ string
  3507. ctx_ context.Context
  3508. header_ http.Header
  3509. }
  3510. // List: Lists CryptoKeys.
  3511. func (r *ProjectsLocationsKeyRingsCryptoKeysService) List(parent string) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3512. c := &ProjectsLocationsKeyRingsCryptoKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3513. c.parent = parent
  3514. return c
  3515. }
  3516. // PageSize sets the optional parameter "pageSize": Optional limit on
  3517. // the number of CryptoKeys to include in the
  3518. // response. Further CryptoKeys can subsequently be obtained
  3519. // by
  3520. // including the ListCryptoKeysResponse.next_page_token in a
  3521. // subsequent
  3522. // request. If unspecified, the server will pick an appropriate
  3523. // default.
  3524. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3525. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3526. return c
  3527. }
  3528. // PageToken sets the optional parameter "pageToken": Optional
  3529. // pagination token, returned earlier
  3530. // via
  3531. // ListCryptoKeysResponse.next_page_token.
  3532. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3533. c.urlParams_.Set("pageToken", pageToken)
  3534. return c
  3535. }
  3536. // VersionView sets the optional parameter "versionView": The fields of
  3537. // the primary version to include in the response.
  3538. //
  3539. // Possible values:
  3540. // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED"
  3541. // "FULL"
  3542. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) VersionView(versionView string) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3543. c.urlParams_.Set("versionView", versionView)
  3544. return c
  3545. }
  3546. // Fields allows partial responses to be retrieved. See
  3547. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3548. // for more information.
  3549. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3550. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3551. return c
  3552. }
  3553. // IfNoneMatch sets the optional parameter which makes the operation
  3554. // fail if the object's ETag matches the given value. This is useful for
  3555. // getting updates only after the object has changed since the last
  3556. // request. Use googleapi.IsNotModified to check whether the response
  3557. // error from Do is the result of In-None-Match.
  3558. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3559. c.ifNoneMatch_ = entityTag
  3560. return c
  3561. }
  3562. // Context sets the context to be used in this call's Do method. Any
  3563. // pending HTTP request will be aborted if the provided context is
  3564. // canceled.
  3565. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysListCall {
  3566. c.ctx_ = ctx
  3567. return c
  3568. }
  3569. // Header returns an http.Header that can be modified by the caller to
  3570. // add HTTP headers to the request.
  3571. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Header() http.Header {
  3572. if c.header_ == nil {
  3573. c.header_ = make(http.Header)
  3574. }
  3575. return c.header_
  3576. }
  3577. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) doRequest(alt string) (*http.Response, error) {
  3578. reqHeaders := make(http.Header)
  3579. for k, v := range c.header_ {
  3580. reqHeaders[k] = v
  3581. }
  3582. reqHeaders.Set("User-Agent", c.s.userAgent())
  3583. if c.ifNoneMatch_ != "" {
  3584. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3585. }
  3586. var body io.Reader = nil
  3587. c.urlParams_.Set("alt", alt)
  3588. c.urlParams_.Set("prettyPrint", "false")
  3589. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeys")
  3590. urls += "?" + c.urlParams_.Encode()
  3591. req, err := http.NewRequest("GET", urls, body)
  3592. if err != nil {
  3593. return nil, err
  3594. }
  3595. req.Header = reqHeaders
  3596. googleapi.Expand(req.URL, map[string]string{
  3597. "parent": c.parent,
  3598. })
  3599. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3600. }
  3601. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.list" call.
  3602. // Exactly one of *ListCryptoKeysResponse or error will be non-nil. Any
  3603. // non-2xx status code is an error. Response headers are in either
  3604. // *ListCryptoKeysResponse.ServerResponse.Header or (if a response was
  3605. // returned at all) in error.(*googleapi.Error).Header. Use
  3606. // googleapi.IsNotModified to check whether the returned error was
  3607. // because http.StatusNotModified was returned.
  3608. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Do(opts ...googleapi.CallOption) (*ListCryptoKeysResponse, error) {
  3609. gensupport.SetOptions(c.urlParams_, opts...)
  3610. res, err := c.doRequest("json")
  3611. if res != nil && res.StatusCode == http.StatusNotModified {
  3612. if res.Body != nil {
  3613. res.Body.Close()
  3614. }
  3615. return nil, &googleapi.Error{
  3616. Code: res.StatusCode,
  3617. Header: res.Header,
  3618. }
  3619. }
  3620. if err != nil {
  3621. return nil, err
  3622. }
  3623. defer googleapi.CloseBody(res)
  3624. if err := googleapi.CheckResponse(res); err != nil {
  3625. return nil, err
  3626. }
  3627. ret := &ListCryptoKeysResponse{
  3628. ServerResponse: googleapi.ServerResponse{
  3629. Header: res.Header,
  3630. HTTPStatusCode: res.StatusCode,
  3631. },
  3632. }
  3633. target := &ret
  3634. if err := gensupport.DecodeResponse(target, res); err != nil {
  3635. return nil, err
  3636. }
  3637. return ret, nil
  3638. // {
  3639. // "description": "Lists CryptoKeys.",
  3640. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys",
  3641. // "httpMethod": "GET",
  3642. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.list",
  3643. // "parameterOrder": [
  3644. // "parent"
  3645. // ],
  3646. // "parameters": {
  3647. // "pageSize": {
  3648. // "description": "Optional limit on the number of CryptoKeys to include in the\nresponse. Further CryptoKeys can subsequently be obtained by\nincluding the ListCryptoKeysResponse.next_page_token in a subsequent\nrequest. If unspecified, the server will pick an appropriate default.",
  3649. // "format": "int32",
  3650. // "location": "query",
  3651. // "type": "integer"
  3652. // },
  3653. // "pageToken": {
  3654. // "description": "Optional pagination token, returned earlier via\nListCryptoKeysResponse.next_page_token.",
  3655. // "location": "query",
  3656. // "type": "string"
  3657. // },
  3658. // "parent": {
  3659. // "description": "Required. The resource name of the KeyRing to list, in the format\n`projects/*/locations/*/keyRings/*`.",
  3660. // "location": "path",
  3661. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$",
  3662. // "required": true,
  3663. // "type": "string"
  3664. // },
  3665. // "versionView": {
  3666. // "description": "The fields of the primary version to include in the response.",
  3667. // "enum": [
  3668. // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED",
  3669. // "FULL"
  3670. // ],
  3671. // "location": "query",
  3672. // "type": "string"
  3673. // }
  3674. // },
  3675. // "path": "v1/{+parent}/cryptoKeys",
  3676. // "response": {
  3677. // "$ref": "ListCryptoKeysResponse"
  3678. // },
  3679. // "scopes": [
  3680. // "https://www.googleapis.com/auth/cloud-platform",
  3681. // "https://www.googleapis.com/auth/cloudkms"
  3682. // ]
  3683. // }
  3684. }
  3685. // Pages invokes f for each page of results.
  3686. // A non-nil error returned from f will halt the iteration.
  3687. // The provided context supersedes any context provided to the Context method.
  3688. func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Pages(ctx context.Context, f func(*ListCryptoKeysResponse) error) error {
  3689. c.ctx_ = ctx
  3690. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3691. for {
  3692. x, err := c.Do()
  3693. if err != nil {
  3694. return err
  3695. }
  3696. if err := f(x); err != nil {
  3697. return err
  3698. }
  3699. if x.NextPageToken == "" {
  3700. return nil
  3701. }
  3702. c.PageToken(x.NextPageToken)
  3703. }
  3704. }
  3705. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.patch":
  3706. type ProjectsLocationsKeyRingsCryptoKeysPatchCall struct {
  3707. s *Service
  3708. name string
  3709. cryptokey *CryptoKey
  3710. urlParams_ gensupport.URLParams
  3711. ctx_ context.Context
  3712. header_ http.Header
  3713. }
  3714. // Patch: Update a CryptoKey.
  3715. func (r *ProjectsLocationsKeyRingsCryptoKeysService) Patch(name string, cryptokey *CryptoKey) *ProjectsLocationsKeyRingsCryptoKeysPatchCall {
  3716. c := &ProjectsLocationsKeyRingsCryptoKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3717. c.name = name
  3718. c.cryptokey = cryptokey
  3719. return c
  3720. }
  3721. // UpdateMask sets the optional parameter "updateMask": Required list of
  3722. // fields to be updated in this request.
  3723. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeyRingsCryptoKeysPatchCall {
  3724. c.urlParams_.Set("updateMask", updateMask)
  3725. return c
  3726. }
  3727. // Fields allows partial responses to be retrieved. See
  3728. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3729. // for more information.
  3730. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysPatchCall {
  3731. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3732. return c
  3733. }
  3734. // Context sets the context to be used in this call's Do method. Any
  3735. // pending HTTP request will be aborted if the provided context is
  3736. // canceled.
  3737. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysPatchCall {
  3738. c.ctx_ = ctx
  3739. return c
  3740. }
  3741. // Header returns an http.Header that can be modified by the caller to
  3742. // add HTTP headers to the request.
  3743. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Header() http.Header {
  3744. if c.header_ == nil {
  3745. c.header_ = make(http.Header)
  3746. }
  3747. return c.header_
  3748. }
  3749. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) doRequest(alt string) (*http.Response, error) {
  3750. reqHeaders := make(http.Header)
  3751. for k, v := range c.header_ {
  3752. reqHeaders[k] = v
  3753. }
  3754. reqHeaders.Set("User-Agent", c.s.userAgent())
  3755. var body io.Reader = nil
  3756. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokey)
  3757. if err != nil {
  3758. return nil, err
  3759. }
  3760. reqHeaders.Set("Content-Type", "application/json")
  3761. c.urlParams_.Set("alt", alt)
  3762. c.urlParams_.Set("prettyPrint", "false")
  3763. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3764. urls += "?" + c.urlParams_.Encode()
  3765. req, err := http.NewRequest("PATCH", urls, body)
  3766. if err != nil {
  3767. return nil, err
  3768. }
  3769. req.Header = reqHeaders
  3770. googleapi.Expand(req.URL, map[string]string{
  3771. "name": c.name,
  3772. })
  3773. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3774. }
  3775. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.patch" call.
  3776. // Exactly one of *CryptoKey or error will be non-nil. Any non-2xx
  3777. // status code is an error. Response headers are in either
  3778. // *CryptoKey.ServerResponse.Header or (if a response was returned at
  3779. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3780. // to check whether the returned error was because
  3781. // http.StatusNotModified was returned.
  3782. func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) {
  3783. gensupport.SetOptions(c.urlParams_, opts...)
  3784. res, err := c.doRequest("json")
  3785. if res != nil && res.StatusCode == http.StatusNotModified {
  3786. if res.Body != nil {
  3787. res.Body.Close()
  3788. }
  3789. return nil, &googleapi.Error{
  3790. Code: res.StatusCode,
  3791. Header: res.Header,
  3792. }
  3793. }
  3794. if err != nil {
  3795. return nil, err
  3796. }
  3797. defer googleapi.CloseBody(res)
  3798. if err := googleapi.CheckResponse(res); err != nil {
  3799. return nil, err
  3800. }
  3801. ret := &CryptoKey{
  3802. ServerResponse: googleapi.ServerResponse{
  3803. Header: res.Header,
  3804. HTTPStatusCode: res.StatusCode,
  3805. },
  3806. }
  3807. target := &ret
  3808. if err := gensupport.DecodeResponse(target, res); err != nil {
  3809. return nil, err
  3810. }
  3811. return ret, nil
  3812. // {
  3813. // "description": "Update a CryptoKey.",
  3814. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}",
  3815. // "httpMethod": "PATCH",
  3816. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.patch",
  3817. // "parameterOrder": [
  3818. // "name"
  3819. // ],
  3820. // "parameters": {
  3821. // "name": {
  3822. // "description": "Output only. The resource name for this CryptoKey in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*`.",
  3823. // "location": "path",
  3824. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  3825. // "required": true,
  3826. // "type": "string"
  3827. // },
  3828. // "updateMask": {
  3829. // "description": "Required list of fields to be updated in this request.",
  3830. // "format": "google-fieldmask",
  3831. // "location": "query",
  3832. // "type": "string"
  3833. // }
  3834. // },
  3835. // "path": "v1/{+name}",
  3836. // "request": {
  3837. // "$ref": "CryptoKey"
  3838. // },
  3839. // "response": {
  3840. // "$ref": "CryptoKey"
  3841. // },
  3842. // "scopes": [
  3843. // "https://www.googleapis.com/auth/cloud-platform",
  3844. // "https://www.googleapis.com/auth/cloudkms"
  3845. // ]
  3846. // }
  3847. }
  3848. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy":
  3849. type ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall struct {
  3850. s *Service
  3851. resource string
  3852. setiampolicyrequest *SetIamPolicyRequest
  3853. urlParams_ gensupport.URLParams
  3854. ctx_ context.Context
  3855. header_ http.Header
  3856. }
  3857. // SetIamPolicy: Sets the access control policy on the specified
  3858. // resource. Replaces any
  3859. // existing policy.
  3860. func (r *ProjectsLocationsKeyRingsCryptoKeysService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall {
  3861. c := &ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3862. c.resource = resource
  3863. c.setiampolicyrequest = setiampolicyrequest
  3864. return c
  3865. }
  3866. // Fields allows partial responses to be retrieved. See
  3867. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3868. // for more information.
  3869. func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall {
  3870. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3871. return c
  3872. }
  3873. // Context sets the context to be used in this call's Do method. Any
  3874. // pending HTTP request will be aborted if the provided context is
  3875. // canceled.
  3876. func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall {
  3877. c.ctx_ = ctx
  3878. return c
  3879. }
  3880. // Header returns an http.Header that can be modified by the caller to
  3881. // add HTTP headers to the request.
  3882. func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Header() http.Header {
  3883. if c.header_ == nil {
  3884. c.header_ = make(http.Header)
  3885. }
  3886. return c.header_
  3887. }
  3888. func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3889. reqHeaders := make(http.Header)
  3890. for k, v := range c.header_ {
  3891. reqHeaders[k] = v
  3892. }
  3893. reqHeaders.Set("User-Agent", c.s.userAgent())
  3894. var body io.Reader = nil
  3895. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  3896. if err != nil {
  3897. return nil, err
  3898. }
  3899. reqHeaders.Set("Content-Type", "application/json")
  3900. c.urlParams_.Set("alt", alt)
  3901. c.urlParams_.Set("prettyPrint", "false")
  3902. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  3903. urls += "?" + c.urlParams_.Encode()
  3904. req, err := http.NewRequest("POST", urls, body)
  3905. if err != nil {
  3906. return nil, err
  3907. }
  3908. req.Header = reqHeaders
  3909. googleapi.Expand(req.URL, map[string]string{
  3910. "resource": c.resource,
  3911. })
  3912. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3913. }
  3914. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy" call.
  3915. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3916. // code is an error. Response headers are in either
  3917. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3918. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3919. // check whether the returned error was because http.StatusNotModified
  3920. // was returned.
  3921. func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3922. gensupport.SetOptions(c.urlParams_, opts...)
  3923. res, err := c.doRequest("json")
  3924. if res != nil && res.StatusCode == http.StatusNotModified {
  3925. if res.Body != nil {
  3926. res.Body.Close()
  3927. }
  3928. return nil, &googleapi.Error{
  3929. Code: res.StatusCode,
  3930. Header: res.Header,
  3931. }
  3932. }
  3933. if err != nil {
  3934. return nil, err
  3935. }
  3936. defer googleapi.CloseBody(res)
  3937. if err := googleapi.CheckResponse(res); err != nil {
  3938. return nil, err
  3939. }
  3940. ret := &Policy{
  3941. ServerResponse: googleapi.ServerResponse{
  3942. Header: res.Header,
  3943. HTTPStatusCode: res.StatusCode,
  3944. },
  3945. }
  3946. target := &ret
  3947. if err := gensupport.DecodeResponse(target, res); err != nil {
  3948. return nil, err
  3949. }
  3950. return ret, nil
  3951. // {
  3952. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  3953. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:setIamPolicy",
  3954. // "httpMethod": "POST",
  3955. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy",
  3956. // "parameterOrder": [
  3957. // "resource"
  3958. // ],
  3959. // "parameters": {
  3960. // "resource": {
  3961. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  3962. // "location": "path",
  3963. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  3964. // "required": true,
  3965. // "type": "string"
  3966. // }
  3967. // },
  3968. // "path": "v1/{+resource}:setIamPolicy",
  3969. // "request": {
  3970. // "$ref": "SetIamPolicyRequest"
  3971. // },
  3972. // "response": {
  3973. // "$ref": "Policy"
  3974. // },
  3975. // "scopes": [
  3976. // "https://www.googleapis.com/auth/cloud-platform",
  3977. // "https://www.googleapis.com/auth/cloudkms"
  3978. // ]
  3979. // }
  3980. }
  3981. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions":
  3982. type ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall struct {
  3983. s *Service
  3984. resource string
  3985. testiampermissionsrequest *TestIamPermissionsRequest
  3986. urlParams_ gensupport.URLParams
  3987. ctx_ context.Context
  3988. header_ http.Header
  3989. }
  3990. // TestIamPermissions: Returns permissions that a caller has on the
  3991. // specified resource.
  3992. // If the resource does not exist, this will return an empty set
  3993. // of
  3994. // permissions, not a NOT_FOUND error.
  3995. //
  3996. // Note: This operation is designed to be used for building
  3997. // permission-aware
  3998. // UIs and command-line tools, not for authorization checking. This
  3999. // operation
  4000. // may "fail open" without warning.
  4001. func (r *ProjectsLocationsKeyRingsCryptoKeysService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall {
  4002. c := &ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4003. c.resource = resource
  4004. c.testiampermissionsrequest = testiampermissionsrequest
  4005. return c
  4006. }
  4007. // Fields allows partial responses to be retrieved. See
  4008. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4009. // for more information.
  4010. func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall {
  4011. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4012. return c
  4013. }
  4014. // Context sets the context to be used in this call's Do method. Any
  4015. // pending HTTP request will be aborted if the provided context is
  4016. // canceled.
  4017. func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall {
  4018. c.ctx_ = ctx
  4019. return c
  4020. }
  4021. // Header returns an http.Header that can be modified by the caller to
  4022. // add HTTP headers to the request.
  4023. func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Header() http.Header {
  4024. if c.header_ == nil {
  4025. c.header_ = make(http.Header)
  4026. }
  4027. return c.header_
  4028. }
  4029. func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4030. reqHeaders := make(http.Header)
  4031. for k, v := range c.header_ {
  4032. reqHeaders[k] = v
  4033. }
  4034. reqHeaders.Set("User-Agent", c.s.userAgent())
  4035. var body io.Reader = nil
  4036. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4037. if err != nil {
  4038. return nil, err
  4039. }
  4040. reqHeaders.Set("Content-Type", "application/json")
  4041. c.urlParams_.Set("alt", alt)
  4042. c.urlParams_.Set("prettyPrint", "false")
  4043. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  4044. urls += "?" + c.urlParams_.Encode()
  4045. req, err := http.NewRequest("POST", urls, body)
  4046. if err != nil {
  4047. return nil, err
  4048. }
  4049. req.Header = reqHeaders
  4050. googleapi.Expand(req.URL, map[string]string{
  4051. "resource": c.resource,
  4052. })
  4053. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4054. }
  4055. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions" call.
  4056. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4057. // Any non-2xx status code is an error. Response headers are in either
  4058. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4059. // was returned at all) in error.(*googleapi.Error).Header. Use
  4060. // googleapi.IsNotModified to check whether the returned error was
  4061. // because http.StatusNotModified was returned.
  4062. func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4063. gensupport.SetOptions(c.urlParams_, opts...)
  4064. res, err := c.doRequest("json")
  4065. if res != nil && res.StatusCode == http.StatusNotModified {
  4066. if res.Body != nil {
  4067. res.Body.Close()
  4068. }
  4069. return nil, &googleapi.Error{
  4070. Code: res.StatusCode,
  4071. Header: res.Header,
  4072. }
  4073. }
  4074. if err != nil {
  4075. return nil, err
  4076. }
  4077. defer googleapi.CloseBody(res)
  4078. if err := googleapi.CheckResponse(res); err != nil {
  4079. return nil, err
  4080. }
  4081. ret := &TestIamPermissionsResponse{
  4082. ServerResponse: googleapi.ServerResponse{
  4083. Header: res.Header,
  4084. HTTPStatusCode: res.StatusCode,
  4085. },
  4086. }
  4087. target := &ret
  4088. if err := gensupport.DecodeResponse(target, res); err != nil {
  4089. return nil, err
  4090. }
  4091. return ret, nil
  4092. // {
  4093. // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
  4094. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:testIamPermissions",
  4095. // "httpMethod": "POST",
  4096. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions",
  4097. // "parameterOrder": [
  4098. // "resource"
  4099. // ],
  4100. // "parameters": {
  4101. // "resource": {
  4102. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4103. // "location": "path",
  4104. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  4105. // "required": true,
  4106. // "type": "string"
  4107. // }
  4108. // },
  4109. // "path": "v1/{+resource}:testIamPermissions",
  4110. // "request": {
  4111. // "$ref": "TestIamPermissionsRequest"
  4112. // },
  4113. // "response": {
  4114. // "$ref": "TestIamPermissionsResponse"
  4115. // },
  4116. // "scopes": [
  4117. // "https://www.googleapis.com/auth/cloud-platform",
  4118. // "https://www.googleapis.com/auth/cloudkms"
  4119. // ]
  4120. // }
  4121. }
  4122. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion":
  4123. type ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall struct {
  4124. s *Service
  4125. name string
  4126. updatecryptokeyprimaryversionrequest *UpdateCryptoKeyPrimaryVersionRequest
  4127. urlParams_ gensupport.URLParams
  4128. ctx_ context.Context
  4129. header_ http.Header
  4130. }
  4131. // UpdatePrimaryVersion: Update the version of a CryptoKey that will be
  4132. // used in Encrypt.
  4133. //
  4134. // Returns an error if called on an asymmetric key.
  4135. func (r *ProjectsLocationsKeyRingsCryptoKeysService) UpdatePrimaryVersion(name string, updatecryptokeyprimaryversionrequest *UpdateCryptoKeyPrimaryVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall {
  4136. c := &ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4137. c.name = name
  4138. c.updatecryptokeyprimaryversionrequest = updatecryptokeyprimaryversionrequest
  4139. return c
  4140. }
  4141. // Fields allows partial responses to be retrieved. See
  4142. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4143. // for more information.
  4144. func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall {
  4145. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4146. return c
  4147. }
  4148. // Context sets the context to be used in this call's Do method. Any
  4149. // pending HTTP request will be aborted if the provided context is
  4150. // canceled.
  4151. func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall {
  4152. c.ctx_ = ctx
  4153. return c
  4154. }
  4155. // Header returns an http.Header that can be modified by the caller to
  4156. // add HTTP headers to the request.
  4157. func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Header() http.Header {
  4158. if c.header_ == nil {
  4159. c.header_ = make(http.Header)
  4160. }
  4161. return c.header_
  4162. }
  4163. func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) doRequest(alt string) (*http.Response, error) {
  4164. reqHeaders := make(http.Header)
  4165. for k, v := range c.header_ {
  4166. reqHeaders[k] = v
  4167. }
  4168. reqHeaders.Set("User-Agent", c.s.userAgent())
  4169. var body io.Reader = nil
  4170. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatecryptokeyprimaryversionrequest)
  4171. if err != nil {
  4172. return nil, err
  4173. }
  4174. reqHeaders.Set("Content-Type", "application/json")
  4175. c.urlParams_.Set("alt", alt)
  4176. c.urlParams_.Set("prettyPrint", "false")
  4177. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:updatePrimaryVersion")
  4178. urls += "?" + c.urlParams_.Encode()
  4179. req, err := http.NewRequest("POST", urls, body)
  4180. if err != nil {
  4181. return nil, err
  4182. }
  4183. req.Header = reqHeaders
  4184. googleapi.Expand(req.URL, map[string]string{
  4185. "name": c.name,
  4186. })
  4187. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4188. }
  4189. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion" call.
  4190. // Exactly one of *CryptoKey or error will be non-nil. Any non-2xx
  4191. // status code is an error. Response headers are in either
  4192. // *CryptoKey.ServerResponse.Header or (if a response was returned at
  4193. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4194. // to check whether the returned error was because
  4195. // http.StatusNotModified was returned.
  4196. func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) {
  4197. gensupport.SetOptions(c.urlParams_, opts...)
  4198. res, err := c.doRequest("json")
  4199. if res != nil && res.StatusCode == http.StatusNotModified {
  4200. if res.Body != nil {
  4201. res.Body.Close()
  4202. }
  4203. return nil, &googleapi.Error{
  4204. Code: res.StatusCode,
  4205. Header: res.Header,
  4206. }
  4207. }
  4208. if err != nil {
  4209. return nil, err
  4210. }
  4211. defer googleapi.CloseBody(res)
  4212. if err := googleapi.CheckResponse(res); err != nil {
  4213. return nil, err
  4214. }
  4215. ret := &CryptoKey{
  4216. ServerResponse: googleapi.ServerResponse{
  4217. Header: res.Header,
  4218. HTTPStatusCode: res.StatusCode,
  4219. },
  4220. }
  4221. target := &ret
  4222. if err := gensupport.DecodeResponse(target, res); err != nil {
  4223. return nil, err
  4224. }
  4225. return ret, nil
  4226. // {
  4227. // "description": "Update the version of a CryptoKey that will be used in Encrypt.\n\nReturns an error if called on an asymmetric key.",
  4228. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:updatePrimaryVersion",
  4229. // "httpMethod": "POST",
  4230. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion",
  4231. // "parameterOrder": [
  4232. // "name"
  4233. // ],
  4234. // "parameters": {
  4235. // "name": {
  4236. // "description": "The resource name of the CryptoKey to update.",
  4237. // "location": "path",
  4238. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  4239. // "required": true,
  4240. // "type": "string"
  4241. // }
  4242. // },
  4243. // "path": "v1/{+name}:updatePrimaryVersion",
  4244. // "request": {
  4245. // "$ref": "UpdateCryptoKeyPrimaryVersionRequest"
  4246. // },
  4247. // "response": {
  4248. // "$ref": "CryptoKey"
  4249. // },
  4250. // "scopes": [
  4251. // "https://www.googleapis.com/auth/cloud-platform",
  4252. // "https://www.googleapis.com/auth/cloudkms"
  4253. // ]
  4254. // }
  4255. }
  4256. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt":
  4257. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall struct {
  4258. s *Service
  4259. name string
  4260. asymmetricdecryptrequest *AsymmetricDecryptRequest
  4261. urlParams_ gensupport.URLParams
  4262. ctx_ context.Context
  4263. header_ http.Header
  4264. }
  4265. // AsymmetricDecrypt: Decrypts data that was encrypted with a public key
  4266. // retrieved from
  4267. // GetPublicKey corresponding to a CryptoKeyVersion
  4268. // with
  4269. // CryptoKey.purpose ASYMMETRIC_DECRYPT.
  4270. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) AsymmetricDecrypt(name string, asymmetricdecryptrequest *AsymmetricDecryptRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall {
  4271. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4272. c.name = name
  4273. c.asymmetricdecryptrequest = asymmetricdecryptrequest
  4274. return c
  4275. }
  4276. // Fields allows partial responses to be retrieved. See
  4277. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4278. // for more information.
  4279. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall {
  4280. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4281. return c
  4282. }
  4283. // Context sets the context to be used in this call's Do method. Any
  4284. // pending HTTP request will be aborted if the provided context is
  4285. // canceled.
  4286. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall {
  4287. c.ctx_ = ctx
  4288. return c
  4289. }
  4290. // Header returns an http.Header that can be modified by the caller to
  4291. // add HTTP headers to the request.
  4292. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Header() http.Header {
  4293. if c.header_ == nil {
  4294. c.header_ = make(http.Header)
  4295. }
  4296. return c.header_
  4297. }
  4298. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) doRequest(alt string) (*http.Response, error) {
  4299. reqHeaders := make(http.Header)
  4300. for k, v := range c.header_ {
  4301. reqHeaders[k] = v
  4302. }
  4303. reqHeaders.Set("User-Agent", c.s.userAgent())
  4304. var body io.Reader = nil
  4305. body, err := googleapi.WithoutDataWrapper.JSONReader(c.asymmetricdecryptrequest)
  4306. if err != nil {
  4307. return nil, err
  4308. }
  4309. reqHeaders.Set("Content-Type", "application/json")
  4310. c.urlParams_.Set("alt", alt)
  4311. c.urlParams_.Set("prettyPrint", "false")
  4312. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:asymmetricDecrypt")
  4313. urls += "?" + c.urlParams_.Encode()
  4314. req, err := http.NewRequest("POST", urls, body)
  4315. if err != nil {
  4316. return nil, err
  4317. }
  4318. req.Header = reqHeaders
  4319. googleapi.Expand(req.URL, map[string]string{
  4320. "name": c.name,
  4321. })
  4322. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4323. }
  4324. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt" call.
  4325. // Exactly one of *AsymmetricDecryptResponse or error will be non-nil.
  4326. // Any non-2xx status code is an error. Response headers are in either
  4327. // *AsymmetricDecryptResponse.ServerResponse.Header or (if a response
  4328. // was returned at all) in error.(*googleapi.Error).Header. Use
  4329. // googleapi.IsNotModified to check whether the returned error was
  4330. // because http.StatusNotModified was returned.
  4331. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Do(opts ...googleapi.CallOption) (*AsymmetricDecryptResponse, error) {
  4332. gensupport.SetOptions(c.urlParams_, opts...)
  4333. res, err := c.doRequest("json")
  4334. if res != nil && res.StatusCode == http.StatusNotModified {
  4335. if res.Body != nil {
  4336. res.Body.Close()
  4337. }
  4338. return nil, &googleapi.Error{
  4339. Code: res.StatusCode,
  4340. Header: res.Header,
  4341. }
  4342. }
  4343. if err != nil {
  4344. return nil, err
  4345. }
  4346. defer googleapi.CloseBody(res)
  4347. if err := googleapi.CheckResponse(res); err != nil {
  4348. return nil, err
  4349. }
  4350. ret := &AsymmetricDecryptResponse{
  4351. ServerResponse: googleapi.ServerResponse{
  4352. Header: res.Header,
  4353. HTTPStatusCode: res.StatusCode,
  4354. },
  4355. }
  4356. target := &ret
  4357. if err := gensupport.DecodeResponse(target, res); err != nil {
  4358. return nil, err
  4359. }
  4360. return ret, nil
  4361. // {
  4362. // "description": "Decrypts data that was encrypted with a public key retrieved from\nGetPublicKey corresponding to a CryptoKeyVersion with\nCryptoKey.purpose ASYMMETRIC_DECRYPT.",
  4363. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:asymmetricDecrypt",
  4364. // "httpMethod": "POST",
  4365. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt",
  4366. // "parameterOrder": [
  4367. // "name"
  4368. // ],
  4369. // "parameters": {
  4370. // "name": {
  4371. // "description": "Required. The resource name of the CryptoKeyVersion to use for\ndecryption.",
  4372. // "location": "path",
  4373. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  4374. // "required": true,
  4375. // "type": "string"
  4376. // }
  4377. // },
  4378. // "path": "v1/{+name}:asymmetricDecrypt",
  4379. // "request": {
  4380. // "$ref": "AsymmetricDecryptRequest"
  4381. // },
  4382. // "response": {
  4383. // "$ref": "AsymmetricDecryptResponse"
  4384. // },
  4385. // "scopes": [
  4386. // "https://www.googleapis.com/auth/cloud-platform",
  4387. // "https://www.googleapis.com/auth/cloudkms"
  4388. // ]
  4389. // }
  4390. }
  4391. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign":
  4392. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall struct {
  4393. s *Service
  4394. name string
  4395. asymmetricsignrequest *AsymmetricSignRequest
  4396. urlParams_ gensupport.URLParams
  4397. ctx_ context.Context
  4398. header_ http.Header
  4399. }
  4400. // AsymmetricSign: Signs data using a CryptoKeyVersion with
  4401. // CryptoKey.purpose
  4402. // ASYMMETRIC_SIGN, producing a signature that can be verified with the
  4403. // public
  4404. // key retrieved from GetPublicKey.
  4405. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) AsymmetricSign(name string, asymmetricsignrequest *AsymmetricSignRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall {
  4406. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4407. c.name = name
  4408. c.asymmetricsignrequest = asymmetricsignrequest
  4409. return c
  4410. }
  4411. // Fields allows partial responses to be retrieved. See
  4412. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4413. // for more information.
  4414. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall {
  4415. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4416. return c
  4417. }
  4418. // Context sets the context to be used in this call's Do method. Any
  4419. // pending HTTP request will be aborted if the provided context is
  4420. // canceled.
  4421. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall {
  4422. c.ctx_ = ctx
  4423. return c
  4424. }
  4425. // Header returns an http.Header that can be modified by the caller to
  4426. // add HTTP headers to the request.
  4427. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Header() http.Header {
  4428. if c.header_ == nil {
  4429. c.header_ = make(http.Header)
  4430. }
  4431. return c.header_
  4432. }
  4433. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) doRequest(alt string) (*http.Response, error) {
  4434. reqHeaders := make(http.Header)
  4435. for k, v := range c.header_ {
  4436. reqHeaders[k] = v
  4437. }
  4438. reqHeaders.Set("User-Agent", c.s.userAgent())
  4439. var body io.Reader = nil
  4440. body, err := googleapi.WithoutDataWrapper.JSONReader(c.asymmetricsignrequest)
  4441. if err != nil {
  4442. return nil, err
  4443. }
  4444. reqHeaders.Set("Content-Type", "application/json")
  4445. c.urlParams_.Set("alt", alt)
  4446. c.urlParams_.Set("prettyPrint", "false")
  4447. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:asymmetricSign")
  4448. urls += "?" + c.urlParams_.Encode()
  4449. req, err := http.NewRequest("POST", urls, body)
  4450. if err != nil {
  4451. return nil, err
  4452. }
  4453. req.Header = reqHeaders
  4454. googleapi.Expand(req.URL, map[string]string{
  4455. "name": c.name,
  4456. })
  4457. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4458. }
  4459. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign" call.
  4460. // Exactly one of *AsymmetricSignResponse or error will be non-nil. Any
  4461. // non-2xx status code is an error. Response headers are in either
  4462. // *AsymmetricSignResponse.ServerResponse.Header or (if a response was
  4463. // returned at all) in error.(*googleapi.Error).Header. Use
  4464. // googleapi.IsNotModified to check whether the returned error was
  4465. // because http.StatusNotModified was returned.
  4466. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Do(opts ...googleapi.CallOption) (*AsymmetricSignResponse, error) {
  4467. gensupport.SetOptions(c.urlParams_, opts...)
  4468. res, err := c.doRequest("json")
  4469. if res != nil && res.StatusCode == http.StatusNotModified {
  4470. if res.Body != nil {
  4471. res.Body.Close()
  4472. }
  4473. return nil, &googleapi.Error{
  4474. Code: res.StatusCode,
  4475. Header: res.Header,
  4476. }
  4477. }
  4478. if err != nil {
  4479. return nil, err
  4480. }
  4481. defer googleapi.CloseBody(res)
  4482. if err := googleapi.CheckResponse(res); err != nil {
  4483. return nil, err
  4484. }
  4485. ret := &AsymmetricSignResponse{
  4486. ServerResponse: googleapi.ServerResponse{
  4487. Header: res.Header,
  4488. HTTPStatusCode: res.StatusCode,
  4489. },
  4490. }
  4491. target := &ret
  4492. if err := gensupport.DecodeResponse(target, res); err != nil {
  4493. return nil, err
  4494. }
  4495. return ret, nil
  4496. // {
  4497. // "description": "Signs data using a CryptoKeyVersion with CryptoKey.purpose\nASYMMETRIC_SIGN, producing a signature that can be verified with the public\nkey retrieved from GetPublicKey.",
  4498. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:asymmetricSign",
  4499. // "httpMethod": "POST",
  4500. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign",
  4501. // "parameterOrder": [
  4502. // "name"
  4503. // ],
  4504. // "parameters": {
  4505. // "name": {
  4506. // "description": "Required. The resource name of the CryptoKeyVersion to use for signing.",
  4507. // "location": "path",
  4508. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  4509. // "required": true,
  4510. // "type": "string"
  4511. // }
  4512. // },
  4513. // "path": "v1/{+name}:asymmetricSign",
  4514. // "request": {
  4515. // "$ref": "AsymmetricSignRequest"
  4516. // },
  4517. // "response": {
  4518. // "$ref": "AsymmetricSignResponse"
  4519. // },
  4520. // "scopes": [
  4521. // "https://www.googleapis.com/auth/cloud-platform",
  4522. // "https://www.googleapis.com/auth/cloudkms"
  4523. // ]
  4524. // }
  4525. }
  4526. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create":
  4527. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall struct {
  4528. s *Service
  4529. parent string
  4530. cryptokeyversion *CryptoKeyVersion
  4531. urlParams_ gensupport.URLParams
  4532. ctx_ context.Context
  4533. header_ http.Header
  4534. }
  4535. // Create: Create a new CryptoKeyVersion in a CryptoKey.
  4536. //
  4537. // The server will assign the next sequential id. If unset,
  4538. // state will be set to
  4539. // ENABLED.
  4540. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Create(parent string, cryptokeyversion *CryptoKeyVersion) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall {
  4541. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4542. c.parent = parent
  4543. c.cryptokeyversion = cryptokeyversion
  4544. return c
  4545. }
  4546. // Fields allows partial responses to be retrieved. See
  4547. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4548. // for more information.
  4549. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall {
  4550. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4551. return c
  4552. }
  4553. // Context sets the context to be used in this call's Do method. Any
  4554. // pending HTTP request will be aborted if the provided context is
  4555. // canceled.
  4556. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall {
  4557. c.ctx_ = ctx
  4558. return c
  4559. }
  4560. // Header returns an http.Header that can be modified by the caller to
  4561. // add HTTP headers to the request.
  4562. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Header() http.Header {
  4563. if c.header_ == nil {
  4564. c.header_ = make(http.Header)
  4565. }
  4566. return c.header_
  4567. }
  4568. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) doRequest(alt string) (*http.Response, error) {
  4569. reqHeaders := make(http.Header)
  4570. for k, v := range c.header_ {
  4571. reqHeaders[k] = v
  4572. }
  4573. reqHeaders.Set("User-Agent", c.s.userAgent())
  4574. var body io.Reader = nil
  4575. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokeyversion)
  4576. if err != nil {
  4577. return nil, err
  4578. }
  4579. reqHeaders.Set("Content-Type", "application/json")
  4580. c.urlParams_.Set("alt", alt)
  4581. c.urlParams_.Set("prettyPrint", "false")
  4582. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeyVersions")
  4583. urls += "?" + c.urlParams_.Encode()
  4584. req, err := http.NewRequest("POST", urls, body)
  4585. if err != nil {
  4586. return nil, err
  4587. }
  4588. req.Header = reqHeaders
  4589. googleapi.Expand(req.URL, map[string]string{
  4590. "parent": c.parent,
  4591. })
  4592. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4593. }
  4594. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create" call.
  4595. // Exactly one of *CryptoKeyVersion or error will be non-nil. Any
  4596. // non-2xx status code is an error. Response headers are in either
  4597. // *CryptoKeyVersion.ServerResponse.Header or (if a response was
  4598. // returned at all) in error.(*googleapi.Error).Header. Use
  4599. // googleapi.IsNotModified to check whether the returned error was
  4600. // because http.StatusNotModified was returned.
  4601. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) {
  4602. gensupport.SetOptions(c.urlParams_, opts...)
  4603. res, err := c.doRequest("json")
  4604. if res != nil && res.StatusCode == http.StatusNotModified {
  4605. if res.Body != nil {
  4606. res.Body.Close()
  4607. }
  4608. return nil, &googleapi.Error{
  4609. Code: res.StatusCode,
  4610. Header: res.Header,
  4611. }
  4612. }
  4613. if err != nil {
  4614. return nil, err
  4615. }
  4616. defer googleapi.CloseBody(res)
  4617. if err := googleapi.CheckResponse(res); err != nil {
  4618. return nil, err
  4619. }
  4620. ret := &CryptoKeyVersion{
  4621. ServerResponse: googleapi.ServerResponse{
  4622. Header: res.Header,
  4623. HTTPStatusCode: res.StatusCode,
  4624. },
  4625. }
  4626. target := &ret
  4627. if err := gensupport.DecodeResponse(target, res); err != nil {
  4628. return nil, err
  4629. }
  4630. return ret, nil
  4631. // {
  4632. // "description": "Create a new CryptoKeyVersion in a CryptoKey.\n\nThe server will assign the next sequential id. If unset,\nstate will be set to\nENABLED.",
  4633. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions",
  4634. // "httpMethod": "POST",
  4635. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create",
  4636. // "parameterOrder": [
  4637. // "parent"
  4638. // ],
  4639. // "parameters": {
  4640. // "parent": {
  4641. // "description": "Required. The name of the CryptoKey associated with\nthe CryptoKeyVersions.",
  4642. // "location": "path",
  4643. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  4644. // "required": true,
  4645. // "type": "string"
  4646. // }
  4647. // },
  4648. // "path": "v1/{+parent}/cryptoKeyVersions",
  4649. // "request": {
  4650. // "$ref": "CryptoKeyVersion"
  4651. // },
  4652. // "response": {
  4653. // "$ref": "CryptoKeyVersion"
  4654. // },
  4655. // "scopes": [
  4656. // "https://www.googleapis.com/auth/cloud-platform",
  4657. // "https://www.googleapis.com/auth/cloudkms"
  4658. // ]
  4659. // }
  4660. }
  4661. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy":
  4662. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall struct {
  4663. s *Service
  4664. name string
  4665. destroycryptokeyversionrequest *DestroyCryptoKeyVersionRequest
  4666. urlParams_ gensupport.URLParams
  4667. ctx_ context.Context
  4668. header_ http.Header
  4669. }
  4670. // Destroy: Schedule a CryptoKeyVersion for destruction.
  4671. //
  4672. // Upon calling this method, CryptoKeyVersion.state will be set
  4673. // to
  4674. // DESTROY_SCHEDULED
  4675. // and destroy_time will be set to a time 24
  4676. // hours in the future, at which point the state
  4677. // will be changed to
  4678. // DESTROYED, and the key
  4679. // material will be irrevocably destroyed.
  4680. //
  4681. // Before the destroy_time is reached,
  4682. // RestoreCryptoKeyVersion may be called to reverse the process.
  4683. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Destroy(name string, destroycryptokeyversionrequest *DestroyCryptoKeyVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall {
  4684. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4685. c.name = name
  4686. c.destroycryptokeyversionrequest = destroycryptokeyversionrequest
  4687. return c
  4688. }
  4689. // Fields allows partial responses to be retrieved. See
  4690. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4691. // for more information.
  4692. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall {
  4693. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4694. return c
  4695. }
  4696. // Context sets the context to be used in this call's Do method. Any
  4697. // pending HTTP request will be aborted if the provided context is
  4698. // canceled.
  4699. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall {
  4700. c.ctx_ = ctx
  4701. return c
  4702. }
  4703. // Header returns an http.Header that can be modified by the caller to
  4704. // add HTTP headers to the request.
  4705. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Header() http.Header {
  4706. if c.header_ == nil {
  4707. c.header_ = make(http.Header)
  4708. }
  4709. return c.header_
  4710. }
  4711. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) doRequest(alt string) (*http.Response, error) {
  4712. reqHeaders := make(http.Header)
  4713. for k, v := range c.header_ {
  4714. reqHeaders[k] = v
  4715. }
  4716. reqHeaders.Set("User-Agent", c.s.userAgent())
  4717. var body io.Reader = nil
  4718. body, err := googleapi.WithoutDataWrapper.JSONReader(c.destroycryptokeyversionrequest)
  4719. if err != nil {
  4720. return nil, err
  4721. }
  4722. reqHeaders.Set("Content-Type", "application/json")
  4723. c.urlParams_.Set("alt", alt)
  4724. c.urlParams_.Set("prettyPrint", "false")
  4725. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:destroy")
  4726. urls += "?" + c.urlParams_.Encode()
  4727. req, err := http.NewRequest("POST", urls, body)
  4728. if err != nil {
  4729. return nil, err
  4730. }
  4731. req.Header = reqHeaders
  4732. googleapi.Expand(req.URL, map[string]string{
  4733. "name": c.name,
  4734. })
  4735. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4736. }
  4737. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy" call.
  4738. // Exactly one of *CryptoKeyVersion or error will be non-nil. Any
  4739. // non-2xx status code is an error. Response headers are in either
  4740. // *CryptoKeyVersion.ServerResponse.Header or (if a response was
  4741. // returned at all) in error.(*googleapi.Error).Header. Use
  4742. // googleapi.IsNotModified to check whether the returned error was
  4743. // because http.StatusNotModified was returned.
  4744. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) {
  4745. gensupport.SetOptions(c.urlParams_, opts...)
  4746. res, err := c.doRequest("json")
  4747. if res != nil && res.StatusCode == http.StatusNotModified {
  4748. if res.Body != nil {
  4749. res.Body.Close()
  4750. }
  4751. return nil, &googleapi.Error{
  4752. Code: res.StatusCode,
  4753. Header: res.Header,
  4754. }
  4755. }
  4756. if err != nil {
  4757. return nil, err
  4758. }
  4759. defer googleapi.CloseBody(res)
  4760. if err := googleapi.CheckResponse(res); err != nil {
  4761. return nil, err
  4762. }
  4763. ret := &CryptoKeyVersion{
  4764. ServerResponse: googleapi.ServerResponse{
  4765. Header: res.Header,
  4766. HTTPStatusCode: res.StatusCode,
  4767. },
  4768. }
  4769. target := &ret
  4770. if err := gensupport.DecodeResponse(target, res); err != nil {
  4771. return nil, err
  4772. }
  4773. return ret, nil
  4774. // {
  4775. // "description": "Schedule a CryptoKeyVersion for destruction.\n\nUpon calling this method, CryptoKeyVersion.state will be set to\nDESTROY_SCHEDULED\nand destroy_time will be set to a time 24\nhours in the future, at which point the state\nwill be changed to\nDESTROYED, and the key\nmaterial will be irrevocably destroyed.\n\nBefore the destroy_time is reached,\nRestoreCryptoKeyVersion may be called to reverse the process.",
  4776. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:destroy",
  4777. // "httpMethod": "POST",
  4778. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy",
  4779. // "parameterOrder": [
  4780. // "name"
  4781. // ],
  4782. // "parameters": {
  4783. // "name": {
  4784. // "description": "The resource name of the CryptoKeyVersion to destroy.",
  4785. // "location": "path",
  4786. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  4787. // "required": true,
  4788. // "type": "string"
  4789. // }
  4790. // },
  4791. // "path": "v1/{+name}:destroy",
  4792. // "request": {
  4793. // "$ref": "DestroyCryptoKeyVersionRequest"
  4794. // },
  4795. // "response": {
  4796. // "$ref": "CryptoKeyVersion"
  4797. // },
  4798. // "scopes": [
  4799. // "https://www.googleapis.com/auth/cloud-platform",
  4800. // "https://www.googleapis.com/auth/cloudkms"
  4801. // ]
  4802. // }
  4803. }
  4804. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get":
  4805. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall struct {
  4806. s *Service
  4807. name string
  4808. urlParams_ gensupport.URLParams
  4809. ifNoneMatch_ string
  4810. ctx_ context.Context
  4811. header_ http.Header
  4812. }
  4813. // Get: Returns metadata for a given CryptoKeyVersion.
  4814. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Get(name string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall {
  4815. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4816. c.name = name
  4817. return c
  4818. }
  4819. // Fields allows partial responses to be retrieved. See
  4820. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4821. // for more information.
  4822. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall {
  4823. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4824. return c
  4825. }
  4826. // IfNoneMatch sets the optional parameter which makes the operation
  4827. // fail if the object's ETag matches the given value. This is useful for
  4828. // getting updates only after the object has changed since the last
  4829. // request. Use googleapi.IsNotModified to check whether the response
  4830. // error from Do is the result of In-None-Match.
  4831. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall {
  4832. c.ifNoneMatch_ = entityTag
  4833. return c
  4834. }
  4835. // Context sets the context to be used in this call's Do method. Any
  4836. // pending HTTP request will be aborted if the provided context is
  4837. // canceled.
  4838. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall {
  4839. c.ctx_ = ctx
  4840. return c
  4841. }
  4842. // Header returns an http.Header that can be modified by the caller to
  4843. // add HTTP headers to the request.
  4844. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Header() http.Header {
  4845. if c.header_ == nil {
  4846. c.header_ = make(http.Header)
  4847. }
  4848. return c.header_
  4849. }
  4850. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) doRequest(alt string) (*http.Response, error) {
  4851. reqHeaders := make(http.Header)
  4852. for k, v := range c.header_ {
  4853. reqHeaders[k] = v
  4854. }
  4855. reqHeaders.Set("User-Agent", c.s.userAgent())
  4856. if c.ifNoneMatch_ != "" {
  4857. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4858. }
  4859. var body io.Reader = nil
  4860. c.urlParams_.Set("alt", alt)
  4861. c.urlParams_.Set("prettyPrint", "false")
  4862. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4863. urls += "?" + c.urlParams_.Encode()
  4864. req, err := http.NewRequest("GET", urls, body)
  4865. if err != nil {
  4866. return nil, err
  4867. }
  4868. req.Header = reqHeaders
  4869. googleapi.Expand(req.URL, map[string]string{
  4870. "name": c.name,
  4871. })
  4872. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4873. }
  4874. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get" call.
  4875. // Exactly one of *CryptoKeyVersion or error will be non-nil. Any
  4876. // non-2xx status code is an error. Response headers are in either
  4877. // *CryptoKeyVersion.ServerResponse.Header or (if a response was
  4878. // returned at all) in error.(*googleapi.Error).Header. Use
  4879. // googleapi.IsNotModified to check whether the returned error was
  4880. // because http.StatusNotModified was returned.
  4881. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) {
  4882. gensupport.SetOptions(c.urlParams_, opts...)
  4883. res, err := c.doRequest("json")
  4884. if res != nil && res.StatusCode == http.StatusNotModified {
  4885. if res.Body != nil {
  4886. res.Body.Close()
  4887. }
  4888. return nil, &googleapi.Error{
  4889. Code: res.StatusCode,
  4890. Header: res.Header,
  4891. }
  4892. }
  4893. if err != nil {
  4894. return nil, err
  4895. }
  4896. defer googleapi.CloseBody(res)
  4897. if err := googleapi.CheckResponse(res); err != nil {
  4898. return nil, err
  4899. }
  4900. ret := &CryptoKeyVersion{
  4901. ServerResponse: googleapi.ServerResponse{
  4902. Header: res.Header,
  4903. HTTPStatusCode: res.StatusCode,
  4904. },
  4905. }
  4906. target := &ret
  4907. if err := gensupport.DecodeResponse(target, res); err != nil {
  4908. return nil, err
  4909. }
  4910. return ret, nil
  4911. // {
  4912. // "description": "Returns metadata for a given CryptoKeyVersion.",
  4913. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}",
  4914. // "httpMethod": "GET",
  4915. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get",
  4916. // "parameterOrder": [
  4917. // "name"
  4918. // ],
  4919. // "parameters": {
  4920. // "name": {
  4921. // "description": "The name of the CryptoKeyVersion to get.",
  4922. // "location": "path",
  4923. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  4924. // "required": true,
  4925. // "type": "string"
  4926. // }
  4927. // },
  4928. // "path": "v1/{+name}",
  4929. // "response": {
  4930. // "$ref": "CryptoKeyVersion"
  4931. // },
  4932. // "scopes": [
  4933. // "https://www.googleapis.com/auth/cloud-platform",
  4934. // "https://www.googleapis.com/auth/cloudkms"
  4935. // ]
  4936. // }
  4937. }
  4938. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey":
  4939. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall struct {
  4940. s *Service
  4941. name string
  4942. urlParams_ gensupport.URLParams
  4943. ifNoneMatch_ string
  4944. ctx_ context.Context
  4945. header_ http.Header
  4946. }
  4947. // GetPublicKey: Returns the public key for the given CryptoKeyVersion.
  4948. // The
  4949. // CryptoKey.purpose must be
  4950. // ASYMMETRIC_SIGN or
  4951. // ASYMMETRIC_DECRYPT.
  4952. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) GetPublicKey(name string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall {
  4953. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4954. c.name = name
  4955. return c
  4956. }
  4957. // Fields allows partial responses to be retrieved. See
  4958. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4959. // for more information.
  4960. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall {
  4961. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4962. return c
  4963. }
  4964. // IfNoneMatch sets the optional parameter which makes the operation
  4965. // fail if the object's ETag matches the given value. This is useful for
  4966. // getting updates only after the object has changed since the last
  4967. // request. Use googleapi.IsNotModified to check whether the response
  4968. // error from Do is the result of In-None-Match.
  4969. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall {
  4970. c.ifNoneMatch_ = entityTag
  4971. return c
  4972. }
  4973. // Context sets the context to be used in this call's Do method. Any
  4974. // pending HTTP request will be aborted if the provided context is
  4975. // canceled.
  4976. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall {
  4977. c.ctx_ = ctx
  4978. return c
  4979. }
  4980. // Header returns an http.Header that can be modified by the caller to
  4981. // add HTTP headers to the request.
  4982. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Header() http.Header {
  4983. if c.header_ == nil {
  4984. c.header_ = make(http.Header)
  4985. }
  4986. return c.header_
  4987. }
  4988. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) doRequest(alt string) (*http.Response, error) {
  4989. reqHeaders := make(http.Header)
  4990. for k, v := range c.header_ {
  4991. reqHeaders[k] = v
  4992. }
  4993. reqHeaders.Set("User-Agent", c.s.userAgent())
  4994. if c.ifNoneMatch_ != "" {
  4995. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4996. }
  4997. var body io.Reader = nil
  4998. c.urlParams_.Set("alt", alt)
  4999. c.urlParams_.Set("prettyPrint", "false")
  5000. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/publicKey")
  5001. urls += "?" + c.urlParams_.Encode()
  5002. req, err := http.NewRequest("GET", urls, body)
  5003. if err != nil {
  5004. return nil, err
  5005. }
  5006. req.Header = reqHeaders
  5007. googleapi.Expand(req.URL, map[string]string{
  5008. "name": c.name,
  5009. })
  5010. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5011. }
  5012. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey" call.
  5013. // Exactly one of *PublicKey or error will be non-nil. Any non-2xx
  5014. // status code is an error. Response headers are in either
  5015. // *PublicKey.ServerResponse.Header or (if a response was returned at
  5016. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5017. // to check whether the returned error was because
  5018. // http.StatusNotModified was returned.
  5019. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Do(opts ...googleapi.CallOption) (*PublicKey, error) {
  5020. gensupport.SetOptions(c.urlParams_, opts...)
  5021. res, err := c.doRequest("json")
  5022. if res != nil && res.StatusCode == http.StatusNotModified {
  5023. if res.Body != nil {
  5024. res.Body.Close()
  5025. }
  5026. return nil, &googleapi.Error{
  5027. Code: res.StatusCode,
  5028. Header: res.Header,
  5029. }
  5030. }
  5031. if err != nil {
  5032. return nil, err
  5033. }
  5034. defer googleapi.CloseBody(res)
  5035. if err := googleapi.CheckResponse(res); err != nil {
  5036. return nil, err
  5037. }
  5038. ret := &PublicKey{
  5039. ServerResponse: googleapi.ServerResponse{
  5040. Header: res.Header,
  5041. HTTPStatusCode: res.StatusCode,
  5042. },
  5043. }
  5044. target := &ret
  5045. if err := gensupport.DecodeResponse(target, res); err != nil {
  5046. return nil, err
  5047. }
  5048. return ret, nil
  5049. // {
  5050. // "description": "Returns the public key for the given CryptoKeyVersion. The\nCryptoKey.purpose must be\nASYMMETRIC_SIGN or\nASYMMETRIC_DECRYPT.",
  5051. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}/publicKey",
  5052. // "httpMethod": "GET",
  5053. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey",
  5054. // "parameterOrder": [
  5055. // "name"
  5056. // ],
  5057. // "parameters": {
  5058. // "name": {
  5059. // "description": "The name of the CryptoKeyVersion public key to\nget.",
  5060. // "location": "path",
  5061. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  5062. // "required": true,
  5063. // "type": "string"
  5064. // }
  5065. // },
  5066. // "path": "v1/{+name}/publicKey",
  5067. // "response": {
  5068. // "$ref": "PublicKey"
  5069. // },
  5070. // "scopes": [
  5071. // "https://www.googleapis.com/auth/cloud-platform",
  5072. // "https://www.googleapis.com/auth/cloudkms"
  5073. // ]
  5074. // }
  5075. }
  5076. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list":
  5077. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall struct {
  5078. s *Service
  5079. parent string
  5080. urlParams_ gensupport.URLParams
  5081. ifNoneMatch_ string
  5082. ctx_ context.Context
  5083. header_ http.Header
  5084. }
  5085. // List: Lists CryptoKeyVersions.
  5086. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) List(parent string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5087. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5088. c.parent = parent
  5089. return c
  5090. }
  5091. // PageSize sets the optional parameter "pageSize": Optional limit on
  5092. // the number of CryptoKeyVersions to
  5093. // include in the response. Further CryptoKeyVersions can
  5094. // subsequently be obtained by including
  5095. // the
  5096. // ListCryptoKeyVersionsResponse.next_page_token in a subsequent
  5097. // request.
  5098. // If unspecified, the server will pick an appropriate default.
  5099. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5100. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5101. return c
  5102. }
  5103. // PageToken sets the optional parameter "pageToken": Optional
  5104. // pagination token, returned earlier
  5105. // via
  5106. // ListCryptoKeyVersionsResponse.next_page_token.
  5107. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5108. c.urlParams_.Set("pageToken", pageToken)
  5109. return c
  5110. }
  5111. // View sets the optional parameter "view": The fields to include in the
  5112. // response.
  5113. //
  5114. // Possible values:
  5115. // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED"
  5116. // "FULL"
  5117. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) View(view string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5118. c.urlParams_.Set("view", view)
  5119. return c
  5120. }
  5121. // Fields allows partial responses to be retrieved. See
  5122. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5123. // for more information.
  5124. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5125. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5126. return c
  5127. }
  5128. // IfNoneMatch sets the optional parameter which makes the operation
  5129. // fail if the object's ETag matches the given value. This is useful for
  5130. // getting updates only after the object has changed since the last
  5131. // request. Use googleapi.IsNotModified to check whether the response
  5132. // error from Do is the result of In-None-Match.
  5133. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5134. c.ifNoneMatch_ = entityTag
  5135. return c
  5136. }
  5137. // Context sets the context to be used in this call's Do method. Any
  5138. // pending HTTP request will be aborted if the provided context is
  5139. // canceled.
  5140. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall {
  5141. c.ctx_ = ctx
  5142. return c
  5143. }
  5144. // Header returns an http.Header that can be modified by the caller to
  5145. // add HTTP headers to the request.
  5146. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Header() http.Header {
  5147. if c.header_ == nil {
  5148. c.header_ = make(http.Header)
  5149. }
  5150. return c.header_
  5151. }
  5152. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) doRequest(alt string) (*http.Response, error) {
  5153. reqHeaders := make(http.Header)
  5154. for k, v := range c.header_ {
  5155. reqHeaders[k] = v
  5156. }
  5157. reqHeaders.Set("User-Agent", c.s.userAgent())
  5158. if c.ifNoneMatch_ != "" {
  5159. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5160. }
  5161. var body io.Reader = nil
  5162. c.urlParams_.Set("alt", alt)
  5163. c.urlParams_.Set("prettyPrint", "false")
  5164. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeyVersions")
  5165. urls += "?" + c.urlParams_.Encode()
  5166. req, err := http.NewRequest("GET", urls, body)
  5167. if err != nil {
  5168. return nil, err
  5169. }
  5170. req.Header = reqHeaders
  5171. googleapi.Expand(req.URL, map[string]string{
  5172. "parent": c.parent,
  5173. })
  5174. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5175. }
  5176. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list" call.
  5177. // Exactly one of *ListCryptoKeyVersionsResponse or error will be
  5178. // non-nil. Any non-2xx status code is an error. Response headers are in
  5179. // either *ListCryptoKeyVersionsResponse.ServerResponse.Header or (if a
  5180. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5181. // googleapi.IsNotModified to check whether the returned error was
  5182. // because http.StatusNotModified was returned.
  5183. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Do(opts ...googleapi.CallOption) (*ListCryptoKeyVersionsResponse, error) {
  5184. gensupport.SetOptions(c.urlParams_, opts...)
  5185. res, err := c.doRequest("json")
  5186. if res != nil && res.StatusCode == http.StatusNotModified {
  5187. if res.Body != nil {
  5188. res.Body.Close()
  5189. }
  5190. return nil, &googleapi.Error{
  5191. Code: res.StatusCode,
  5192. Header: res.Header,
  5193. }
  5194. }
  5195. if err != nil {
  5196. return nil, err
  5197. }
  5198. defer googleapi.CloseBody(res)
  5199. if err := googleapi.CheckResponse(res); err != nil {
  5200. return nil, err
  5201. }
  5202. ret := &ListCryptoKeyVersionsResponse{
  5203. ServerResponse: googleapi.ServerResponse{
  5204. Header: res.Header,
  5205. HTTPStatusCode: res.StatusCode,
  5206. },
  5207. }
  5208. target := &ret
  5209. if err := gensupport.DecodeResponse(target, res); err != nil {
  5210. return nil, err
  5211. }
  5212. return ret, nil
  5213. // {
  5214. // "description": "Lists CryptoKeyVersions.",
  5215. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions",
  5216. // "httpMethod": "GET",
  5217. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list",
  5218. // "parameterOrder": [
  5219. // "parent"
  5220. // ],
  5221. // "parameters": {
  5222. // "pageSize": {
  5223. // "description": "Optional limit on the number of CryptoKeyVersions to\ninclude in the response. Further CryptoKeyVersions can\nsubsequently be obtained by including the\nListCryptoKeyVersionsResponse.next_page_token in a subsequent request.\nIf unspecified, the server will pick an appropriate default.",
  5224. // "format": "int32",
  5225. // "location": "query",
  5226. // "type": "integer"
  5227. // },
  5228. // "pageToken": {
  5229. // "description": "Optional pagination token, returned earlier via\nListCryptoKeyVersionsResponse.next_page_token.",
  5230. // "location": "query",
  5231. // "type": "string"
  5232. // },
  5233. // "parent": {
  5234. // "description": "Required. The resource name of the CryptoKey to list, in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*`.",
  5235. // "location": "path",
  5236. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$",
  5237. // "required": true,
  5238. // "type": "string"
  5239. // },
  5240. // "view": {
  5241. // "description": "The fields to include in the response.",
  5242. // "enum": [
  5243. // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED",
  5244. // "FULL"
  5245. // ],
  5246. // "location": "query",
  5247. // "type": "string"
  5248. // }
  5249. // },
  5250. // "path": "v1/{+parent}/cryptoKeyVersions",
  5251. // "response": {
  5252. // "$ref": "ListCryptoKeyVersionsResponse"
  5253. // },
  5254. // "scopes": [
  5255. // "https://www.googleapis.com/auth/cloud-platform",
  5256. // "https://www.googleapis.com/auth/cloudkms"
  5257. // ]
  5258. // }
  5259. }
  5260. // Pages invokes f for each page of results.
  5261. // A non-nil error returned from f will halt the iteration.
  5262. // The provided context supersedes any context provided to the Context method.
  5263. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Pages(ctx context.Context, f func(*ListCryptoKeyVersionsResponse) error) error {
  5264. c.ctx_ = ctx
  5265. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5266. for {
  5267. x, err := c.Do()
  5268. if err != nil {
  5269. return err
  5270. }
  5271. if err := f(x); err != nil {
  5272. return err
  5273. }
  5274. if x.NextPageToken == "" {
  5275. return nil
  5276. }
  5277. c.PageToken(x.NextPageToken)
  5278. }
  5279. }
  5280. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch":
  5281. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall struct {
  5282. s *Service
  5283. name string
  5284. cryptokeyversion *CryptoKeyVersion
  5285. urlParams_ gensupport.URLParams
  5286. ctx_ context.Context
  5287. header_ http.Header
  5288. }
  5289. // Patch: Update a CryptoKeyVersion's metadata.
  5290. //
  5291. // state may be changed between
  5292. // ENABLED and
  5293. // DISABLED using this
  5294. // method. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion
  5295. // to
  5296. // move between other states.
  5297. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Patch(name string, cryptokeyversion *CryptoKeyVersion) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall {
  5298. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5299. c.name = name
  5300. c.cryptokeyversion = cryptokeyversion
  5301. return c
  5302. }
  5303. // UpdateMask sets the optional parameter "updateMask": Required list of
  5304. // fields to be updated in this request.
  5305. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall {
  5306. c.urlParams_.Set("updateMask", updateMask)
  5307. return c
  5308. }
  5309. // Fields allows partial responses to be retrieved. See
  5310. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5311. // for more information.
  5312. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall {
  5313. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5314. return c
  5315. }
  5316. // Context sets the context to be used in this call's Do method. Any
  5317. // pending HTTP request will be aborted if the provided context is
  5318. // canceled.
  5319. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall {
  5320. c.ctx_ = ctx
  5321. return c
  5322. }
  5323. // Header returns an http.Header that can be modified by the caller to
  5324. // add HTTP headers to the request.
  5325. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Header() http.Header {
  5326. if c.header_ == nil {
  5327. c.header_ = make(http.Header)
  5328. }
  5329. return c.header_
  5330. }
  5331. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) doRequest(alt string) (*http.Response, error) {
  5332. reqHeaders := make(http.Header)
  5333. for k, v := range c.header_ {
  5334. reqHeaders[k] = v
  5335. }
  5336. reqHeaders.Set("User-Agent", c.s.userAgent())
  5337. var body io.Reader = nil
  5338. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokeyversion)
  5339. if err != nil {
  5340. return nil, err
  5341. }
  5342. reqHeaders.Set("Content-Type", "application/json")
  5343. c.urlParams_.Set("alt", alt)
  5344. c.urlParams_.Set("prettyPrint", "false")
  5345. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5346. urls += "?" + c.urlParams_.Encode()
  5347. req, err := http.NewRequest("PATCH", urls, body)
  5348. if err != nil {
  5349. return nil, err
  5350. }
  5351. req.Header = reqHeaders
  5352. googleapi.Expand(req.URL, map[string]string{
  5353. "name": c.name,
  5354. })
  5355. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5356. }
  5357. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch" call.
  5358. // Exactly one of *CryptoKeyVersion or error will be non-nil. Any
  5359. // non-2xx status code is an error. Response headers are in either
  5360. // *CryptoKeyVersion.ServerResponse.Header or (if a response was
  5361. // returned at all) in error.(*googleapi.Error).Header. Use
  5362. // googleapi.IsNotModified to check whether the returned error was
  5363. // because http.StatusNotModified was returned.
  5364. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) {
  5365. gensupport.SetOptions(c.urlParams_, opts...)
  5366. res, err := c.doRequest("json")
  5367. if res != nil && res.StatusCode == http.StatusNotModified {
  5368. if res.Body != nil {
  5369. res.Body.Close()
  5370. }
  5371. return nil, &googleapi.Error{
  5372. Code: res.StatusCode,
  5373. Header: res.Header,
  5374. }
  5375. }
  5376. if err != nil {
  5377. return nil, err
  5378. }
  5379. defer googleapi.CloseBody(res)
  5380. if err := googleapi.CheckResponse(res); err != nil {
  5381. return nil, err
  5382. }
  5383. ret := &CryptoKeyVersion{
  5384. ServerResponse: googleapi.ServerResponse{
  5385. Header: res.Header,
  5386. HTTPStatusCode: res.StatusCode,
  5387. },
  5388. }
  5389. target := &ret
  5390. if err := gensupport.DecodeResponse(target, res); err != nil {
  5391. return nil, err
  5392. }
  5393. return ret, nil
  5394. // {
  5395. // "description": "Update a CryptoKeyVersion's metadata.\n\nstate may be changed between\nENABLED and\nDISABLED using this\nmethod. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion to\nmove between other states.",
  5396. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}",
  5397. // "httpMethod": "PATCH",
  5398. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch",
  5399. // "parameterOrder": [
  5400. // "name"
  5401. // ],
  5402. // "parameters": {
  5403. // "name": {
  5404. // "description": "Output only. The resource name for this CryptoKeyVersion in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.",
  5405. // "location": "path",
  5406. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  5407. // "required": true,
  5408. // "type": "string"
  5409. // },
  5410. // "updateMask": {
  5411. // "description": "Required list of fields to be updated in this request.",
  5412. // "format": "google-fieldmask",
  5413. // "location": "query",
  5414. // "type": "string"
  5415. // }
  5416. // },
  5417. // "path": "v1/{+name}",
  5418. // "request": {
  5419. // "$ref": "CryptoKeyVersion"
  5420. // },
  5421. // "response": {
  5422. // "$ref": "CryptoKeyVersion"
  5423. // },
  5424. // "scopes": [
  5425. // "https://www.googleapis.com/auth/cloud-platform",
  5426. // "https://www.googleapis.com/auth/cloudkms"
  5427. // ]
  5428. // }
  5429. }
  5430. // method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore":
  5431. type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall struct {
  5432. s *Service
  5433. name string
  5434. restorecryptokeyversionrequest *RestoreCryptoKeyVersionRequest
  5435. urlParams_ gensupport.URLParams
  5436. ctx_ context.Context
  5437. header_ http.Header
  5438. }
  5439. // Restore: Restore a CryptoKeyVersion in
  5440. // the
  5441. // DESTROY_SCHEDULED
  5442. // state.
  5443. //
  5444. // Upon restoration of the CryptoKeyVersion, state
  5445. // will be set to DISABLED,
  5446. // and destroy_time will be cleared.
  5447. func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Restore(name string, restorecryptokeyversionrequest *RestoreCryptoKeyVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall {
  5448. c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5449. c.name = name
  5450. c.restorecryptokeyversionrequest = restorecryptokeyversionrequest
  5451. return c
  5452. }
  5453. // Fields allows partial responses to be retrieved. See
  5454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5455. // for more information.
  5456. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall {
  5457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5458. return c
  5459. }
  5460. // Context sets the context to be used in this call's Do method. Any
  5461. // pending HTTP request will be aborted if the provided context is
  5462. // canceled.
  5463. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall {
  5464. c.ctx_ = ctx
  5465. return c
  5466. }
  5467. // Header returns an http.Header that can be modified by the caller to
  5468. // add HTTP headers to the request.
  5469. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Header() http.Header {
  5470. if c.header_ == nil {
  5471. c.header_ = make(http.Header)
  5472. }
  5473. return c.header_
  5474. }
  5475. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) doRequest(alt string) (*http.Response, error) {
  5476. reqHeaders := make(http.Header)
  5477. for k, v := range c.header_ {
  5478. reqHeaders[k] = v
  5479. }
  5480. reqHeaders.Set("User-Agent", c.s.userAgent())
  5481. var body io.Reader = nil
  5482. body, err := googleapi.WithoutDataWrapper.JSONReader(c.restorecryptokeyversionrequest)
  5483. if err != nil {
  5484. return nil, err
  5485. }
  5486. reqHeaders.Set("Content-Type", "application/json")
  5487. c.urlParams_.Set("alt", alt)
  5488. c.urlParams_.Set("prettyPrint", "false")
  5489. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:restore")
  5490. urls += "?" + c.urlParams_.Encode()
  5491. req, err := http.NewRequest("POST", urls, body)
  5492. if err != nil {
  5493. return nil, err
  5494. }
  5495. req.Header = reqHeaders
  5496. googleapi.Expand(req.URL, map[string]string{
  5497. "name": c.name,
  5498. })
  5499. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5500. }
  5501. // Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore" call.
  5502. // Exactly one of *CryptoKeyVersion or error will be non-nil. Any
  5503. // non-2xx status code is an error. Response headers are in either
  5504. // *CryptoKeyVersion.ServerResponse.Header or (if a response was
  5505. // returned at all) in error.(*googleapi.Error).Header. Use
  5506. // googleapi.IsNotModified to check whether the returned error was
  5507. // because http.StatusNotModified was returned.
  5508. func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) {
  5509. gensupport.SetOptions(c.urlParams_, opts...)
  5510. res, err := c.doRequest("json")
  5511. if res != nil && res.StatusCode == http.StatusNotModified {
  5512. if res.Body != nil {
  5513. res.Body.Close()
  5514. }
  5515. return nil, &googleapi.Error{
  5516. Code: res.StatusCode,
  5517. Header: res.Header,
  5518. }
  5519. }
  5520. if err != nil {
  5521. return nil, err
  5522. }
  5523. defer googleapi.CloseBody(res)
  5524. if err := googleapi.CheckResponse(res); err != nil {
  5525. return nil, err
  5526. }
  5527. ret := &CryptoKeyVersion{
  5528. ServerResponse: googleapi.ServerResponse{
  5529. Header: res.Header,
  5530. HTTPStatusCode: res.StatusCode,
  5531. },
  5532. }
  5533. target := &ret
  5534. if err := gensupport.DecodeResponse(target, res); err != nil {
  5535. return nil, err
  5536. }
  5537. return ret, nil
  5538. // {
  5539. // "description": "Restore a CryptoKeyVersion in the\nDESTROY_SCHEDULED\nstate.\n\nUpon restoration of the CryptoKeyVersion, state\nwill be set to DISABLED,\nand destroy_time will be cleared.",
  5540. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:restore",
  5541. // "httpMethod": "POST",
  5542. // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore",
  5543. // "parameterOrder": [
  5544. // "name"
  5545. // ],
  5546. // "parameters": {
  5547. // "name": {
  5548. // "description": "The resource name of the CryptoKeyVersion to restore.",
  5549. // "location": "path",
  5550. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$",
  5551. // "required": true,
  5552. // "type": "string"
  5553. // }
  5554. // },
  5555. // "path": "v1/{+name}:restore",
  5556. // "request": {
  5557. // "$ref": "RestoreCryptoKeyVersionRequest"
  5558. // },
  5559. // "response": {
  5560. // "$ref": "CryptoKeyVersion"
  5561. // },
  5562. // "scopes": [
  5563. // "https://www.googleapis.com/auth/cloud-platform",
  5564. // "https://www.googleapis.com/auth/cloudkms"
  5565. // ]
  5566. // }
  5567. }
  5568. // method id "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy":
  5569. type ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall struct {
  5570. s *Service
  5571. resource string
  5572. urlParams_ gensupport.URLParams
  5573. ifNoneMatch_ string
  5574. ctx_ context.Context
  5575. header_ http.Header
  5576. }
  5577. // GetIamPolicy: Gets the access control policy for a resource.
  5578. // Returns an empty policy if the resource exists and does not have a
  5579. // policy
  5580. // set.
  5581. func (r *ProjectsLocationsKeyRingsImportJobsService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall {
  5582. c := &ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5583. c.resource = resource
  5584. return c
  5585. }
  5586. // Fields allows partial responses to be retrieved. See
  5587. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5588. // for more information.
  5589. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall {
  5590. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5591. return c
  5592. }
  5593. // IfNoneMatch sets the optional parameter which makes the operation
  5594. // fail if the object's ETag matches the given value. This is useful for
  5595. // getting updates only after the object has changed since the last
  5596. // request. Use googleapi.IsNotModified to check whether the response
  5597. // error from Do is the result of In-None-Match.
  5598. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall {
  5599. c.ifNoneMatch_ = entityTag
  5600. return c
  5601. }
  5602. // Context sets the context to be used in this call's Do method. Any
  5603. // pending HTTP request will be aborted if the provided context is
  5604. // canceled.
  5605. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall {
  5606. c.ctx_ = ctx
  5607. return c
  5608. }
  5609. // Header returns an http.Header that can be modified by the caller to
  5610. // add HTTP headers to the request.
  5611. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Header() http.Header {
  5612. if c.header_ == nil {
  5613. c.header_ = make(http.Header)
  5614. }
  5615. return c.header_
  5616. }
  5617. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5618. reqHeaders := make(http.Header)
  5619. for k, v := range c.header_ {
  5620. reqHeaders[k] = v
  5621. }
  5622. reqHeaders.Set("User-Agent", c.s.userAgent())
  5623. if c.ifNoneMatch_ != "" {
  5624. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5625. }
  5626. var body io.Reader = nil
  5627. c.urlParams_.Set("alt", alt)
  5628. c.urlParams_.Set("prettyPrint", "false")
  5629. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  5630. urls += "?" + c.urlParams_.Encode()
  5631. req, err := http.NewRequest("GET", urls, body)
  5632. if err != nil {
  5633. return nil, err
  5634. }
  5635. req.Header = reqHeaders
  5636. googleapi.Expand(req.URL, map[string]string{
  5637. "resource": c.resource,
  5638. })
  5639. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5640. }
  5641. // Do executes the "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy" call.
  5642. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5643. // code is an error. Response headers are in either
  5644. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5645. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5646. // check whether the returned error was because http.StatusNotModified
  5647. // was returned.
  5648. func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5649. gensupport.SetOptions(c.urlParams_, opts...)
  5650. res, err := c.doRequest("json")
  5651. if res != nil && res.StatusCode == http.StatusNotModified {
  5652. if res.Body != nil {
  5653. res.Body.Close()
  5654. }
  5655. return nil, &googleapi.Error{
  5656. Code: res.StatusCode,
  5657. Header: res.Header,
  5658. }
  5659. }
  5660. if err != nil {
  5661. return nil, err
  5662. }
  5663. defer googleapi.CloseBody(res)
  5664. if err := googleapi.CheckResponse(res); err != nil {
  5665. return nil, err
  5666. }
  5667. ret := &Policy{
  5668. ServerResponse: googleapi.ServerResponse{
  5669. Header: res.Header,
  5670. HTTPStatusCode: res.StatusCode,
  5671. },
  5672. }
  5673. target := &ret
  5674. if err := gensupport.DecodeResponse(target, res); err != nil {
  5675. return nil, err
  5676. }
  5677. return ret, nil
  5678. // {
  5679. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  5680. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:getIamPolicy",
  5681. // "httpMethod": "GET",
  5682. // "id": "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy",
  5683. // "parameterOrder": [
  5684. // "resource"
  5685. // ],
  5686. // "parameters": {
  5687. // "resource": {
  5688. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5689. // "location": "path",
  5690. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$",
  5691. // "required": true,
  5692. // "type": "string"
  5693. // }
  5694. // },
  5695. // "path": "v1/{+resource}:getIamPolicy",
  5696. // "response": {
  5697. // "$ref": "Policy"
  5698. // },
  5699. // "scopes": [
  5700. // "https://www.googleapis.com/auth/cloud-platform",
  5701. // "https://www.googleapis.com/auth/cloudkms"
  5702. // ]
  5703. // }
  5704. }
  5705. // method id "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy":
  5706. type ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall struct {
  5707. s *Service
  5708. resource string
  5709. setiampolicyrequest *SetIamPolicyRequest
  5710. urlParams_ gensupport.URLParams
  5711. ctx_ context.Context
  5712. header_ http.Header
  5713. }
  5714. // SetIamPolicy: Sets the access control policy on the specified
  5715. // resource. Replaces any
  5716. // existing policy.
  5717. func (r *ProjectsLocationsKeyRingsImportJobsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall {
  5718. c := &ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5719. c.resource = resource
  5720. c.setiampolicyrequest = setiampolicyrequest
  5721. return c
  5722. }
  5723. // Fields allows partial responses to be retrieved. See
  5724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5725. // for more information.
  5726. func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall {
  5727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5728. return c
  5729. }
  5730. // Context sets the context to be used in this call's Do method. Any
  5731. // pending HTTP request will be aborted if the provided context is
  5732. // canceled.
  5733. func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall {
  5734. c.ctx_ = ctx
  5735. return c
  5736. }
  5737. // Header returns an http.Header that can be modified by the caller to
  5738. // add HTTP headers to the request.
  5739. func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Header() http.Header {
  5740. if c.header_ == nil {
  5741. c.header_ = make(http.Header)
  5742. }
  5743. return c.header_
  5744. }
  5745. func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5746. reqHeaders := make(http.Header)
  5747. for k, v := range c.header_ {
  5748. reqHeaders[k] = v
  5749. }
  5750. reqHeaders.Set("User-Agent", c.s.userAgent())
  5751. var body io.Reader = nil
  5752. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5753. if err != nil {
  5754. return nil, err
  5755. }
  5756. reqHeaders.Set("Content-Type", "application/json")
  5757. c.urlParams_.Set("alt", alt)
  5758. c.urlParams_.Set("prettyPrint", "false")
  5759. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5760. urls += "?" + c.urlParams_.Encode()
  5761. req, err := http.NewRequest("POST", urls, body)
  5762. if err != nil {
  5763. return nil, err
  5764. }
  5765. req.Header = reqHeaders
  5766. googleapi.Expand(req.URL, map[string]string{
  5767. "resource": c.resource,
  5768. })
  5769. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5770. }
  5771. // Do executes the "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy" call.
  5772. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5773. // code is an error. Response headers are in either
  5774. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5775. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5776. // check whether the returned error was because http.StatusNotModified
  5777. // was returned.
  5778. func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5779. gensupport.SetOptions(c.urlParams_, opts...)
  5780. res, err := c.doRequest("json")
  5781. if res != nil && res.StatusCode == http.StatusNotModified {
  5782. if res.Body != nil {
  5783. res.Body.Close()
  5784. }
  5785. return nil, &googleapi.Error{
  5786. Code: res.StatusCode,
  5787. Header: res.Header,
  5788. }
  5789. }
  5790. if err != nil {
  5791. return nil, err
  5792. }
  5793. defer googleapi.CloseBody(res)
  5794. if err := googleapi.CheckResponse(res); err != nil {
  5795. return nil, err
  5796. }
  5797. ret := &Policy{
  5798. ServerResponse: googleapi.ServerResponse{
  5799. Header: res.Header,
  5800. HTTPStatusCode: res.StatusCode,
  5801. },
  5802. }
  5803. target := &ret
  5804. if err := gensupport.DecodeResponse(target, res); err != nil {
  5805. return nil, err
  5806. }
  5807. return ret, nil
  5808. // {
  5809. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  5810. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:setIamPolicy",
  5811. // "httpMethod": "POST",
  5812. // "id": "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy",
  5813. // "parameterOrder": [
  5814. // "resource"
  5815. // ],
  5816. // "parameters": {
  5817. // "resource": {
  5818. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  5819. // "location": "path",
  5820. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$",
  5821. // "required": true,
  5822. // "type": "string"
  5823. // }
  5824. // },
  5825. // "path": "v1/{+resource}:setIamPolicy",
  5826. // "request": {
  5827. // "$ref": "SetIamPolicyRequest"
  5828. // },
  5829. // "response": {
  5830. // "$ref": "Policy"
  5831. // },
  5832. // "scopes": [
  5833. // "https://www.googleapis.com/auth/cloud-platform",
  5834. // "https://www.googleapis.com/auth/cloudkms"
  5835. // ]
  5836. // }
  5837. }
  5838. // method id "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions":
  5839. type ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall struct {
  5840. s *Service
  5841. resource string
  5842. testiampermissionsrequest *TestIamPermissionsRequest
  5843. urlParams_ gensupport.URLParams
  5844. ctx_ context.Context
  5845. header_ http.Header
  5846. }
  5847. // TestIamPermissions: Returns permissions that a caller has on the
  5848. // specified resource.
  5849. // If the resource does not exist, this will return an empty set
  5850. // of
  5851. // permissions, not a NOT_FOUND error.
  5852. //
  5853. // Note: This operation is designed to be used for building
  5854. // permission-aware
  5855. // UIs and command-line tools, not for authorization checking. This
  5856. // operation
  5857. // may "fail open" without warning.
  5858. func (r *ProjectsLocationsKeyRingsImportJobsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall {
  5859. c := &ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5860. c.resource = resource
  5861. c.testiampermissionsrequest = testiampermissionsrequest
  5862. return c
  5863. }
  5864. // Fields allows partial responses to be retrieved. See
  5865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5866. // for more information.
  5867. func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall {
  5868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5869. return c
  5870. }
  5871. // Context sets the context to be used in this call's Do method. Any
  5872. // pending HTTP request will be aborted if the provided context is
  5873. // canceled.
  5874. func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall {
  5875. c.ctx_ = ctx
  5876. return c
  5877. }
  5878. // Header returns an http.Header that can be modified by the caller to
  5879. // add HTTP headers to the request.
  5880. func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Header() http.Header {
  5881. if c.header_ == nil {
  5882. c.header_ = make(http.Header)
  5883. }
  5884. return c.header_
  5885. }
  5886. func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5887. reqHeaders := make(http.Header)
  5888. for k, v := range c.header_ {
  5889. reqHeaders[k] = v
  5890. }
  5891. reqHeaders.Set("User-Agent", c.s.userAgent())
  5892. var body io.Reader = nil
  5893. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5894. if err != nil {
  5895. return nil, err
  5896. }
  5897. reqHeaders.Set("Content-Type", "application/json")
  5898. c.urlParams_.Set("alt", alt)
  5899. c.urlParams_.Set("prettyPrint", "false")
  5900. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5901. urls += "?" + c.urlParams_.Encode()
  5902. req, err := http.NewRequest("POST", urls, body)
  5903. if err != nil {
  5904. return nil, err
  5905. }
  5906. req.Header = reqHeaders
  5907. googleapi.Expand(req.URL, map[string]string{
  5908. "resource": c.resource,
  5909. })
  5910. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5911. }
  5912. // Do executes the "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions" call.
  5913. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5914. // Any non-2xx status code is an error. Response headers are in either
  5915. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5916. // was returned at all) in error.(*googleapi.Error).Header. Use
  5917. // googleapi.IsNotModified to check whether the returned error was
  5918. // because http.StatusNotModified was returned.
  5919. func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5920. gensupport.SetOptions(c.urlParams_, opts...)
  5921. res, err := c.doRequest("json")
  5922. if res != nil && res.StatusCode == http.StatusNotModified {
  5923. if res.Body != nil {
  5924. res.Body.Close()
  5925. }
  5926. return nil, &googleapi.Error{
  5927. Code: res.StatusCode,
  5928. Header: res.Header,
  5929. }
  5930. }
  5931. if err != nil {
  5932. return nil, err
  5933. }
  5934. defer googleapi.CloseBody(res)
  5935. if err := googleapi.CheckResponse(res); err != nil {
  5936. return nil, err
  5937. }
  5938. ret := &TestIamPermissionsResponse{
  5939. ServerResponse: googleapi.ServerResponse{
  5940. Header: res.Header,
  5941. HTTPStatusCode: res.StatusCode,
  5942. },
  5943. }
  5944. target := &ret
  5945. if err := gensupport.DecodeResponse(target, res); err != nil {
  5946. return nil, err
  5947. }
  5948. return ret, nil
  5949. // {
  5950. // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
  5951. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:testIamPermissions",
  5952. // "httpMethod": "POST",
  5953. // "id": "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions",
  5954. // "parameterOrder": [
  5955. // "resource"
  5956. // ],
  5957. // "parameters": {
  5958. // "resource": {
  5959. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5960. // "location": "path",
  5961. // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$",
  5962. // "required": true,
  5963. // "type": "string"
  5964. // }
  5965. // },
  5966. // "path": "v1/{+resource}:testIamPermissions",
  5967. // "request": {
  5968. // "$ref": "TestIamPermissionsRequest"
  5969. // },
  5970. // "response": {
  5971. // "$ref": "TestIamPermissionsResponse"
  5972. // },
  5973. // "scopes": [
  5974. // "https://www.googleapis.com/auth/cloud-platform",
  5975. // "https://www.googleapis.com/auth/cloudkms"
  5976. // ]
  5977. // }
  5978. }