Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

2847 řádky
96 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 binaryauthorization provides access to the Binary Authorization API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/binary-authorization/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/binaryauthorization/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // binaryauthorizationService, err := binaryauthorization.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // binaryauthorizationService, err := binaryauthorization.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // binaryauthorizationService, err := binaryauthorization.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package binaryauthorization // import "google.golang.org/api/binaryauthorization/v1beta1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "binaryauthorization:v1beta1"
  67. const apiName = "binaryauthorization"
  68. const apiVersion = "v1beta1"
  69. const basePath = "https://binaryauthorization.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.Attestors = NewProjectsAttestorsService(s)
  123. rs.Policy = NewProjectsPolicyService(s)
  124. return rs
  125. }
  126. type ProjectsService struct {
  127. s *Service
  128. Attestors *ProjectsAttestorsService
  129. Policy *ProjectsPolicyService
  130. }
  131. func NewProjectsAttestorsService(s *Service) *ProjectsAttestorsService {
  132. rs := &ProjectsAttestorsService{s: s}
  133. return rs
  134. }
  135. type ProjectsAttestorsService struct {
  136. s *Service
  137. }
  138. func NewProjectsPolicyService(s *Service) *ProjectsPolicyService {
  139. rs := &ProjectsPolicyService{s: s}
  140. return rs
  141. }
  142. type ProjectsPolicyService struct {
  143. s *Service
  144. }
  145. // AdmissionRule: An admission rule specifies either that all container
  146. // images
  147. // used in a pod creation request must be attested to by one or
  148. // more
  149. // attestors, that all pod creations will be allowed, or that all
  150. // pod creations will be denied.
  151. //
  152. // Images matching an admission whitelist pattern
  153. // are exempted from admission rules and will never block a pod
  154. // creation.
  155. type AdmissionRule struct {
  156. // EnforcementMode: Required. The action when a pod creation is denied
  157. // by the admission rule.
  158. //
  159. // Possible values:
  160. // "ENFORCEMENT_MODE_UNSPECIFIED" - Do not use.
  161. // "ENFORCED_BLOCK_AND_AUDIT_LOG" - Enforce the admission rule by
  162. // blocking the pod creation.
  163. // "DRYRUN_AUDIT_LOG_ONLY" - Dryrun mode: Audit logging only. This
  164. // will allow the pod creation as if
  165. // the admission request had specified break-glass.
  166. EnforcementMode string `json:"enforcementMode,omitempty"`
  167. // EvaluationMode: Required. How this admission rule will be evaluated.
  168. //
  169. // Possible values:
  170. // "EVALUATION_MODE_UNSPECIFIED" - Do not use.
  171. // "ALWAYS_ALLOW" - This rule allows all all pod creations.
  172. // "REQUIRE_ATTESTATION" - This rule allows a pod creation if all the
  173. // attestors listed in
  174. // 'require_attestations_by' have valid attestations for all of
  175. // the
  176. // images in the pod spec.
  177. // "ALWAYS_DENY" - This rule denies all pod creations.
  178. EvaluationMode string `json:"evaluationMode,omitempty"`
  179. // RequireAttestationsBy: Optional. The resource names of the attestors
  180. // that must attest to
  181. // a container image, in the format `projects/*/attestors/*`.
  182. // Each
  183. // attestor must exist before a policy can reference it. To add an
  184. // attestor
  185. // to a policy the principal issuing the policy change request must be
  186. // able
  187. // to read the attestor resource.
  188. //
  189. // Note: this field must be non-empty when the evaluation_mode field
  190. // specifies
  191. // REQUIRE_ATTESTATION, otherwise it must be empty.
  192. RequireAttestationsBy []string `json:"requireAttestationsBy,omitempty"`
  193. // ForceSendFields is a list of field names (e.g. "EnforcementMode") to
  194. // unconditionally include in API requests. By default, fields with
  195. // empty values are omitted from API requests. However, any non-pointer,
  196. // non-interface field appearing in ForceSendFields will be sent to the
  197. // server regardless of whether the field is empty or not. This may be
  198. // used to include empty fields in Patch requests.
  199. ForceSendFields []string `json:"-"`
  200. // NullFields is a list of field names (e.g. "EnforcementMode") to
  201. // include in API requests with the JSON null value. By default, fields
  202. // with empty values are omitted from API requests. However, any field
  203. // with an empty value appearing in NullFields will be sent to the
  204. // server as null. It is an error if a field in this list has a
  205. // non-empty value. This may be used to include null fields in Patch
  206. // requests.
  207. NullFields []string `json:"-"`
  208. }
  209. func (s *AdmissionRule) MarshalJSON() ([]byte, error) {
  210. type NoMethod AdmissionRule
  211. raw := NoMethod(*s)
  212. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  213. }
  214. // AdmissionWhitelistPattern: An admission whitelist pattern exempts
  215. // images
  216. // from checks by admission rules.
  217. type AdmissionWhitelistPattern struct {
  218. // NamePattern: An image name pattern to whitelist, in the form
  219. // `registry/path/to/image`.
  220. // This supports a trailing `*` as a wildcard, but this is allowed only
  221. // in
  222. // text after the `registry/` part.
  223. NamePattern string `json:"namePattern,omitempty"`
  224. // ForceSendFields is a list of field names (e.g. "NamePattern") to
  225. // unconditionally include in API requests. By default, fields with
  226. // empty values are omitted from API requests. However, any non-pointer,
  227. // non-interface field appearing in ForceSendFields will be sent to the
  228. // server regardless of whether the field is empty or not. This may be
  229. // used to include empty fields in Patch requests.
  230. ForceSendFields []string `json:"-"`
  231. // NullFields is a list of field names (e.g. "NamePattern") to include
  232. // in API requests with the JSON null value. By default, fields with
  233. // empty values are omitted from API requests. However, any field with
  234. // an empty value appearing in NullFields will be sent to the server as
  235. // null. It is an error if a field in this list has a non-empty value.
  236. // This may be used to include null fields in Patch requests.
  237. NullFields []string `json:"-"`
  238. }
  239. func (s *AdmissionWhitelistPattern) MarshalJSON() ([]byte, error) {
  240. type NoMethod AdmissionWhitelistPattern
  241. raw := NoMethod(*s)
  242. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  243. }
  244. // Attestor: An attestor that attests to container image
  245. // artifacts. An existing attestor cannot be modified except
  246. // where
  247. // indicated.
  248. type Attestor struct {
  249. // Description: Optional. A descriptive comment. This field may be
  250. // updated.
  251. // The field may be displayed in chooser dialogs.
  252. Description string `json:"description,omitempty"`
  253. // Name: Required. The resource name, in the
  254. // format:
  255. // `projects/*/attestors/*`. This field may not be updated.
  256. Name string `json:"name,omitempty"`
  257. // UpdateTime: Output only. Time when the attestor was last updated.
  258. UpdateTime string `json:"updateTime,omitempty"`
  259. // UserOwnedDrydockNote: A Drydock ATTESTATION_AUTHORITY Note, created
  260. // by the user.
  261. UserOwnedDrydockNote *UserOwnedDrydockNote `json:"userOwnedDrydockNote,omitempty"`
  262. // ServerResponse contains the HTTP response code and headers from the
  263. // server.
  264. googleapi.ServerResponse `json:"-"`
  265. // ForceSendFields is a list of field names (e.g. "Description") to
  266. // unconditionally include in API requests. By default, fields with
  267. // empty values are omitted from API requests. However, any non-pointer,
  268. // non-interface field appearing in ForceSendFields will be sent to the
  269. // server regardless of whether the field is empty or not. This may be
  270. // used to include empty fields in Patch requests.
  271. ForceSendFields []string `json:"-"`
  272. // NullFields is a list of field names (e.g. "Description") to include
  273. // in API requests with the JSON null value. By default, fields with
  274. // empty values are omitted from API requests. However, any field with
  275. // an empty value appearing in NullFields will be sent to the server as
  276. // null. It is an error if a field in this list has a non-empty value.
  277. // This may be used to include null fields in Patch requests.
  278. NullFields []string `json:"-"`
  279. }
  280. func (s *Attestor) MarshalJSON() ([]byte, error) {
  281. type NoMethod Attestor
  282. raw := NoMethod(*s)
  283. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  284. }
  285. // AttestorPublicKey: An attestor public key that will be used to
  286. // verify
  287. // attestations signed by this attestor.
  288. type AttestorPublicKey struct {
  289. // AsciiArmoredPgpPublicKey: ASCII-armored representation of a PGP
  290. // public key, as the entire output by
  291. // the command `gpg --export --armor foo@example.com` (either LF or
  292. // CRLF
  293. // line endings).
  294. // When using this field, `id` should be left blank. The BinAuthz
  295. // API
  296. // handlers will calculate the ID and fill it in automatically.
  297. // BinAuthz
  298. // computes this ID as the OpenPGP RFC4880 V4 fingerprint, represented
  299. // as
  300. // upper-case hex. If `id` is provided by the caller, it will
  301. // be
  302. // overwritten by the API-calculated ID.
  303. AsciiArmoredPgpPublicKey string `json:"asciiArmoredPgpPublicKey,omitempty"`
  304. // Comment: Optional. A descriptive comment. This field may be updated.
  305. Comment string `json:"comment,omitempty"`
  306. // Id: The ID of this public key.
  307. // Signatures verified by BinAuthz must include the ID of the public key
  308. // that
  309. // can be used to verify them, and that ID must match the contents of
  310. // this
  311. // field exactly.
  312. // Additional restrictions on this field can be imposed based on which
  313. // public
  314. // key type is encapsulated. See the documentation on `public_key` cases
  315. // below
  316. // for details.
  317. Id string `json:"id,omitempty"`
  318. // ForceSendFields is a list of field names (e.g.
  319. // "AsciiArmoredPgpPublicKey") to unconditionally include in API
  320. // requests. By default, fields with empty values are omitted from API
  321. // requests. However, any non-pointer, non-interface field appearing in
  322. // ForceSendFields will be sent to the server regardless of whether the
  323. // field is empty or not. This may be used to include empty fields in
  324. // Patch requests.
  325. ForceSendFields []string `json:"-"`
  326. // NullFields is a list of field names (e.g. "AsciiArmoredPgpPublicKey")
  327. // to include in API requests with the JSON null value. By default,
  328. // fields with empty values are omitted from API requests. However, any
  329. // field with an empty value appearing in NullFields will be sent to the
  330. // server as null. It is an error if a field in this list has a
  331. // non-empty value. This may be used to include null fields in Patch
  332. // requests.
  333. NullFields []string `json:"-"`
  334. }
  335. func (s *AttestorPublicKey) MarshalJSON() ([]byte, error) {
  336. type NoMethod AttestorPublicKey
  337. raw := NoMethod(*s)
  338. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  339. }
  340. // Binding: Associates `members` with a `role`.
  341. type Binding struct {
  342. // Condition: Unimplemented. The condition that is associated with this
  343. // binding.
  344. // NOTE: an unsatisfied condition will not allow user access via
  345. // current
  346. // binding. Different bindings, including their conditions, are
  347. // examined
  348. // independently.
  349. Condition *Expr `json:"condition,omitempty"`
  350. // Members: Specifies the identities requesting access for a Cloud
  351. // Platform resource.
  352. // `members` can have the following values:
  353. //
  354. // * `allUsers`: A special identifier that represents anyone who is
  355. // on the internet; with or without a Google account.
  356. //
  357. // * `allAuthenticatedUsers`: A special identifier that represents
  358. // anyone
  359. // who is authenticated with a Google account or a service
  360. // account.
  361. //
  362. // * `user:{emailid}`: An email address that represents a specific
  363. // Google
  364. // account. For example, `alice@gmail.com` .
  365. //
  366. //
  367. // * `serviceAccount:{emailid}`: An email address that represents a
  368. // service
  369. // account. For example,
  370. // `my-other-app@appspot.gserviceaccount.com`.
  371. //
  372. // * `group:{emailid}`: An email address that represents a Google
  373. // group.
  374. // For example, `admins@example.com`.
  375. //
  376. //
  377. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  378. // the
  379. // users of that domain. For example, `google.com` or
  380. // `example.com`.
  381. //
  382. //
  383. Members []string `json:"members,omitempty"`
  384. // Role: Role that is assigned to `members`.
  385. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  386. Role string `json:"role,omitempty"`
  387. // ForceSendFields is a list of field names (e.g. "Condition") to
  388. // unconditionally include in API requests. By default, fields with
  389. // empty values are omitted from API requests. However, any non-pointer,
  390. // non-interface field appearing in ForceSendFields will be sent to the
  391. // server regardless of whether the field is empty or not. This may be
  392. // used to include empty fields in Patch requests.
  393. ForceSendFields []string `json:"-"`
  394. // NullFields is a list of field names (e.g. "Condition") to include in
  395. // API requests with the JSON null value. By default, fields with empty
  396. // values are omitted from API requests. However, any field with an
  397. // empty value appearing in NullFields will be sent to the server as
  398. // null. It is an error if a field in this list has a non-empty value.
  399. // This may be used to include null fields in Patch requests.
  400. NullFields []string `json:"-"`
  401. }
  402. func (s *Binding) MarshalJSON() ([]byte, error) {
  403. type NoMethod Binding
  404. raw := NoMethod(*s)
  405. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  406. }
  407. // Empty: A generic empty message that you can re-use to avoid defining
  408. // duplicated
  409. // empty messages in your APIs. A typical example is to use it as the
  410. // request
  411. // or the response type of an API method. For instance:
  412. //
  413. // service Foo {
  414. // rpc Bar(google.protobuf.Empty) returns
  415. // (google.protobuf.Empty);
  416. // }
  417. //
  418. // The JSON representation for `Empty` is empty JSON object `{}`.
  419. type Empty struct {
  420. // ServerResponse contains the HTTP response code and headers from the
  421. // server.
  422. googleapi.ServerResponse `json:"-"`
  423. }
  424. // Expr: Represents an expression text. Example:
  425. //
  426. // title: "User account presence"
  427. // description: "Determines whether the request has a user account"
  428. // expression: "size(request.user) > 0"
  429. type Expr struct {
  430. // Description: An optional description of the expression. This is a
  431. // longer text which
  432. // describes the expression, e.g. when hovered over it in a UI.
  433. Description string `json:"description,omitempty"`
  434. // Expression: Textual representation of an expression in
  435. // Common Expression Language syntax.
  436. //
  437. // The application context of the containing message determines
  438. // which
  439. // well-known feature set of CEL is supported.
  440. Expression string `json:"expression,omitempty"`
  441. // Location: An optional string indicating the location of the
  442. // expression for error
  443. // reporting, e.g. a file name and a position in the file.
  444. Location string `json:"location,omitempty"`
  445. // Title: An optional title for the expression, i.e. a short string
  446. // describing
  447. // its purpose. This can be used e.g. in UIs which allow to enter
  448. // the
  449. // expression.
  450. Title string `json:"title,omitempty"`
  451. // ForceSendFields is a list of field names (e.g. "Description") to
  452. // unconditionally include in API requests. By default, fields with
  453. // empty values are omitted from API requests. However, any non-pointer,
  454. // non-interface field appearing in ForceSendFields will be sent to the
  455. // server regardless of whether the field is empty or not. This may be
  456. // used to include empty fields in Patch requests.
  457. ForceSendFields []string `json:"-"`
  458. // NullFields is a list of field names (e.g. "Description") to include
  459. // in API requests with the JSON null value. By default, fields with
  460. // empty values are omitted from API requests. However, any field with
  461. // an empty value appearing in NullFields will be sent to the server as
  462. // null. It is an error if a field in this list has a non-empty value.
  463. // This may be used to include null fields in Patch requests.
  464. NullFields []string `json:"-"`
  465. }
  466. func (s *Expr) MarshalJSON() ([]byte, error) {
  467. type NoMethod Expr
  468. raw := NoMethod(*s)
  469. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  470. }
  471. // IamPolicy: Defines an Identity and Access Management (IAM) policy. It
  472. // is used to
  473. // specify access control policies for Cloud Platform resources.
  474. //
  475. //
  476. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  477. // of
  478. // `members` to a `role`, where the members can be user accounts, Google
  479. // groups,
  480. // Google domains, and service accounts. A `role` is a named list of
  481. // permissions
  482. // defined by IAM.
  483. //
  484. // **JSON Example**
  485. //
  486. // {
  487. // "bindings": [
  488. // {
  489. // "role": "roles/owner",
  490. // "members": [
  491. // "user:mike@example.com",
  492. // "group:admins@example.com",
  493. // "domain:google.com",
  494. //
  495. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  496. // ]
  497. // },
  498. // {
  499. // "role": "roles/viewer",
  500. // "members": ["user:sean@example.com"]
  501. // }
  502. // ]
  503. // }
  504. //
  505. // **YAML Example**
  506. //
  507. // bindings:
  508. // - members:
  509. // - user:mike@example.com
  510. // - group:admins@example.com
  511. // - domain:google.com
  512. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  513. // role: roles/owner
  514. // - members:
  515. // - user:sean@example.com
  516. // role: roles/viewer
  517. //
  518. //
  519. // For a description of IAM and its features, see the
  520. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  521. type IamPolicy struct {
  522. // Bindings: Associates a list of `members` to a `role`.
  523. // `bindings` with no members will result in an error.
  524. Bindings []*Binding `json:"bindings,omitempty"`
  525. // Etag: `etag` is used for optimistic concurrency control as a way to
  526. // help
  527. // prevent simultaneous updates of a policy from overwriting each
  528. // other.
  529. // It is strongly suggested that systems make use of the `etag` in
  530. // the
  531. // read-modify-write cycle to perform policy updates in order to avoid
  532. // race
  533. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  534. // and
  535. // systems are expected to put that etag in the request to
  536. // `setIamPolicy` to
  537. // ensure that their change will be applied to the same version of the
  538. // policy.
  539. //
  540. // If no `etag` is provided in the call to `setIamPolicy`, then the
  541. // existing
  542. // policy is overwritten blindly.
  543. Etag string `json:"etag,omitempty"`
  544. // Version: Deprecated.
  545. Version int64 `json:"version,omitempty"`
  546. // ServerResponse contains the HTTP response code and headers from the
  547. // server.
  548. googleapi.ServerResponse `json:"-"`
  549. // ForceSendFields is a list of field names (e.g. "Bindings") to
  550. // unconditionally include in API requests. By default, fields with
  551. // empty values are omitted from API requests. However, any non-pointer,
  552. // non-interface field appearing in ForceSendFields will be sent to the
  553. // server regardless of whether the field is empty or not. This may be
  554. // used to include empty fields in Patch requests.
  555. ForceSendFields []string `json:"-"`
  556. // NullFields is a list of field names (e.g. "Bindings") to include in
  557. // API requests with the JSON null value. By default, fields with empty
  558. // values are omitted from API requests. However, any field with an
  559. // empty value appearing in NullFields will be sent to the server as
  560. // null. It is an error if a field in this list has a non-empty value.
  561. // This may be used to include null fields in Patch requests.
  562. NullFields []string `json:"-"`
  563. }
  564. func (s *IamPolicy) MarshalJSON() ([]byte, error) {
  565. type NoMethod IamPolicy
  566. raw := NoMethod(*s)
  567. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  568. }
  569. // ListAttestorsResponse: Response message for
  570. // BinauthzManagementService.ListAttestors.
  571. type ListAttestorsResponse struct {
  572. // Attestors: The list of attestors.
  573. Attestors []*Attestor `json:"attestors,omitempty"`
  574. // NextPageToken: A token to retrieve the next page of results. Pass
  575. // this value in the
  576. // ListAttestorsRequest.page_token field in the subsequent call to
  577. // the
  578. // `ListAttestors` method to retrieve the next page of results.
  579. NextPageToken string `json:"nextPageToken,omitempty"`
  580. // ServerResponse contains the HTTP response code and headers from the
  581. // server.
  582. googleapi.ServerResponse `json:"-"`
  583. // ForceSendFields is a list of field names (e.g. "Attestors") to
  584. // unconditionally include in API requests. By default, fields with
  585. // empty values are omitted from API requests. However, any non-pointer,
  586. // non-interface field appearing in ForceSendFields will be sent to the
  587. // server regardless of whether the field is empty or not. This may be
  588. // used to include empty fields in Patch requests.
  589. ForceSendFields []string `json:"-"`
  590. // NullFields is a list of field names (e.g. "Attestors") to include in
  591. // API requests with the JSON null value. By default, fields with empty
  592. // values are omitted from API requests. However, any field with an
  593. // empty value appearing in NullFields will be sent to the server as
  594. // null. It is an error if a field in this list has a non-empty value.
  595. // This may be used to include null fields in Patch requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *ListAttestorsResponse) MarshalJSON() ([]byte, error) {
  599. type NoMethod ListAttestorsResponse
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. // Policy: A policy for container image binary authorization.
  604. type Policy struct {
  605. // AdmissionWhitelistPatterns: Optional. Admission policy whitelisting.
  606. // A matching admission request will
  607. // always be permitted. This feature is typically used to exclude Google
  608. // or
  609. // third-party infrastructure images from Binary Authorization policies.
  610. AdmissionWhitelistPatterns []*AdmissionWhitelistPattern `json:"admissionWhitelistPatterns,omitempty"`
  611. // ClusterAdmissionRules: Optional. Per-cluster admission rules. Cluster
  612. // spec format:
  613. // `location.clusterId`. There can be at most one admission rule per
  614. // cluster
  615. // spec.
  616. // A `location` is either a compute zone (e.g. us-central1-a) or a
  617. // region
  618. // (e.g. us-central1).
  619. // For `clusterId` syntax restrictions
  620. // see
  621. // https://cloud.google.com/container-engine/reference/rest/v1/projec
  622. // ts.zones.clusters.
  623. ClusterAdmissionRules map[string]AdmissionRule `json:"clusterAdmissionRules,omitempty"`
  624. // DefaultAdmissionRule: Required. Default admission rule for a cluster
  625. // without a per-cluster, per-
  626. // kubernetes-service-account, or per-istio-service-identity admission
  627. // rule.
  628. DefaultAdmissionRule *AdmissionRule `json:"defaultAdmissionRule,omitempty"`
  629. // Description: Optional. A descriptive comment.
  630. Description string `json:"description,omitempty"`
  631. // Name: Output only. The resource name, in the format
  632. // `projects/*/policy`. There is
  633. // at most one policy per project.
  634. Name string `json:"name,omitempty"`
  635. // UpdateTime: Output only. Time when the policy was last updated.
  636. UpdateTime string `json:"updateTime,omitempty"`
  637. // ServerResponse contains the HTTP response code and headers from the
  638. // server.
  639. googleapi.ServerResponse `json:"-"`
  640. // ForceSendFields is a list of field names (e.g.
  641. // "AdmissionWhitelistPatterns") to unconditionally include in API
  642. // requests. By default, fields with empty values are omitted from API
  643. // requests. However, any non-pointer, non-interface field appearing in
  644. // ForceSendFields will be sent to the server regardless of whether the
  645. // field is empty or not. This may be used to include empty fields in
  646. // Patch requests.
  647. ForceSendFields []string `json:"-"`
  648. // NullFields is a list of field names (e.g.
  649. // "AdmissionWhitelistPatterns") to include in API requests with the
  650. // JSON null value. By default, fields with empty values are omitted
  651. // from API requests. However, any field with an empty value appearing
  652. // in NullFields will be sent to the server as null. It is an error if a
  653. // field in this list has a non-empty value. This may be used to include
  654. // null fields in Patch requests.
  655. NullFields []string `json:"-"`
  656. }
  657. func (s *Policy) MarshalJSON() ([]byte, error) {
  658. type NoMethod Policy
  659. raw := NoMethod(*s)
  660. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  661. }
  662. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  663. type SetIamPolicyRequest struct {
  664. // Policy: REQUIRED: The complete policy to be applied to the
  665. // `resource`. The size of
  666. // the policy is limited to a few 10s of KB. An empty policy is a
  667. // valid policy but certain Cloud Platform services (such as
  668. // Projects)
  669. // might reject them.
  670. Policy *IamPolicy `json:"policy,omitempty"`
  671. // ForceSendFields is a list of field names (e.g. "Policy") to
  672. // unconditionally include in API requests. By default, fields with
  673. // empty values are omitted from API requests. However, any non-pointer,
  674. // non-interface field appearing in ForceSendFields will be sent to the
  675. // server regardless of whether the field is empty or not. This may be
  676. // used to include empty fields in Patch requests.
  677. ForceSendFields []string `json:"-"`
  678. // NullFields is a list of field names (e.g. "Policy") to include in API
  679. // requests with the JSON null value. By default, fields with empty
  680. // values are omitted from API requests. However, any field with an
  681. // empty value appearing in NullFields will be sent to the server as
  682. // null. It is an error if a field in this list has a non-empty value.
  683. // This may be used to include null fields in Patch requests.
  684. NullFields []string `json:"-"`
  685. }
  686. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  687. type NoMethod SetIamPolicyRequest
  688. raw := NoMethod(*s)
  689. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  690. }
  691. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  692. // method.
  693. type TestIamPermissionsRequest struct {
  694. // Permissions: The set of permissions to check for the `resource`.
  695. // Permissions with
  696. // wildcards (such as '*' or 'storage.*') are not allowed. For
  697. // more
  698. // information see
  699. // [IAM
  700. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  701. Permissions []string `json:"permissions,omitempty"`
  702. // ForceSendFields is a list of field names (e.g. "Permissions") to
  703. // unconditionally include in API requests. By default, fields with
  704. // empty values are omitted from API requests. However, any non-pointer,
  705. // non-interface field appearing in ForceSendFields will be sent to the
  706. // server regardless of whether the field is empty or not. This may be
  707. // used to include empty fields in Patch requests.
  708. ForceSendFields []string `json:"-"`
  709. // NullFields is a list of field names (e.g. "Permissions") to include
  710. // in API requests with the JSON null value. By default, fields with
  711. // empty values are omitted from API requests. However, any field with
  712. // an empty value appearing in NullFields will be sent to the server as
  713. // null. It is an error if a field in this list has a non-empty value.
  714. // This may be used to include null fields in Patch requests.
  715. NullFields []string `json:"-"`
  716. }
  717. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  718. type NoMethod TestIamPermissionsRequest
  719. raw := NoMethod(*s)
  720. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  721. }
  722. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  723. // method.
  724. type TestIamPermissionsResponse struct {
  725. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  726. // the caller is
  727. // allowed.
  728. Permissions []string `json:"permissions,omitempty"`
  729. // ServerResponse contains the HTTP response code and headers from the
  730. // server.
  731. googleapi.ServerResponse `json:"-"`
  732. // ForceSendFields is a list of field names (e.g. "Permissions") to
  733. // unconditionally include in API requests. By default, fields with
  734. // empty values are omitted from API requests. However, any non-pointer,
  735. // non-interface field appearing in ForceSendFields will be sent to the
  736. // server regardless of whether the field is empty or not. This may be
  737. // used to include empty fields in Patch requests.
  738. ForceSendFields []string `json:"-"`
  739. // NullFields is a list of field names (e.g. "Permissions") to include
  740. // in API requests with the JSON null value. By default, fields with
  741. // empty values are omitted from API requests. However, any field with
  742. // an empty value appearing in NullFields will be sent to the server as
  743. // null. It is an error if a field in this list has a non-empty value.
  744. // This may be used to include null fields in Patch requests.
  745. NullFields []string `json:"-"`
  746. }
  747. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  748. type NoMethod TestIamPermissionsResponse
  749. raw := NoMethod(*s)
  750. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  751. }
  752. // UserOwnedDrydockNote: An user owned drydock note references a
  753. // Drydock
  754. // ATTESTATION_AUTHORITY Note created by the user.
  755. type UserOwnedDrydockNote struct {
  756. // DelegationServiceAccountEmail: Output only. This field will contain
  757. // the service account email address
  758. // that this Attestor will use as the principal when querying
  759. // Container
  760. // Analysis. Attestor administrators must grant this service account
  761. // the
  762. // IAM role needed to read attestations from the note_reference
  763. // in
  764. // Container Analysis
  765. // (`containeranalysis.notes.occurrences.viewer`).
  766. //
  767. // This email address is fixed for the lifetime of the Attestor, but
  768. // callers
  769. // should not make any other assumptions about the service account
  770. // email;
  771. // future versions may use an email based on a different naming pattern.
  772. DelegationServiceAccountEmail string `json:"delegationServiceAccountEmail,omitempty"`
  773. // NoteReference: Required. The Drydock resource name of a
  774. // ATTESTATION_AUTHORITY Note,
  775. // created by the user, in the format: `projects/*/notes/*` (or the
  776. // legacy
  777. // `providers/*/notes/*`). This field may not be updated.
  778. //
  779. // An attestation by this attestor is stored as a
  780. // Drydock
  781. // ATTESTATION_AUTHORITY Occurrence that names a container image and
  782. // that
  783. // links to this Note. Drydock is an external dependency.
  784. NoteReference string `json:"noteReference,omitempty"`
  785. // PublicKeys: Optional. Public keys that verify attestations signed by
  786. // this
  787. // attestor. This field may be updated.
  788. //
  789. // If this field is non-empty, one of the specified public keys
  790. // must
  791. // verify that an attestation was signed by this attestor for the
  792. // image specified in the admission request.
  793. //
  794. // If this field is empty, this attestor always returns that no
  795. // valid attestations exist.
  796. PublicKeys []*AttestorPublicKey `json:"publicKeys,omitempty"`
  797. // ForceSendFields is a list of field names (e.g.
  798. // "DelegationServiceAccountEmail") to unconditionally include in API
  799. // requests. By default, fields with empty values are omitted from API
  800. // requests. However, any non-pointer, non-interface field appearing in
  801. // ForceSendFields will be sent to the server regardless of whether the
  802. // field is empty or not. This may be used to include empty fields in
  803. // Patch requests.
  804. ForceSendFields []string `json:"-"`
  805. // NullFields is a list of field names (e.g.
  806. // "DelegationServiceAccountEmail") to include in API requests with the
  807. // JSON null value. By default, fields with empty values are omitted
  808. // from API requests. However, any field with an empty value appearing
  809. // in NullFields will be sent to the server as null. It is an error if a
  810. // field in this list has a non-empty value. This may be used to include
  811. // null fields in Patch requests.
  812. NullFields []string `json:"-"`
  813. }
  814. func (s *UserOwnedDrydockNote) MarshalJSON() ([]byte, error) {
  815. type NoMethod UserOwnedDrydockNote
  816. raw := NoMethod(*s)
  817. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  818. }
  819. // method id "binaryauthorization.projects.getPolicy":
  820. type ProjectsGetPolicyCall struct {
  821. s *Service
  822. name string
  823. urlParams_ gensupport.URLParams
  824. ifNoneMatch_ string
  825. ctx_ context.Context
  826. header_ http.Header
  827. }
  828. // GetPolicy: Gets the policy for this project. Returns a default
  829. // policy if the project does not have one.
  830. func (r *ProjectsService) GetPolicy(name string) *ProjectsGetPolicyCall {
  831. c := &ProjectsGetPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  832. c.name = name
  833. return c
  834. }
  835. // Fields allows partial responses to be retrieved. See
  836. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  837. // for more information.
  838. func (c *ProjectsGetPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetPolicyCall {
  839. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  840. return c
  841. }
  842. // IfNoneMatch sets the optional parameter which makes the operation
  843. // fail if the object's ETag matches the given value. This is useful for
  844. // getting updates only after the object has changed since the last
  845. // request. Use googleapi.IsNotModified to check whether the response
  846. // error from Do is the result of In-None-Match.
  847. func (c *ProjectsGetPolicyCall) IfNoneMatch(entityTag string) *ProjectsGetPolicyCall {
  848. c.ifNoneMatch_ = entityTag
  849. return c
  850. }
  851. // Context sets the context to be used in this call's Do method. Any
  852. // pending HTTP request will be aborted if the provided context is
  853. // canceled.
  854. func (c *ProjectsGetPolicyCall) Context(ctx context.Context) *ProjectsGetPolicyCall {
  855. c.ctx_ = ctx
  856. return c
  857. }
  858. // Header returns an http.Header that can be modified by the caller to
  859. // add HTTP headers to the request.
  860. func (c *ProjectsGetPolicyCall) Header() http.Header {
  861. if c.header_ == nil {
  862. c.header_ = make(http.Header)
  863. }
  864. return c.header_
  865. }
  866. func (c *ProjectsGetPolicyCall) doRequest(alt string) (*http.Response, error) {
  867. reqHeaders := make(http.Header)
  868. for k, v := range c.header_ {
  869. reqHeaders[k] = v
  870. }
  871. reqHeaders.Set("User-Agent", c.s.userAgent())
  872. if c.ifNoneMatch_ != "" {
  873. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  874. }
  875. var body io.Reader = nil
  876. c.urlParams_.Set("alt", alt)
  877. c.urlParams_.Set("prettyPrint", "false")
  878. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  879. urls += "?" + c.urlParams_.Encode()
  880. req, err := http.NewRequest("GET", urls, body)
  881. if err != nil {
  882. return nil, err
  883. }
  884. req.Header = reqHeaders
  885. googleapi.Expand(req.URL, map[string]string{
  886. "name": c.name,
  887. })
  888. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  889. }
  890. // Do executes the "binaryauthorization.projects.getPolicy" call.
  891. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  892. // code is an error. Response headers are in either
  893. // *Policy.ServerResponse.Header or (if a response was returned at all)
  894. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  895. // check whether the returned error was because http.StatusNotModified
  896. // was returned.
  897. func (c *ProjectsGetPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  898. gensupport.SetOptions(c.urlParams_, opts...)
  899. res, err := c.doRequest("json")
  900. if res != nil && res.StatusCode == http.StatusNotModified {
  901. if res.Body != nil {
  902. res.Body.Close()
  903. }
  904. return nil, &googleapi.Error{
  905. Code: res.StatusCode,
  906. Header: res.Header,
  907. }
  908. }
  909. if err != nil {
  910. return nil, err
  911. }
  912. defer googleapi.CloseBody(res)
  913. if err := googleapi.CheckResponse(res); err != nil {
  914. return nil, err
  915. }
  916. ret := &Policy{
  917. ServerResponse: googleapi.ServerResponse{
  918. Header: res.Header,
  919. HTTPStatusCode: res.StatusCode,
  920. },
  921. }
  922. target := &ret
  923. if err := gensupport.DecodeResponse(target, res); err != nil {
  924. return nil, err
  925. }
  926. return ret, nil
  927. // {
  928. // "description": "Gets the policy for this project. Returns a default\npolicy if the project does not have one.",
  929. // "flatPath": "v1beta1/projects/{projectsId}/policy",
  930. // "httpMethod": "GET",
  931. // "id": "binaryauthorization.projects.getPolicy",
  932. // "parameterOrder": [
  933. // "name"
  934. // ],
  935. // "parameters": {
  936. // "name": {
  937. // "description": "Required. The resource name of the policy to retrieve,\nin the format `projects/*/policy`.",
  938. // "location": "path",
  939. // "pattern": "^projects/[^/]+/policy$",
  940. // "required": true,
  941. // "type": "string"
  942. // }
  943. // },
  944. // "path": "v1beta1/{+name}",
  945. // "response": {
  946. // "$ref": "Policy"
  947. // },
  948. // "scopes": [
  949. // "https://www.googleapis.com/auth/cloud-platform"
  950. // ]
  951. // }
  952. }
  953. // method id "binaryauthorization.projects.updatePolicy":
  954. type ProjectsUpdatePolicyCall struct {
  955. s *Service
  956. name string
  957. policy *Policy
  958. urlParams_ gensupport.URLParams
  959. ctx_ context.Context
  960. header_ http.Header
  961. }
  962. // UpdatePolicy: Creates or updates a project's policy, and returns a
  963. // copy of the
  964. // new policy. A policy is always updated as a whole, to avoid
  965. // race
  966. // conditions with concurrent policy enforcement (or
  967. // management!)
  968. // requests. Returns NOT_FOUND if the project does not exist,
  969. // INVALID_ARGUMENT
  970. // if the request is malformed.
  971. func (r *ProjectsService) UpdatePolicy(name string, policy *Policy) *ProjectsUpdatePolicyCall {
  972. c := &ProjectsUpdatePolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  973. c.name = name
  974. c.policy = policy
  975. return c
  976. }
  977. // Fields allows partial responses to be retrieved. See
  978. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  979. // for more information.
  980. func (c *ProjectsUpdatePolicyCall) Fields(s ...googleapi.Field) *ProjectsUpdatePolicyCall {
  981. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  982. return c
  983. }
  984. // Context sets the context to be used in this call's Do method. Any
  985. // pending HTTP request will be aborted if the provided context is
  986. // canceled.
  987. func (c *ProjectsUpdatePolicyCall) Context(ctx context.Context) *ProjectsUpdatePolicyCall {
  988. c.ctx_ = ctx
  989. return c
  990. }
  991. // Header returns an http.Header that can be modified by the caller to
  992. // add HTTP headers to the request.
  993. func (c *ProjectsUpdatePolicyCall) Header() http.Header {
  994. if c.header_ == nil {
  995. c.header_ = make(http.Header)
  996. }
  997. return c.header_
  998. }
  999. func (c *ProjectsUpdatePolicyCall) doRequest(alt string) (*http.Response, error) {
  1000. reqHeaders := make(http.Header)
  1001. for k, v := range c.header_ {
  1002. reqHeaders[k] = v
  1003. }
  1004. reqHeaders.Set("User-Agent", c.s.userAgent())
  1005. var body io.Reader = nil
  1006. body, err := googleapi.WithoutDataWrapper.JSONReader(c.policy)
  1007. if err != nil {
  1008. return nil, err
  1009. }
  1010. reqHeaders.Set("Content-Type", "application/json")
  1011. c.urlParams_.Set("alt", alt)
  1012. c.urlParams_.Set("prettyPrint", "false")
  1013. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1014. urls += "?" + c.urlParams_.Encode()
  1015. req, err := http.NewRequest("PUT", urls, body)
  1016. if err != nil {
  1017. return nil, err
  1018. }
  1019. req.Header = reqHeaders
  1020. googleapi.Expand(req.URL, map[string]string{
  1021. "name": c.name,
  1022. })
  1023. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1024. }
  1025. // Do executes the "binaryauthorization.projects.updatePolicy" call.
  1026. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1027. // code is an error. Response headers are in either
  1028. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1029. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1030. // check whether the returned error was because http.StatusNotModified
  1031. // was returned.
  1032. func (c *ProjectsUpdatePolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1033. gensupport.SetOptions(c.urlParams_, opts...)
  1034. res, err := c.doRequest("json")
  1035. if res != nil && res.StatusCode == http.StatusNotModified {
  1036. if res.Body != nil {
  1037. res.Body.Close()
  1038. }
  1039. return nil, &googleapi.Error{
  1040. Code: res.StatusCode,
  1041. Header: res.Header,
  1042. }
  1043. }
  1044. if err != nil {
  1045. return nil, err
  1046. }
  1047. defer googleapi.CloseBody(res)
  1048. if err := googleapi.CheckResponse(res); err != nil {
  1049. return nil, err
  1050. }
  1051. ret := &Policy{
  1052. ServerResponse: googleapi.ServerResponse{
  1053. Header: res.Header,
  1054. HTTPStatusCode: res.StatusCode,
  1055. },
  1056. }
  1057. target := &ret
  1058. if err := gensupport.DecodeResponse(target, res); err != nil {
  1059. return nil, err
  1060. }
  1061. return ret, nil
  1062. // {
  1063. // "description": "Creates or updates a project's policy, and returns a copy of the\nnew policy. A policy is always updated as a whole, to avoid race\nconditions with concurrent policy enforcement (or management!)\nrequests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT\nif the request is malformed.",
  1064. // "flatPath": "v1beta1/projects/{projectsId}/policy",
  1065. // "httpMethod": "PUT",
  1066. // "id": "binaryauthorization.projects.updatePolicy",
  1067. // "parameterOrder": [
  1068. // "name"
  1069. // ],
  1070. // "parameters": {
  1071. // "name": {
  1072. // "description": "Output only. The resource name, in the format `projects/*/policy`. There is\nat most one policy per project.",
  1073. // "location": "path",
  1074. // "pattern": "^projects/[^/]+/policy$",
  1075. // "required": true,
  1076. // "type": "string"
  1077. // }
  1078. // },
  1079. // "path": "v1beta1/{+name}",
  1080. // "request": {
  1081. // "$ref": "Policy"
  1082. // },
  1083. // "response": {
  1084. // "$ref": "Policy"
  1085. // },
  1086. // "scopes": [
  1087. // "https://www.googleapis.com/auth/cloud-platform"
  1088. // ]
  1089. // }
  1090. }
  1091. // method id "binaryauthorization.projects.attestors.create":
  1092. type ProjectsAttestorsCreateCall struct {
  1093. s *Service
  1094. parent string
  1095. attestor *Attestor
  1096. urlParams_ gensupport.URLParams
  1097. ctx_ context.Context
  1098. header_ http.Header
  1099. }
  1100. // Create: Creates an attestor, and returns a copy of the new
  1101. // attestor. Returns NOT_FOUND if the project does not
  1102. // exist,
  1103. // INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if
  1104. // the
  1105. // attestor already exists.
  1106. func (r *ProjectsAttestorsService) Create(parent string, attestor *Attestor) *ProjectsAttestorsCreateCall {
  1107. c := &ProjectsAttestorsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1108. c.parent = parent
  1109. c.attestor = attestor
  1110. return c
  1111. }
  1112. // AttestorId sets the optional parameter "attestorId": Required. The
  1113. // attestors ID.
  1114. func (c *ProjectsAttestorsCreateCall) AttestorId(attestorId string) *ProjectsAttestorsCreateCall {
  1115. c.urlParams_.Set("attestorId", attestorId)
  1116. return c
  1117. }
  1118. // Fields allows partial responses to be retrieved. See
  1119. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1120. // for more information.
  1121. func (c *ProjectsAttestorsCreateCall) Fields(s ...googleapi.Field) *ProjectsAttestorsCreateCall {
  1122. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1123. return c
  1124. }
  1125. // Context sets the context to be used in this call's Do method. Any
  1126. // pending HTTP request will be aborted if the provided context is
  1127. // canceled.
  1128. func (c *ProjectsAttestorsCreateCall) Context(ctx context.Context) *ProjectsAttestorsCreateCall {
  1129. c.ctx_ = ctx
  1130. return c
  1131. }
  1132. // Header returns an http.Header that can be modified by the caller to
  1133. // add HTTP headers to the request.
  1134. func (c *ProjectsAttestorsCreateCall) Header() http.Header {
  1135. if c.header_ == nil {
  1136. c.header_ = make(http.Header)
  1137. }
  1138. return c.header_
  1139. }
  1140. func (c *ProjectsAttestorsCreateCall) doRequest(alt string) (*http.Response, error) {
  1141. reqHeaders := make(http.Header)
  1142. for k, v := range c.header_ {
  1143. reqHeaders[k] = v
  1144. }
  1145. reqHeaders.Set("User-Agent", c.s.userAgent())
  1146. var body io.Reader = nil
  1147. body, err := googleapi.WithoutDataWrapper.JSONReader(c.attestor)
  1148. if err != nil {
  1149. return nil, err
  1150. }
  1151. reqHeaders.Set("Content-Type", "application/json")
  1152. c.urlParams_.Set("alt", alt)
  1153. c.urlParams_.Set("prettyPrint", "false")
  1154. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/attestors")
  1155. urls += "?" + c.urlParams_.Encode()
  1156. req, err := http.NewRequest("POST", urls, body)
  1157. if err != nil {
  1158. return nil, err
  1159. }
  1160. req.Header = reqHeaders
  1161. googleapi.Expand(req.URL, map[string]string{
  1162. "parent": c.parent,
  1163. })
  1164. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1165. }
  1166. // Do executes the "binaryauthorization.projects.attestors.create" call.
  1167. // Exactly one of *Attestor or error will be non-nil. Any non-2xx status
  1168. // code is an error. Response headers are in either
  1169. // *Attestor.ServerResponse.Header or (if a response was returned at
  1170. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1171. // to check whether the returned error was because
  1172. // http.StatusNotModified was returned.
  1173. func (c *ProjectsAttestorsCreateCall) Do(opts ...googleapi.CallOption) (*Attestor, error) {
  1174. gensupport.SetOptions(c.urlParams_, opts...)
  1175. res, err := c.doRequest("json")
  1176. if res != nil && res.StatusCode == http.StatusNotModified {
  1177. if res.Body != nil {
  1178. res.Body.Close()
  1179. }
  1180. return nil, &googleapi.Error{
  1181. Code: res.StatusCode,
  1182. Header: res.Header,
  1183. }
  1184. }
  1185. if err != nil {
  1186. return nil, err
  1187. }
  1188. defer googleapi.CloseBody(res)
  1189. if err := googleapi.CheckResponse(res); err != nil {
  1190. return nil, err
  1191. }
  1192. ret := &Attestor{
  1193. ServerResponse: googleapi.ServerResponse{
  1194. Header: res.Header,
  1195. HTTPStatusCode: res.StatusCode,
  1196. },
  1197. }
  1198. target := &ret
  1199. if err := gensupport.DecodeResponse(target, res); err != nil {
  1200. return nil, err
  1201. }
  1202. return ret, nil
  1203. // {
  1204. // "description": "Creates an attestor, and returns a copy of the new\nattestor. Returns NOT_FOUND if the project does not exist,\nINVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the\nattestor already exists.",
  1205. // "flatPath": "v1beta1/projects/{projectsId}/attestors",
  1206. // "httpMethod": "POST",
  1207. // "id": "binaryauthorization.projects.attestors.create",
  1208. // "parameterOrder": [
  1209. // "parent"
  1210. // ],
  1211. // "parameters": {
  1212. // "attestorId": {
  1213. // "description": "Required. The attestors ID.",
  1214. // "location": "query",
  1215. // "type": "string"
  1216. // },
  1217. // "parent": {
  1218. // "description": "Required. The parent of this attestor.",
  1219. // "location": "path",
  1220. // "pattern": "^projects/[^/]+$",
  1221. // "required": true,
  1222. // "type": "string"
  1223. // }
  1224. // },
  1225. // "path": "v1beta1/{+parent}/attestors",
  1226. // "request": {
  1227. // "$ref": "Attestor"
  1228. // },
  1229. // "response": {
  1230. // "$ref": "Attestor"
  1231. // },
  1232. // "scopes": [
  1233. // "https://www.googleapis.com/auth/cloud-platform"
  1234. // ]
  1235. // }
  1236. }
  1237. // method id "binaryauthorization.projects.attestors.delete":
  1238. type ProjectsAttestorsDeleteCall struct {
  1239. s *Service
  1240. name string
  1241. urlParams_ gensupport.URLParams
  1242. ctx_ context.Context
  1243. header_ http.Header
  1244. }
  1245. // Delete: Deletes an attestor. Returns NOT_FOUND if the
  1246. // attestor does not exist.
  1247. func (r *ProjectsAttestorsService) Delete(name string) *ProjectsAttestorsDeleteCall {
  1248. c := &ProjectsAttestorsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1249. c.name = name
  1250. return c
  1251. }
  1252. // Fields allows partial responses to be retrieved. See
  1253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1254. // for more information.
  1255. func (c *ProjectsAttestorsDeleteCall) Fields(s ...googleapi.Field) *ProjectsAttestorsDeleteCall {
  1256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1257. return c
  1258. }
  1259. // Context sets the context to be used in this call's Do method. Any
  1260. // pending HTTP request will be aborted if the provided context is
  1261. // canceled.
  1262. func (c *ProjectsAttestorsDeleteCall) Context(ctx context.Context) *ProjectsAttestorsDeleteCall {
  1263. c.ctx_ = ctx
  1264. return c
  1265. }
  1266. // Header returns an http.Header that can be modified by the caller to
  1267. // add HTTP headers to the request.
  1268. func (c *ProjectsAttestorsDeleteCall) Header() http.Header {
  1269. if c.header_ == nil {
  1270. c.header_ = make(http.Header)
  1271. }
  1272. return c.header_
  1273. }
  1274. func (c *ProjectsAttestorsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1275. reqHeaders := make(http.Header)
  1276. for k, v := range c.header_ {
  1277. reqHeaders[k] = v
  1278. }
  1279. reqHeaders.Set("User-Agent", c.s.userAgent())
  1280. var body io.Reader = nil
  1281. c.urlParams_.Set("alt", alt)
  1282. c.urlParams_.Set("prettyPrint", "false")
  1283. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1284. urls += "?" + c.urlParams_.Encode()
  1285. req, err := http.NewRequest("DELETE", urls, body)
  1286. if err != nil {
  1287. return nil, err
  1288. }
  1289. req.Header = reqHeaders
  1290. googleapi.Expand(req.URL, map[string]string{
  1291. "name": c.name,
  1292. })
  1293. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1294. }
  1295. // Do executes the "binaryauthorization.projects.attestors.delete" call.
  1296. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1297. // code is an error. Response headers are in either
  1298. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1299. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1300. // check whether the returned error was because http.StatusNotModified
  1301. // was returned.
  1302. func (c *ProjectsAttestorsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1303. gensupport.SetOptions(c.urlParams_, opts...)
  1304. res, err := c.doRequest("json")
  1305. if res != nil && res.StatusCode == http.StatusNotModified {
  1306. if res.Body != nil {
  1307. res.Body.Close()
  1308. }
  1309. return nil, &googleapi.Error{
  1310. Code: res.StatusCode,
  1311. Header: res.Header,
  1312. }
  1313. }
  1314. if err != nil {
  1315. return nil, err
  1316. }
  1317. defer googleapi.CloseBody(res)
  1318. if err := googleapi.CheckResponse(res); err != nil {
  1319. return nil, err
  1320. }
  1321. ret := &Empty{
  1322. ServerResponse: googleapi.ServerResponse{
  1323. Header: res.Header,
  1324. HTTPStatusCode: res.StatusCode,
  1325. },
  1326. }
  1327. target := &ret
  1328. if err := gensupport.DecodeResponse(target, res); err != nil {
  1329. return nil, err
  1330. }
  1331. return ret, nil
  1332. // {
  1333. // "description": "Deletes an attestor. Returns NOT_FOUND if the\nattestor does not exist.",
  1334. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}",
  1335. // "httpMethod": "DELETE",
  1336. // "id": "binaryauthorization.projects.attestors.delete",
  1337. // "parameterOrder": [
  1338. // "name"
  1339. // ],
  1340. // "parameters": {
  1341. // "name": {
  1342. // "description": "Required. The name of the attestors to delete, in the format\n`projects/*/attestors/*`.",
  1343. // "location": "path",
  1344. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  1345. // "required": true,
  1346. // "type": "string"
  1347. // }
  1348. // },
  1349. // "path": "v1beta1/{+name}",
  1350. // "response": {
  1351. // "$ref": "Empty"
  1352. // },
  1353. // "scopes": [
  1354. // "https://www.googleapis.com/auth/cloud-platform"
  1355. // ]
  1356. // }
  1357. }
  1358. // method id "binaryauthorization.projects.attestors.get":
  1359. type ProjectsAttestorsGetCall struct {
  1360. s *Service
  1361. name string
  1362. urlParams_ gensupport.URLParams
  1363. ifNoneMatch_ string
  1364. ctx_ context.Context
  1365. header_ http.Header
  1366. }
  1367. // Get: Gets an attestor.
  1368. // Returns NOT_FOUND if the attestor does not exist.
  1369. func (r *ProjectsAttestorsService) Get(name string) *ProjectsAttestorsGetCall {
  1370. c := &ProjectsAttestorsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1371. c.name = name
  1372. return c
  1373. }
  1374. // Fields allows partial responses to be retrieved. See
  1375. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1376. // for more information.
  1377. func (c *ProjectsAttestorsGetCall) Fields(s ...googleapi.Field) *ProjectsAttestorsGetCall {
  1378. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1379. return c
  1380. }
  1381. // IfNoneMatch sets the optional parameter which makes the operation
  1382. // fail if the object's ETag matches the given value. This is useful for
  1383. // getting updates only after the object has changed since the last
  1384. // request. Use googleapi.IsNotModified to check whether the response
  1385. // error from Do is the result of In-None-Match.
  1386. func (c *ProjectsAttestorsGetCall) IfNoneMatch(entityTag string) *ProjectsAttestorsGetCall {
  1387. c.ifNoneMatch_ = entityTag
  1388. return c
  1389. }
  1390. // Context sets the context to be used in this call's Do method. Any
  1391. // pending HTTP request will be aborted if the provided context is
  1392. // canceled.
  1393. func (c *ProjectsAttestorsGetCall) Context(ctx context.Context) *ProjectsAttestorsGetCall {
  1394. c.ctx_ = ctx
  1395. return c
  1396. }
  1397. // Header returns an http.Header that can be modified by the caller to
  1398. // add HTTP headers to the request.
  1399. func (c *ProjectsAttestorsGetCall) Header() http.Header {
  1400. if c.header_ == nil {
  1401. c.header_ = make(http.Header)
  1402. }
  1403. return c.header_
  1404. }
  1405. func (c *ProjectsAttestorsGetCall) doRequest(alt string) (*http.Response, error) {
  1406. reqHeaders := make(http.Header)
  1407. for k, v := range c.header_ {
  1408. reqHeaders[k] = v
  1409. }
  1410. reqHeaders.Set("User-Agent", c.s.userAgent())
  1411. if c.ifNoneMatch_ != "" {
  1412. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1413. }
  1414. var body io.Reader = nil
  1415. c.urlParams_.Set("alt", alt)
  1416. c.urlParams_.Set("prettyPrint", "false")
  1417. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1418. urls += "?" + c.urlParams_.Encode()
  1419. req, err := http.NewRequest("GET", urls, body)
  1420. if err != nil {
  1421. return nil, err
  1422. }
  1423. req.Header = reqHeaders
  1424. googleapi.Expand(req.URL, map[string]string{
  1425. "name": c.name,
  1426. })
  1427. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1428. }
  1429. // Do executes the "binaryauthorization.projects.attestors.get" call.
  1430. // Exactly one of *Attestor or error will be non-nil. Any non-2xx status
  1431. // code is an error. Response headers are in either
  1432. // *Attestor.ServerResponse.Header or (if a response was returned at
  1433. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1434. // to check whether the returned error was because
  1435. // http.StatusNotModified was returned.
  1436. func (c *ProjectsAttestorsGetCall) Do(opts ...googleapi.CallOption) (*Attestor, error) {
  1437. gensupport.SetOptions(c.urlParams_, opts...)
  1438. res, err := c.doRequest("json")
  1439. if res != nil && res.StatusCode == http.StatusNotModified {
  1440. if res.Body != nil {
  1441. res.Body.Close()
  1442. }
  1443. return nil, &googleapi.Error{
  1444. Code: res.StatusCode,
  1445. Header: res.Header,
  1446. }
  1447. }
  1448. if err != nil {
  1449. return nil, err
  1450. }
  1451. defer googleapi.CloseBody(res)
  1452. if err := googleapi.CheckResponse(res); err != nil {
  1453. return nil, err
  1454. }
  1455. ret := &Attestor{
  1456. ServerResponse: googleapi.ServerResponse{
  1457. Header: res.Header,
  1458. HTTPStatusCode: res.StatusCode,
  1459. },
  1460. }
  1461. target := &ret
  1462. if err := gensupport.DecodeResponse(target, res); err != nil {
  1463. return nil, err
  1464. }
  1465. return ret, nil
  1466. // {
  1467. // "description": "Gets an attestor.\nReturns NOT_FOUND if the attestor does not exist.",
  1468. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}",
  1469. // "httpMethod": "GET",
  1470. // "id": "binaryauthorization.projects.attestors.get",
  1471. // "parameterOrder": [
  1472. // "name"
  1473. // ],
  1474. // "parameters": {
  1475. // "name": {
  1476. // "description": "Required. The name of the attestor to retrieve, in the format\n`projects/*/attestors/*`.",
  1477. // "location": "path",
  1478. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  1479. // "required": true,
  1480. // "type": "string"
  1481. // }
  1482. // },
  1483. // "path": "v1beta1/{+name}",
  1484. // "response": {
  1485. // "$ref": "Attestor"
  1486. // },
  1487. // "scopes": [
  1488. // "https://www.googleapis.com/auth/cloud-platform"
  1489. // ]
  1490. // }
  1491. }
  1492. // method id "binaryauthorization.projects.attestors.getIamPolicy":
  1493. type ProjectsAttestorsGetIamPolicyCall struct {
  1494. s *Service
  1495. resource string
  1496. urlParams_ gensupport.URLParams
  1497. ifNoneMatch_ string
  1498. ctx_ context.Context
  1499. header_ http.Header
  1500. }
  1501. // GetIamPolicy: Gets the access control policy for a resource.
  1502. // Returns an empty policy if the resource exists and does not have a
  1503. // policy
  1504. // set.
  1505. func (r *ProjectsAttestorsService) GetIamPolicy(resource string) *ProjectsAttestorsGetIamPolicyCall {
  1506. c := &ProjectsAttestorsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1507. c.resource = resource
  1508. return c
  1509. }
  1510. // Fields allows partial responses to be retrieved. See
  1511. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1512. // for more information.
  1513. func (c *ProjectsAttestorsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsAttestorsGetIamPolicyCall {
  1514. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1515. return c
  1516. }
  1517. // IfNoneMatch sets the optional parameter which makes the operation
  1518. // fail if the object's ETag matches the given value. This is useful for
  1519. // getting updates only after the object has changed since the last
  1520. // request. Use googleapi.IsNotModified to check whether the response
  1521. // error from Do is the result of In-None-Match.
  1522. func (c *ProjectsAttestorsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsAttestorsGetIamPolicyCall {
  1523. c.ifNoneMatch_ = entityTag
  1524. return c
  1525. }
  1526. // Context sets the context to be used in this call's Do method. Any
  1527. // pending HTTP request will be aborted if the provided context is
  1528. // canceled.
  1529. func (c *ProjectsAttestorsGetIamPolicyCall) Context(ctx context.Context) *ProjectsAttestorsGetIamPolicyCall {
  1530. c.ctx_ = ctx
  1531. return c
  1532. }
  1533. // Header returns an http.Header that can be modified by the caller to
  1534. // add HTTP headers to the request.
  1535. func (c *ProjectsAttestorsGetIamPolicyCall) Header() http.Header {
  1536. if c.header_ == nil {
  1537. c.header_ = make(http.Header)
  1538. }
  1539. return c.header_
  1540. }
  1541. func (c *ProjectsAttestorsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1542. reqHeaders := make(http.Header)
  1543. for k, v := range c.header_ {
  1544. reqHeaders[k] = v
  1545. }
  1546. reqHeaders.Set("User-Agent", c.s.userAgent())
  1547. if c.ifNoneMatch_ != "" {
  1548. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1549. }
  1550. var body io.Reader = nil
  1551. c.urlParams_.Set("alt", alt)
  1552. c.urlParams_.Set("prettyPrint", "false")
  1553. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
  1554. urls += "?" + c.urlParams_.Encode()
  1555. req, err := http.NewRequest("GET", urls, body)
  1556. if err != nil {
  1557. return nil, err
  1558. }
  1559. req.Header = reqHeaders
  1560. googleapi.Expand(req.URL, map[string]string{
  1561. "resource": c.resource,
  1562. })
  1563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1564. }
  1565. // Do executes the "binaryauthorization.projects.attestors.getIamPolicy" call.
  1566. // Exactly one of *IamPolicy or error will be non-nil. Any non-2xx
  1567. // status code is an error. Response headers are in either
  1568. // *IamPolicy.ServerResponse.Header or (if a response was returned at
  1569. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1570. // to check whether the returned error was because
  1571. // http.StatusNotModified was returned.
  1572. func (c *ProjectsAttestorsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*IamPolicy, error) {
  1573. gensupport.SetOptions(c.urlParams_, opts...)
  1574. res, err := c.doRequest("json")
  1575. if res != nil && res.StatusCode == http.StatusNotModified {
  1576. if res.Body != nil {
  1577. res.Body.Close()
  1578. }
  1579. return nil, &googleapi.Error{
  1580. Code: res.StatusCode,
  1581. Header: res.Header,
  1582. }
  1583. }
  1584. if err != nil {
  1585. return nil, err
  1586. }
  1587. defer googleapi.CloseBody(res)
  1588. if err := googleapi.CheckResponse(res); err != nil {
  1589. return nil, err
  1590. }
  1591. ret := &IamPolicy{
  1592. ServerResponse: googleapi.ServerResponse{
  1593. Header: res.Header,
  1594. HTTPStatusCode: res.StatusCode,
  1595. },
  1596. }
  1597. target := &ret
  1598. if err := gensupport.DecodeResponse(target, res); err != nil {
  1599. return nil, err
  1600. }
  1601. return ret, nil
  1602. // {
  1603. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  1604. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}:getIamPolicy",
  1605. // "httpMethod": "GET",
  1606. // "id": "binaryauthorization.projects.attestors.getIamPolicy",
  1607. // "parameterOrder": [
  1608. // "resource"
  1609. // ],
  1610. // "parameters": {
  1611. // "resource": {
  1612. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1613. // "location": "path",
  1614. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  1615. // "required": true,
  1616. // "type": "string"
  1617. // }
  1618. // },
  1619. // "path": "v1beta1/{+resource}:getIamPolicy",
  1620. // "response": {
  1621. // "$ref": "IamPolicy"
  1622. // },
  1623. // "scopes": [
  1624. // "https://www.googleapis.com/auth/cloud-platform"
  1625. // ]
  1626. // }
  1627. }
  1628. // method id "binaryauthorization.projects.attestors.list":
  1629. type ProjectsAttestorsListCall struct {
  1630. s *Service
  1631. parent string
  1632. urlParams_ gensupport.URLParams
  1633. ifNoneMatch_ string
  1634. ctx_ context.Context
  1635. header_ http.Header
  1636. }
  1637. // List: Lists attestors.
  1638. // Returns INVALID_ARGUMENT if the project does not exist.
  1639. func (r *ProjectsAttestorsService) List(parent string) *ProjectsAttestorsListCall {
  1640. c := &ProjectsAttestorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1641. c.parent = parent
  1642. return c
  1643. }
  1644. // PageSize sets the optional parameter "pageSize": Requested page size.
  1645. // The server may return fewer results than requested. If
  1646. // unspecified, the server will pick an appropriate default.
  1647. func (c *ProjectsAttestorsListCall) PageSize(pageSize int64) *ProjectsAttestorsListCall {
  1648. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1649. return c
  1650. }
  1651. // PageToken sets the optional parameter "pageToken": A token
  1652. // identifying a page of results the server should return.
  1653. // Typically,
  1654. // this is the value of ListAttestorsResponse.next_page_token
  1655. // returned
  1656. // from the previous call to the `ListAttestors` method.
  1657. func (c *ProjectsAttestorsListCall) PageToken(pageToken string) *ProjectsAttestorsListCall {
  1658. c.urlParams_.Set("pageToken", pageToken)
  1659. return c
  1660. }
  1661. // Fields allows partial responses to be retrieved. See
  1662. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1663. // for more information.
  1664. func (c *ProjectsAttestorsListCall) Fields(s ...googleapi.Field) *ProjectsAttestorsListCall {
  1665. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1666. return c
  1667. }
  1668. // IfNoneMatch sets the optional parameter which makes the operation
  1669. // fail if the object's ETag matches the given value. This is useful for
  1670. // getting updates only after the object has changed since the last
  1671. // request. Use googleapi.IsNotModified to check whether the response
  1672. // error from Do is the result of In-None-Match.
  1673. func (c *ProjectsAttestorsListCall) IfNoneMatch(entityTag string) *ProjectsAttestorsListCall {
  1674. c.ifNoneMatch_ = entityTag
  1675. return c
  1676. }
  1677. // Context sets the context to be used in this call's Do method. Any
  1678. // pending HTTP request will be aborted if the provided context is
  1679. // canceled.
  1680. func (c *ProjectsAttestorsListCall) Context(ctx context.Context) *ProjectsAttestorsListCall {
  1681. c.ctx_ = ctx
  1682. return c
  1683. }
  1684. // Header returns an http.Header that can be modified by the caller to
  1685. // add HTTP headers to the request.
  1686. func (c *ProjectsAttestorsListCall) Header() http.Header {
  1687. if c.header_ == nil {
  1688. c.header_ = make(http.Header)
  1689. }
  1690. return c.header_
  1691. }
  1692. func (c *ProjectsAttestorsListCall) doRequest(alt string) (*http.Response, error) {
  1693. reqHeaders := make(http.Header)
  1694. for k, v := range c.header_ {
  1695. reqHeaders[k] = v
  1696. }
  1697. reqHeaders.Set("User-Agent", c.s.userAgent())
  1698. if c.ifNoneMatch_ != "" {
  1699. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1700. }
  1701. var body io.Reader = nil
  1702. c.urlParams_.Set("alt", alt)
  1703. c.urlParams_.Set("prettyPrint", "false")
  1704. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/attestors")
  1705. urls += "?" + c.urlParams_.Encode()
  1706. req, err := http.NewRequest("GET", urls, body)
  1707. if err != nil {
  1708. return nil, err
  1709. }
  1710. req.Header = reqHeaders
  1711. googleapi.Expand(req.URL, map[string]string{
  1712. "parent": c.parent,
  1713. })
  1714. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1715. }
  1716. // Do executes the "binaryauthorization.projects.attestors.list" call.
  1717. // Exactly one of *ListAttestorsResponse or error will be non-nil. Any
  1718. // non-2xx status code is an error. Response headers are in either
  1719. // *ListAttestorsResponse.ServerResponse.Header or (if a response was
  1720. // returned at all) in error.(*googleapi.Error).Header. Use
  1721. // googleapi.IsNotModified to check whether the returned error was
  1722. // because http.StatusNotModified was returned.
  1723. func (c *ProjectsAttestorsListCall) Do(opts ...googleapi.CallOption) (*ListAttestorsResponse, error) {
  1724. gensupport.SetOptions(c.urlParams_, opts...)
  1725. res, err := c.doRequest("json")
  1726. if res != nil && res.StatusCode == http.StatusNotModified {
  1727. if res.Body != nil {
  1728. res.Body.Close()
  1729. }
  1730. return nil, &googleapi.Error{
  1731. Code: res.StatusCode,
  1732. Header: res.Header,
  1733. }
  1734. }
  1735. if err != nil {
  1736. return nil, err
  1737. }
  1738. defer googleapi.CloseBody(res)
  1739. if err := googleapi.CheckResponse(res); err != nil {
  1740. return nil, err
  1741. }
  1742. ret := &ListAttestorsResponse{
  1743. ServerResponse: googleapi.ServerResponse{
  1744. Header: res.Header,
  1745. HTTPStatusCode: res.StatusCode,
  1746. },
  1747. }
  1748. target := &ret
  1749. if err := gensupport.DecodeResponse(target, res); err != nil {
  1750. return nil, err
  1751. }
  1752. return ret, nil
  1753. // {
  1754. // "description": "Lists attestors.\nReturns INVALID_ARGUMENT if the project does not exist.",
  1755. // "flatPath": "v1beta1/projects/{projectsId}/attestors",
  1756. // "httpMethod": "GET",
  1757. // "id": "binaryauthorization.projects.attestors.list",
  1758. // "parameterOrder": [
  1759. // "parent"
  1760. // ],
  1761. // "parameters": {
  1762. // "pageSize": {
  1763. // "description": "Requested page size. The server may return fewer results than requested. If\nunspecified, the server will pick an appropriate default.",
  1764. // "format": "int32",
  1765. // "location": "query",
  1766. // "type": "integer"
  1767. // },
  1768. // "pageToken": {
  1769. // "description": "A token identifying a page of results the server should return. Typically,\nthis is the value of ListAttestorsResponse.next_page_token returned\nfrom the previous call to the `ListAttestors` method.",
  1770. // "location": "query",
  1771. // "type": "string"
  1772. // },
  1773. // "parent": {
  1774. // "description": "Required. The resource name of the project associated with the\nattestors, in the format `projects/*`.",
  1775. // "location": "path",
  1776. // "pattern": "^projects/[^/]+$",
  1777. // "required": true,
  1778. // "type": "string"
  1779. // }
  1780. // },
  1781. // "path": "v1beta1/{+parent}/attestors",
  1782. // "response": {
  1783. // "$ref": "ListAttestorsResponse"
  1784. // },
  1785. // "scopes": [
  1786. // "https://www.googleapis.com/auth/cloud-platform"
  1787. // ]
  1788. // }
  1789. }
  1790. // Pages invokes f for each page of results.
  1791. // A non-nil error returned from f will halt the iteration.
  1792. // The provided context supersedes any context provided to the Context method.
  1793. func (c *ProjectsAttestorsListCall) Pages(ctx context.Context, f func(*ListAttestorsResponse) error) error {
  1794. c.ctx_ = ctx
  1795. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1796. for {
  1797. x, err := c.Do()
  1798. if err != nil {
  1799. return err
  1800. }
  1801. if err := f(x); err != nil {
  1802. return err
  1803. }
  1804. if x.NextPageToken == "" {
  1805. return nil
  1806. }
  1807. c.PageToken(x.NextPageToken)
  1808. }
  1809. }
  1810. // method id "binaryauthorization.projects.attestors.setIamPolicy":
  1811. type ProjectsAttestorsSetIamPolicyCall struct {
  1812. s *Service
  1813. resource string
  1814. setiampolicyrequest *SetIamPolicyRequest
  1815. urlParams_ gensupport.URLParams
  1816. ctx_ context.Context
  1817. header_ http.Header
  1818. }
  1819. // SetIamPolicy: Sets the access control policy on the specified
  1820. // resource. Replaces any
  1821. // existing policy.
  1822. func (r *ProjectsAttestorsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsAttestorsSetIamPolicyCall {
  1823. c := &ProjectsAttestorsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1824. c.resource = resource
  1825. c.setiampolicyrequest = setiampolicyrequest
  1826. return c
  1827. }
  1828. // Fields allows partial responses to be retrieved. See
  1829. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1830. // for more information.
  1831. func (c *ProjectsAttestorsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsAttestorsSetIamPolicyCall {
  1832. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1833. return c
  1834. }
  1835. // Context sets the context to be used in this call's Do method. Any
  1836. // pending HTTP request will be aborted if the provided context is
  1837. // canceled.
  1838. func (c *ProjectsAttestorsSetIamPolicyCall) Context(ctx context.Context) *ProjectsAttestorsSetIamPolicyCall {
  1839. c.ctx_ = ctx
  1840. return c
  1841. }
  1842. // Header returns an http.Header that can be modified by the caller to
  1843. // add HTTP headers to the request.
  1844. func (c *ProjectsAttestorsSetIamPolicyCall) Header() http.Header {
  1845. if c.header_ == nil {
  1846. c.header_ = make(http.Header)
  1847. }
  1848. return c.header_
  1849. }
  1850. func (c *ProjectsAttestorsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1851. reqHeaders := make(http.Header)
  1852. for k, v := range c.header_ {
  1853. reqHeaders[k] = v
  1854. }
  1855. reqHeaders.Set("User-Agent", c.s.userAgent())
  1856. var body io.Reader = nil
  1857. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  1858. if err != nil {
  1859. return nil, err
  1860. }
  1861. reqHeaders.Set("Content-Type", "application/json")
  1862. c.urlParams_.Set("alt", alt)
  1863. c.urlParams_.Set("prettyPrint", "false")
  1864. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
  1865. urls += "?" + c.urlParams_.Encode()
  1866. req, err := http.NewRequest("POST", urls, body)
  1867. if err != nil {
  1868. return nil, err
  1869. }
  1870. req.Header = reqHeaders
  1871. googleapi.Expand(req.URL, map[string]string{
  1872. "resource": c.resource,
  1873. })
  1874. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1875. }
  1876. // Do executes the "binaryauthorization.projects.attestors.setIamPolicy" call.
  1877. // Exactly one of *IamPolicy or error will be non-nil. Any non-2xx
  1878. // status code is an error. Response headers are in either
  1879. // *IamPolicy.ServerResponse.Header or (if a response was returned at
  1880. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1881. // to check whether the returned error was because
  1882. // http.StatusNotModified was returned.
  1883. func (c *ProjectsAttestorsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*IamPolicy, error) {
  1884. gensupport.SetOptions(c.urlParams_, opts...)
  1885. res, err := c.doRequest("json")
  1886. if res != nil && res.StatusCode == http.StatusNotModified {
  1887. if res.Body != nil {
  1888. res.Body.Close()
  1889. }
  1890. return nil, &googleapi.Error{
  1891. Code: res.StatusCode,
  1892. Header: res.Header,
  1893. }
  1894. }
  1895. if err != nil {
  1896. return nil, err
  1897. }
  1898. defer googleapi.CloseBody(res)
  1899. if err := googleapi.CheckResponse(res); err != nil {
  1900. return nil, err
  1901. }
  1902. ret := &IamPolicy{
  1903. ServerResponse: googleapi.ServerResponse{
  1904. Header: res.Header,
  1905. HTTPStatusCode: res.StatusCode,
  1906. },
  1907. }
  1908. target := &ret
  1909. if err := gensupport.DecodeResponse(target, res); err != nil {
  1910. return nil, err
  1911. }
  1912. return ret, nil
  1913. // {
  1914. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  1915. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}:setIamPolicy",
  1916. // "httpMethod": "POST",
  1917. // "id": "binaryauthorization.projects.attestors.setIamPolicy",
  1918. // "parameterOrder": [
  1919. // "resource"
  1920. // ],
  1921. // "parameters": {
  1922. // "resource": {
  1923. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  1924. // "location": "path",
  1925. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  1926. // "required": true,
  1927. // "type": "string"
  1928. // }
  1929. // },
  1930. // "path": "v1beta1/{+resource}:setIamPolicy",
  1931. // "request": {
  1932. // "$ref": "SetIamPolicyRequest"
  1933. // },
  1934. // "response": {
  1935. // "$ref": "IamPolicy"
  1936. // },
  1937. // "scopes": [
  1938. // "https://www.googleapis.com/auth/cloud-platform"
  1939. // ]
  1940. // }
  1941. }
  1942. // method id "binaryauthorization.projects.attestors.testIamPermissions":
  1943. type ProjectsAttestorsTestIamPermissionsCall struct {
  1944. s *Service
  1945. resource string
  1946. testiampermissionsrequest *TestIamPermissionsRequest
  1947. urlParams_ gensupport.URLParams
  1948. ctx_ context.Context
  1949. header_ http.Header
  1950. }
  1951. // TestIamPermissions: Returns permissions that a caller has on the
  1952. // specified resource.
  1953. // If the resource does not exist, this will return an empty set
  1954. // of
  1955. // permissions, not a NOT_FOUND error.
  1956. //
  1957. // Note: This operation is designed to be used for building
  1958. // permission-aware
  1959. // UIs and command-line tools, not for authorization checking. This
  1960. // operation
  1961. // may "fail open" without warning.
  1962. func (r *ProjectsAttestorsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsAttestorsTestIamPermissionsCall {
  1963. c := &ProjectsAttestorsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1964. c.resource = resource
  1965. c.testiampermissionsrequest = testiampermissionsrequest
  1966. return c
  1967. }
  1968. // Fields allows partial responses to be retrieved. See
  1969. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1970. // for more information.
  1971. func (c *ProjectsAttestorsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsAttestorsTestIamPermissionsCall {
  1972. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1973. return c
  1974. }
  1975. // Context sets the context to be used in this call's Do method. Any
  1976. // pending HTTP request will be aborted if the provided context is
  1977. // canceled.
  1978. func (c *ProjectsAttestorsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsAttestorsTestIamPermissionsCall {
  1979. c.ctx_ = ctx
  1980. return c
  1981. }
  1982. // Header returns an http.Header that can be modified by the caller to
  1983. // add HTTP headers to the request.
  1984. func (c *ProjectsAttestorsTestIamPermissionsCall) Header() http.Header {
  1985. if c.header_ == nil {
  1986. c.header_ = make(http.Header)
  1987. }
  1988. return c.header_
  1989. }
  1990. func (c *ProjectsAttestorsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  1991. reqHeaders := make(http.Header)
  1992. for k, v := range c.header_ {
  1993. reqHeaders[k] = v
  1994. }
  1995. reqHeaders.Set("User-Agent", c.s.userAgent())
  1996. var body io.Reader = nil
  1997. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  1998. if err != nil {
  1999. return nil, err
  2000. }
  2001. reqHeaders.Set("Content-Type", "application/json")
  2002. c.urlParams_.Set("alt", alt)
  2003. c.urlParams_.Set("prettyPrint", "false")
  2004. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
  2005. urls += "?" + c.urlParams_.Encode()
  2006. req, err := http.NewRequest("POST", urls, body)
  2007. if err != nil {
  2008. return nil, err
  2009. }
  2010. req.Header = reqHeaders
  2011. googleapi.Expand(req.URL, map[string]string{
  2012. "resource": c.resource,
  2013. })
  2014. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2015. }
  2016. // Do executes the "binaryauthorization.projects.attestors.testIamPermissions" call.
  2017. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2018. // Any non-2xx status code is an error. Response headers are in either
  2019. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2020. // was returned at all) in error.(*googleapi.Error).Header. Use
  2021. // googleapi.IsNotModified to check whether the returned error was
  2022. // because http.StatusNotModified was returned.
  2023. func (c *ProjectsAttestorsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2024. gensupport.SetOptions(c.urlParams_, opts...)
  2025. res, err := c.doRequest("json")
  2026. if res != nil && res.StatusCode == http.StatusNotModified {
  2027. if res.Body != nil {
  2028. res.Body.Close()
  2029. }
  2030. return nil, &googleapi.Error{
  2031. Code: res.StatusCode,
  2032. Header: res.Header,
  2033. }
  2034. }
  2035. if err != nil {
  2036. return nil, err
  2037. }
  2038. defer googleapi.CloseBody(res)
  2039. if err := googleapi.CheckResponse(res); err != nil {
  2040. return nil, err
  2041. }
  2042. ret := &TestIamPermissionsResponse{
  2043. ServerResponse: googleapi.ServerResponse{
  2044. Header: res.Header,
  2045. HTTPStatusCode: res.StatusCode,
  2046. },
  2047. }
  2048. target := &ret
  2049. if err := gensupport.DecodeResponse(target, res); err != nil {
  2050. return nil, err
  2051. }
  2052. return ret, nil
  2053. // {
  2054. // "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.",
  2055. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}:testIamPermissions",
  2056. // "httpMethod": "POST",
  2057. // "id": "binaryauthorization.projects.attestors.testIamPermissions",
  2058. // "parameterOrder": [
  2059. // "resource"
  2060. // ],
  2061. // "parameters": {
  2062. // "resource": {
  2063. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2064. // "location": "path",
  2065. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  2066. // "required": true,
  2067. // "type": "string"
  2068. // }
  2069. // },
  2070. // "path": "v1beta1/{+resource}:testIamPermissions",
  2071. // "request": {
  2072. // "$ref": "TestIamPermissionsRequest"
  2073. // },
  2074. // "response": {
  2075. // "$ref": "TestIamPermissionsResponse"
  2076. // },
  2077. // "scopes": [
  2078. // "https://www.googleapis.com/auth/cloud-platform"
  2079. // ]
  2080. // }
  2081. }
  2082. // method id "binaryauthorization.projects.attestors.update":
  2083. type ProjectsAttestorsUpdateCall struct {
  2084. s *Service
  2085. name string
  2086. attestor *Attestor
  2087. urlParams_ gensupport.URLParams
  2088. ctx_ context.Context
  2089. header_ http.Header
  2090. }
  2091. // Update: Updates an attestor.
  2092. // Returns NOT_FOUND if the attestor does not exist.
  2093. func (r *ProjectsAttestorsService) Update(name string, attestor *Attestor) *ProjectsAttestorsUpdateCall {
  2094. c := &ProjectsAttestorsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2095. c.name = name
  2096. c.attestor = attestor
  2097. return c
  2098. }
  2099. // Fields allows partial responses to be retrieved. See
  2100. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2101. // for more information.
  2102. func (c *ProjectsAttestorsUpdateCall) Fields(s ...googleapi.Field) *ProjectsAttestorsUpdateCall {
  2103. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2104. return c
  2105. }
  2106. // Context sets the context to be used in this call's Do method. Any
  2107. // pending HTTP request will be aborted if the provided context is
  2108. // canceled.
  2109. func (c *ProjectsAttestorsUpdateCall) Context(ctx context.Context) *ProjectsAttestorsUpdateCall {
  2110. c.ctx_ = ctx
  2111. return c
  2112. }
  2113. // Header returns an http.Header that can be modified by the caller to
  2114. // add HTTP headers to the request.
  2115. func (c *ProjectsAttestorsUpdateCall) Header() http.Header {
  2116. if c.header_ == nil {
  2117. c.header_ = make(http.Header)
  2118. }
  2119. return c.header_
  2120. }
  2121. func (c *ProjectsAttestorsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2122. reqHeaders := make(http.Header)
  2123. for k, v := range c.header_ {
  2124. reqHeaders[k] = v
  2125. }
  2126. reqHeaders.Set("User-Agent", c.s.userAgent())
  2127. var body io.Reader = nil
  2128. body, err := googleapi.WithoutDataWrapper.JSONReader(c.attestor)
  2129. if err != nil {
  2130. return nil, err
  2131. }
  2132. reqHeaders.Set("Content-Type", "application/json")
  2133. c.urlParams_.Set("alt", alt)
  2134. c.urlParams_.Set("prettyPrint", "false")
  2135. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  2136. urls += "?" + c.urlParams_.Encode()
  2137. req, err := http.NewRequest("PUT", urls, body)
  2138. if err != nil {
  2139. return nil, err
  2140. }
  2141. req.Header = reqHeaders
  2142. googleapi.Expand(req.URL, map[string]string{
  2143. "name": c.name,
  2144. })
  2145. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2146. }
  2147. // Do executes the "binaryauthorization.projects.attestors.update" call.
  2148. // Exactly one of *Attestor or error will be non-nil. Any non-2xx status
  2149. // code is an error. Response headers are in either
  2150. // *Attestor.ServerResponse.Header or (if a response was returned at
  2151. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2152. // to check whether the returned error was because
  2153. // http.StatusNotModified was returned.
  2154. func (c *ProjectsAttestorsUpdateCall) Do(opts ...googleapi.CallOption) (*Attestor, error) {
  2155. gensupport.SetOptions(c.urlParams_, opts...)
  2156. res, err := c.doRequest("json")
  2157. if res != nil && res.StatusCode == http.StatusNotModified {
  2158. if res.Body != nil {
  2159. res.Body.Close()
  2160. }
  2161. return nil, &googleapi.Error{
  2162. Code: res.StatusCode,
  2163. Header: res.Header,
  2164. }
  2165. }
  2166. if err != nil {
  2167. return nil, err
  2168. }
  2169. defer googleapi.CloseBody(res)
  2170. if err := googleapi.CheckResponse(res); err != nil {
  2171. return nil, err
  2172. }
  2173. ret := &Attestor{
  2174. ServerResponse: googleapi.ServerResponse{
  2175. Header: res.Header,
  2176. HTTPStatusCode: res.StatusCode,
  2177. },
  2178. }
  2179. target := &ret
  2180. if err := gensupport.DecodeResponse(target, res); err != nil {
  2181. return nil, err
  2182. }
  2183. return ret, nil
  2184. // {
  2185. // "description": "Updates an attestor.\nReturns NOT_FOUND if the attestor does not exist.",
  2186. // "flatPath": "v1beta1/projects/{projectsId}/attestors/{attestorsId}",
  2187. // "httpMethod": "PUT",
  2188. // "id": "binaryauthorization.projects.attestors.update",
  2189. // "parameterOrder": [
  2190. // "name"
  2191. // ],
  2192. // "parameters": {
  2193. // "name": {
  2194. // "description": "Required. The resource name, in the format:\n`projects/*/attestors/*`. This field may not be updated.",
  2195. // "location": "path",
  2196. // "pattern": "^projects/[^/]+/attestors/[^/]+$",
  2197. // "required": true,
  2198. // "type": "string"
  2199. // }
  2200. // },
  2201. // "path": "v1beta1/{+name}",
  2202. // "request": {
  2203. // "$ref": "Attestor"
  2204. // },
  2205. // "response": {
  2206. // "$ref": "Attestor"
  2207. // },
  2208. // "scopes": [
  2209. // "https://www.googleapis.com/auth/cloud-platform"
  2210. // ]
  2211. // }
  2212. }
  2213. // method id "binaryauthorization.projects.policy.getIamPolicy":
  2214. type ProjectsPolicyGetIamPolicyCall struct {
  2215. s *Service
  2216. resource string
  2217. urlParams_ gensupport.URLParams
  2218. ifNoneMatch_ string
  2219. ctx_ context.Context
  2220. header_ http.Header
  2221. }
  2222. // GetIamPolicy: Gets the access control policy for a resource.
  2223. // Returns an empty policy if the resource exists and does not have a
  2224. // policy
  2225. // set.
  2226. func (r *ProjectsPolicyService) GetIamPolicy(resource string) *ProjectsPolicyGetIamPolicyCall {
  2227. c := &ProjectsPolicyGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2228. c.resource = resource
  2229. return c
  2230. }
  2231. // Fields allows partial responses to be retrieved. See
  2232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2233. // for more information.
  2234. func (c *ProjectsPolicyGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsPolicyGetIamPolicyCall {
  2235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2236. return c
  2237. }
  2238. // IfNoneMatch sets the optional parameter which makes the operation
  2239. // fail if the object's ETag matches the given value. This is useful for
  2240. // getting updates only after the object has changed since the last
  2241. // request. Use googleapi.IsNotModified to check whether the response
  2242. // error from Do is the result of In-None-Match.
  2243. func (c *ProjectsPolicyGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsPolicyGetIamPolicyCall {
  2244. c.ifNoneMatch_ = entityTag
  2245. return c
  2246. }
  2247. // Context sets the context to be used in this call's Do method. Any
  2248. // pending HTTP request will be aborted if the provided context is
  2249. // canceled.
  2250. func (c *ProjectsPolicyGetIamPolicyCall) Context(ctx context.Context) *ProjectsPolicyGetIamPolicyCall {
  2251. c.ctx_ = ctx
  2252. return c
  2253. }
  2254. // Header returns an http.Header that can be modified by the caller to
  2255. // add HTTP headers to the request.
  2256. func (c *ProjectsPolicyGetIamPolicyCall) Header() http.Header {
  2257. if c.header_ == nil {
  2258. c.header_ = make(http.Header)
  2259. }
  2260. return c.header_
  2261. }
  2262. func (c *ProjectsPolicyGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2263. reqHeaders := make(http.Header)
  2264. for k, v := range c.header_ {
  2265. reqHeaders[k] = v
  2266. }
  2267. reqHeaders.Set("User-Agent", c.s.userAgent())
  2268. if c.ifNoneMatch_ != "" {
  2269. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2270. }
  2271. var body io.Reader = nil
  2272. c.urlParams_.Set("alt", alt)
  2273. c.urlParams_.Set("prettyPrint", "false")
  2274. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
  2275. urls += "?" + c.urlParams_.Encode()
  2276. req, err := http.NewRequest("GET", urls, body)
  2277. if err != nil {
  2278. return nil, err
  2279. }
  2280. req.Header = reqHeaders
  2281. googleapi.Expand(req.URL, map[string]string{
  2282. "resource": c.resource,
  2283. })
  2284. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2285. }
  2286. // Do executes the "binaryauthorization.projects.policy.getIamPolicy" call.
  2287. // Exactly one of *IamPolicy or error will be non-nil. Any non-2xx
  2288. // status code is an error. Response headers are in either
  2289. // *IamPolicy.ServerResponse.Header or (if a response was returned at
  2290. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2291. // to check whether the returned error was because
  2292. // http.StatusNotModified was returned.
  2293. func (c *ProjectsPolicyGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*IamPolicy, error) {
  2294. gensupport.SetOptions(c.urlParams_, opts...)
  2295. res, err := c.doRequest("json")
  2296. if res != nil && res.StatusCode == http.StatusNotModified {
  2297. if res.Body != nil {
  2298. res.Body.Close()
  2299. }
  2300. return nil, &googleapi.Error{
  2301. Code: res.StatusCode,
  2302. Header: res.Header,
  2303. }
  2304. }
  2305. if err != nil {
  2306. return nil, err
  2307. }
  2308. defer googleapi.CloseBody(res)
  2309. if err := googleapi.CheckResponse(res); err != nil {
  2310. return nil, err
  2311. }
  2312. ret := &IamPolicy{
  2313. ServerResponse: googleapi.ServerResponse{
  2314. Header: res.Header,
  2315. HTTPStatusCode: res.StatusCode,
  2316. },
  2317. }
  2318. target := &ret
  2319. if err := gensupport.DecodeResponse(target, res); err != nil {
  2320. return nil, err
  2321. }
  2322. return ret, nil
  2323. // {
  2324. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  2325. // "flatPath": "v1beta1/projects/{projectsId}/policy:getIamPolicy",
  2326. // "httpMethod": "GET",
  2327. // "id": "binaryauthorization.projects.policy.getIamPolicy",
  2328. // "parameterOrder": [
  2329. // "resource"
  2330. // ],
  2331. // "parameters": {
  2332. // "resource": {
  2333. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2334. // "location": "path",
  2335. // "pattern": "^projects/[^/]+/policy$",
  2336. // "required": true,
  2337. // "type": "string"
  2338. // }
  2339. // },
  2340. // "path": "v1beta1/{+resource}:getIamPolicy",
  2341. // "response": {
  2342. // "$ref": "IamPolicy"
  2343. // },
  2344. // "scopes": [
  2345. // "https://www.googleapis.com/auth/cloud-platform"
  2346. // ]
  2347. // }
  2348. }
  2349. // method id "binaryauthorization.projects.policy.setIamPolicy":
  2350. type ProjectsPolicySetIamPolicyCall struct {
  2351. s *Service
  2352. resource string
  2353. setiampolicyrequest *SetIamPolicyRequest
  2354. urlParams_ gensupport.URLParams
  2355. ctx_ context.Context
  2356. header_ http.Header
  2357. }
  2358. // SetIamPolicy: Sets the access control policy on the specified
  2359. // resource. Replaces any
  2360. // existing policy.
  2361. func (r *ProjectsPolicyService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsPolicySetIamPolicyCall {
  2362. c := &ProjectsPolicySetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2363. c.resource = resource
  2364. c.setiampolicyrequest = setiampolicyrequest
  2365. return c
  2366. }
  2367. // Fields allows partial responses to be retrieved. See
  2368. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2369. // for more information.
  2370. func (c *ProjectsPolicySetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsPolicySetIamPolicyCall {
  2371. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2372. return c
  2373. }
  2374. // Context sets the context to be used in this call's Do method. Any
  2375. // pending HTTP request will be aborted if the provided context is
  2376. // canceled.
  2377. func (c *ProjectsPolicySetIamPolicyCall) Context(ctx context.Context) *ProjectsPolicySetIamPolicyCall {
  2378. c.ctx_ = ctx
  2379. return c
  2380. }
  2381. // Header returns an http.Header that can be modified by the caller to
  2382. // add HTTP headers to the request.
  2383. func (c *ProjectsPolicySetIamPolicyCall) Header() http.Header {
  2384. if c.header_ == nil {
  2385. c.header_ = make(http.Header)
  2386. }
  2387. return c.header_
  2388. }
  2389. func (c *ProjectsPolicySetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2390. reqHeaders := make(http.Header)
  2391. for k, v := range c.header_ {
  2392. reqHeaders[k] = v
  2393. }
  2394. reqHeaders.Set("User-Agent", c.s.userAgent())
  2395. var body io.Reader = nil
  2396. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2397. if err != nil {
  2398. return nil, err
  2399. }
  2400. reqHeaders.Set("Content-Type", "application/json")
  2401. c.urlParams_.Set("alt", alt)
  2402. c.urlParams_.Set("prettyPrint", "false")
  2403. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
  2404. urls += "?" + c.urlParams_.Encode()
  2405. req, err := http.NewRequest("POST", urls, body)
  2406. if err != nil {
  2407. return nil, err
  2408. }
  2409. req.Header = reqHeaders
  2410. googleapi.Expand(req.URL, map[string]string{
  2411. "resource": c.resource,
  2412. })
  2413. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2414. }
  2415. // Do executes the "binaryauthorization.projects.policy.setIamPolicy" call.
  2416. // Exactly one of *IamPolicy or error will be non-nil. Any non-2xx
  2417. // status code is an error. Response headers are in either
  2418. // *IamPolicy.ServerResponse.Header or (if a response was returned at
  2419. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2420. // to check whether the returned error was because
  2421. // http.StatusNotModified was returned.
  2422. func (c *ProjectsPolicySetIamPolicyCall) Do(opts ...googleapi.CallOption) (*IamPolicy, error) {
  2423. gensupport.SetOptions(c.urlParams_, opts...)
  2424. res, err := c.doRequest("json")
  2425. if res != nil && res.StatusCode == http.StatusNotModified {
  2426. if res.Body != nil {
  2427. res.Body.Close()
  2428. }
  2429. return nil, &googleapi.Error{
  2430. Code: res.StatusCode,
  2431. Header: res.Header,
  2432. }
  2433. }
  2434. if err != nil {
  2435. return nil, err
  2436. }
  2437. defer googleapi.CloseBody(res)
  2438. if err := googleapi.CheckResponse(res); err != nil {
  2439. return nil, err
  2440. }
  2441. ret := &IamPolicy{
  2442. ServerResponse: googleapi.ServerResponse{
  2443. Header: res.Header,
  2444. HTTPStatusCode: res.StatusCode,
  2445. },
  2446. }
  2447. target := &ret
  2448. if err := gensupport.DecodeResponse(target, res); err != nil {
  2449. return nil, err
  2450. }
  2451. return ret, nil
  2452. // {
  2453. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2454. // "flatPath": "v1beta1/projects/{projectsId}/policy:setIamPolicy",
  2455. // "httpMethod": "POST",
  2456. // "id": "binaryauthorization.projects.policy.setIamPolicy",
  2457. // "parameterOrder": [
  2458. // "resource"
  2459. // ],
  2460. // "parameters": {
  2461. // "resource": {
  2462. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2463. // "location": "path",
  2464. // "pattern": "^projects/[^/]+/policy$",
  2465. // "required": true,
  2466. // "type": "string"
  2467. // }
  2468. // },
  2469. // "path": "v1beta1/{+resource}:setIamPolicy",
  2470. // "request": {
  2471. // "$ref": "SetIamPolicyRequest"
  2472. // },
  2473. // "response": {
  2474. // "$ref": "IamPolicy"
  2475. // },
  2476. // "scopes": [
  2477. // "https://www.googleapis.com/auth/cloud-platform"
  2478. // ]
  2479. // }
  2480. }
  2481. // method id "binaryauthorization.projects.policy.testIamPermissions":
  2482. type ProjectsPolicyTestIamPermissionsCall struct {
  2483. s *Service
  2484. resource string
  2485. testiampermissionsrequest *TestIamPermissionsRequest
  2486. urlParams_ gensupport.URLParams
  2487. ctx_ context.Context
  2488. header_ http.Header
  2489. }
  2490. // TestIamPermissions: Returns permissions that a caller has on the
  2491. // specified resource.
  2492. // If the resource does not exist, this will return an empty set
  2493. // of
  2494. // permissions, not a NOT_FOUND error.
  2495. //
  2496. // Note: This operation is designed to be used for building
  2497. // permission-aware
  2498. // UIs and command-line tools, not for authorization checking. This
  2499. // operation
  2500. // may "fail open" without warning.
  2501. func (r *ProjectsPolicyService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsPolicyTestIamPermissionsCall {
  2502. c := &ProjectsPolicyTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2503. c.resource = resource
  2504. c.testiampermissionsrequest = testiampermissionsrequest
  2505. return c
  2506. }
  2507. // Fields allows partial responses to be retrieved. See
  2508. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2509. // for more information.
  2510. func (c *ProjectsPolicyTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsPolicyTestIamPermissionsCall {
  2511. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2512. return c
  2513. }
  2514. // Context sets the context to be used in this call's Do method. Any
  2515. // pending HTTP request will be aborted if the provided context is
  2516. // canceled.
  2517. func (c *ProjectsPolicyTestIamPermissionsCall) Context(ctx context.Context) *ProjectsPolicyTestIamPermissionsCall {
  2518. c.ctx_ = ctx
  2519. return c
  2520. }
  2521. // Header returns an http.Header that can be modified by the caller to
  2522. // add HTTP headers to the request.
  2523. func (c *ProjectsPolicyTestIamPermissionsCall) Header() http.Header {
  2524. if c.header_ == nil {
  2525. c.header_ = make(http.Header)
  2526. }
  2527. return c.header_
  2528. }
  2529. func (c *ProjectsPolicyTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2530. reqHeaders := make(http.Header)
  2531. for k, v := range c.header_ {
  2532. reqHeaders[k] = v
  2533. }
  2534. reqHeaders.Set("User-Agent", c.s.userAgent())
  2535. var body io.Reader = nil
  2536. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2537. if err != nil {
  2538. return nil, err
  2539. }
  2540. reqHeaders.Set("Content-Type", "application/json")
  2541. c.urlParams_.Set("alt", alt)
  2542. c.urlParams_.Set("prettyPrint", "false")
  2543. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
  2544. urls += "?" + c.urlParams_.Encode()
  2545. req, err := http.NewRequest("POST", urls, body)
  2546. if err != nil {
  2547. return nil, err
  2548. }
  2549. req.Header = reqHeaders
  2550. googleapi.Expand(req.URL, map[string]string{
  2551. "resource": c.resource,
  2552. })
  2553. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2554. }
  2555. // Do executes the "binaryauthorization.projects.policy.testIamPermissions" call.
  2556. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2557. // Any non-2xx status code is an error. Response headers are in either
  2558. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2559. // was returned at all) in error.(*googleapi.Error).Header. Use
  2560. // googleapi.IsNotModified to check whether the returned error was
  2561. // because http.StatusNotModified was returned.
  2562. func (c *ProjectsPolicyTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2563. gensupport.SetOptions(c.urlParams_, opts...)
  2564. res, err := c.doRequest("json")
  2565. if res != nil && res.StatusCode == http.StatusNotModified {
  2566. if res.Body != nil {
  2567. res.Body.Close()
  2568. }
  2569. return nil, &googleapi.Error{
  2570. Code: res.StatusCode,
  2571. Header: res.Header,
  2572. }
  2573. }
  2574. if err != nil {
  2575. return nil, err
  2576. }
  2577. defer googleapi.CloseBody(res)
  2578. if err := googleapi.CheckResponse(res); err != nil {
  2579. return nil, err
  2580. }
  2581. ret := &TestIamPermissionsResponse{
  2582. ServerResponse: googleapi.ServerResponse{
  2583. Header: res.Header,
  2584. HTTPStatusCode: res.StatusCode,
  2585. },
  2586. }
  2587. target := &ret
  2588. if err := gensupport.DecodeResponse(target, res); err != nil {
  2589. return nil, err
  2590. }
  2591. return ret, nil
  2592. // {
  2593. // "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.",
  2594. // "flatPath": "v1beta1/projects/{projectsId}/policy:testIamPermissions",
  2595. // "httpMethod": "POST",
  2596. // "id": "binaryauthorization.projects.policy.testIamPermissions",
  2597. // "parameterOrder": [
  2598. // "resource"
  2599. // ],
  2600. // "parameters": {
  2601. // "resource": {
  2602. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2603. // "location": "path",
  2604. // "pattern": "^projects/[^/]+/policy$",
  2605. // "required": true,
  2606. // "type": "string"
  2607. // }
  2608. // },
  2609. // "path": "v1beta1/{+resource}:testIamPermissions",
  2610. // "request": {
  2611. // "$ref": "TestIamPermissionsRequest"
  2612. // },
  2613. // "response": {
  2614. // "$ref": "TestIamPermissionsResponse"
  2615. // },
  2616. // "scopes": [
  2617. // "https://www.googleapis.com/auth/cloud-platform"
  2618. // ]
  2619. // }
  2620. }