Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

2472 рядки
83 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 sourcerepo provides access to the Cloud Source Repositories API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/source-repositories/docs/apis
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/sourcerepo/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // sourcerepoService, err := sourcerepo.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. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // sourcerepoService, err := sourcerepo.NewService(ctx, option.WithScopes(sourcerepo.SourceReadWriteScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // sourcerepoService, err := sourcerepo.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // sourcerepoService, err := sourcerepo.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package sourcerepo // import "google.golang.org/api/sourcerepo/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "sourcerepo:v1"
  71. const apiName = "sourcerepo"
  72. const apiVersion = "v1"
  73. const basePath = "https://sourcerepo.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // Manage your source code repositories
  79. SourceFullControlScope = "https://www.googleapis.com/auth/source.full_control"
  80. // View the contents of your source code repositories
  81. SourceReadOnlyScope = "https://www.googleapis.com/auth/source.read_only"
  82. // Manage the contents of your source code repositories
  83. SourceReadWriteScope = "https://www.googleapis.com/auth/source.read_write"
  84. )
  85. // NewService creates a new Service.
  86. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  87. scopesOption := option.WithScopes(
  88. "https://www.googleapis.com/auth/cloud-platform",
  89. "https://www.googleapis.com/auth/source.full_control",
  90. "https://www.googleapis.com/auth/source.read_only",
  91. "https://www.googleapis.com/auth/source.read_write",
  92. )
  93. // NOTE: prepend, so we don't override user-specified scopes.
  94. opts = append([]option.ClientOption{scopesOption}, opts...)
  95. client, endpoint, err := htransport.NewClient(ctx, opts...)
  96. if err != nil {
  97. return nil, err
  98. }
  99. s, err := New(client)
  100. if err != nil {
  101. return nil, err
  102. }
  103. if endpoint != "" {
  104. s.BasePath = endpoint
  105. }
  106. return s, nil
  107. }
  108. // New creates a new Service. It uses the provided http.Client for requests.
  109. //
  110. // Deprecated: please use NewService instead.
  111. // To provide a custom HTTP client, use option.WithHTTPClient.
  112. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  113. func New(client *http.Client) (*Service, error) {
  114. if client == nil {
  115. return nil, errors.New("client is nil")
  116. }
  117. s := &Service{client: client, BasePath: basePath}
  118. s.Projects = NewProjectsService(s)
  119. return s, nil
  120. }
  121. type Service struct {
  122. client *http.Client
  123. BasePath string // API endpoint base URL
  124. UserAgent string // optional additional User-Agent fragment
  125. Projects *ProjectsService
  126. }
  127. func (s *Service) userAgent() string {
  128. if s.UserAgent == "" {
  129. return googleapi.UserAgent
  130. }
  131. return googleapi.UserAgent + " " + s.UserAgent
  132. }
  133. func NewProjectsService(s *Service) *ProjectsService {
  134. rs := &ProjectsService{s: s}
  135. rs.Repos = NewProjectsReposService(s)
  136. return rs
  137. }
  138. type ProjectsService struct {
  139. s *Service
  140. Repos *ProjectsReposService
  141. }
  142. func NewProjectsReposService(s *Service) *ProjectsReposService {
  143. rs := &ProjectsReposService{s: s}
  144. return rs
  145. }
  146. type ProjectsReposService struct {
  147. s *Service
  148. }
  149. // AuditConfig: Specifies the audit configuration for a service.
  150. // The configuration determines which permission types are logged, and
  151. // what
  152. // identities, if any, are exempted from logging.
  153. // An AuditConfig must have one or more AuditLogConfigs.
  154. //
  155. // If there are AuditConfigs for both `allServices` and a specific
  156. // service,
  157. // the union of the two AuditConfigs is used for that service: the
  158. // log_types
  159. // specified in each AuditConfig are enabled, and the exempted_members
  160. // in each
  161. // AuditLogConfig are exempted.
  162. //
  163. // Example Policy with multiple AuditConfigs:
  164. //
  165. // {
  166. // "audit_configs": [
  167. // {
  168. // "service": "allServices"
  169. // "audit_log_configs": [
  170. // {
  171. // "log_type": "DATA_READ",
  172. // "exempted_members": [
  173. // "user:foo@gmail.com"
  174. // ]
  175. // },
  176. // {
  177. // "log_type": "DATA_WRITE",
  178. // },
  179. // {
  180. // "log_type": "ADMIN_READ",
  181. // }
  182. // ]
  183. // },
  184. // {
  185. // "service": "fooservice.googleapis.com"
  186. // "audit_log_configs": [
  187. // {
  188. // "log_type": "DATA_READ",
  189. // },
  190. // {
  191. // "log_type": "DATA_WRITE",
  192. // "exempted_members": [
  193. // "user:bar@gmail.com"
  194. // ]
  195. // }
  196. // ]
  197. // }
  198. // ]
  199. // }
  200. //
  201. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  202. // ADMIN_READ
  203. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  204. // and
  205. // bar@gmail.com from DATA_WRITE logging.
  206. type AuditConfig struct {
  207. // AuditLogConfigs: The configuration for logging of each type of
  208. // permission.
  209. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  210. // Service: Specifies a service that will be enabled for audit
  211. // logging.
  212. // For example, `storage.googleapis.com`,
  213. // `cloudsql.googleapis.com`.
  214. // `allServices` is a special value that covers all services.
  215. Service string `json:"service,omitempty"`
  216. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  217. // unconditionally include in API requests. By default, fields with
  218. // empty values are omitted from API requests. However, any non-pointer,
  219. // non-interface field appearing in ForceSendFields will be sent to the
  220. // server regardless of whether the field is empty or not. This may be
  221. // used to include empty fields in Patch requests.
  222. ForceSendFields []string `json:"-"`
  223. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  224. // include in API requests with the JSON null value. By default, fields
  225. // with empty values are omitted from API requests. However, any field
  226. // with an empty value appearing in NullFields will be sent to the
  227. // server as null. It is an error if a field in this list has a
  228. // non-empty value. This may be used to include null fields in Patch
  229. // requests.
  230. NullFields []string `json:"-"`
  231. }
  232. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  233. type NoMethod AuditConfig
  234. raw := NoMethod(*s)
  235. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  236. }
  237. // AuditLogConfig: Provides the configuration for logging a type of
  238. // permissions.
  239. // Example:
  240. //
  241. // {
  242. // "audit_log_configs": [
  243. // {
  244. // "log_type": "DATA_READ",
  245. // "exempted_members": [
  246. // "user:foo@gmail.com"
  247. // ]
  248. // },
  249. // {
  250. // "log_type": "DATA_WRITE",
  251. // }
  252. // ]
  253. // }
  254. //
  255. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  256. // exempting
  257. // foo@gmail.com from DATA_READ logging.
  258. type AuditLogConfig struct {
  259. // ExemptedMembers: Specifies the identities that do not cause logging
  260. // for this type of
  261. // permission.
  262. // Follows the same format of Binding.members.
  263. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  264. // LogType: The log type that this config enables.
  265. //
  266. // Possible values:
  267. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  268. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  269. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  270. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  271. LogType string `json:"logType,omitempty"`
  272. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  273. // unconditionally include in API requests. By default, fields with
  274. // empty values are omitted from API requests. However, any non-pointer,
  275. // non-interface field appearing in ForceSendFields will be sent to the
  276. // server regardless of whether the field is empty or not. This may be
  277. // used to include empty fields in Patch requests.
  278. ForceSendFields []string `json:"-"`
  279. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  280. // include in API requests with the JSON null value. By default, fields
  281. // with empty values are omitted from API requests. However, any field
  282. // with an empty value appearing in NullFields will be sent to the
  283. // server as null. It is an error if a field in this list has a
  284. // non-empty value. This may be used to include null fields in Patch
  285. // requests.
  286. NullFields []string `json:"-"`
  287. }
  288. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  289. type NoMethod AuditLogConfig
  290. raw := NoMethod(*s)
  291. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  292. }
  293. // Binding: Associates `members` with a `role`.
  294. type Binding struct {
  295. // Condition: Unimplemented. The condition that is associated with this
  296. // binding.
  297. // NOTE: an unsatisfied condition will not allow user access via
  298. // current
  299. // binding. Different bindings, including their conditions, are
  300. // examined
  301. // independently.
  302. Condition *Expr `json:"condition,omitempty"`
  303. // Members: Specifies the identities requesting access for a Cloud
  304. // Platform resource.
  305. // `members` can have the following values:
  306. //
  307. // * `allUsers`: A special identifier that represents anyone who is
  308. // on the internet; with or without a Google account.
  309. //
  310. // * `allAuthenticatedUsers`: A special identifier that represents
  311. // anyone
  312. // who is authenticated with a Google account or a service
  313. // account.
  314. //
  315. // * `user:{emailid}`: An email address that represents a specific
  316. // Google
  317. // account. For example, `alice@gmail.com` .
  318. //
  319. //
  320. // * `serviceAccount:{emailid}`: An email address that represents a
  321. // service
  322. // account. For example,
  323. // `my-other-app@appspot.gserviceaccount.com`.
  324. //
  325. // * `group:{emailid}`: An email address that represents a Google
  326. // group.
  327. // For example, `admins@example.com`.
  328. //
  329. //
  330. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  331. // the
  332. // users of that domain. For example, `google.com` or
  333. // `example.com`.
  334. //
  335. //
  336. Members []string `json:"members,omitempty"`
  337. // Role: Role that is assigned to `members`.
  338. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  339. Role string `json:"role,omitempty"`
  340. // ForceSendFields is a list of field names (e.g. "Condition") to
  341. // unconditionally include in API requests. By default, fields with
  342. // empty values are omitted from API requests. However, any non-pointer,
  343. // non-interface field appearing in ForceSendFields will be sent to the
  344. // server regardless of whether the field is empty or not. This may be
  345. // used to include empty fields in Patch requests.
  346. ForceSendFields []string `json:"-"`
  347. // NullFields is a list of field names (e.g. "Condition") to include in
  348. // API requests with the JSON null value. By default, fields with empty
  349. // values are omitted from API requests. However, any field with an
  350. // empty value appearing in NullFields will be sent to the server as
  351. // null. It is an error if a field in this list has a non-empty value.
  352. // This may be used to include null fields in Patch requests.
  353. NullFields []string `json:"-"`
  354. }
  355. func (s *Binding) MarshalJSON() ([]byte, error) {
  356. type NoMethod Binding
  357. raw := NoMethod(*s)
  358. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  359. }
  360. // Empty: A generic empty message that you can re-use to avoid defining
  361. // duplicated
  362. // empty messages in your APIs. A typical example is to use it as the
  363. // request
  364. // or the response type of an API method. For instance:
  365. //
  366. // service Foo {
  367. // rpc Bar(google.protobuf.Empty) returns
  368. // (google.protobuf.Empty);
  369. // }
  370. //
  371. // The JSON representation for `Empty` is empty JSON object `{}`.
  372. type Empty struct {
  373. // ServerResponse contains the HTTP response code and headers from the
  374. // server.
  375. googleapi.ServerResponse `json:"-"`
  376. }
  377. // Expr: Represents an expression text. Example:
  378. //
  379. // title: "User account presence"
  380. // description: "Determines whether the request has a user account"
  381. // expression: "size(request.user) > 0"
  382. type Expr struct {
  383. // Description: An optional description of the expression. This is a
  384. // longer text which
  385. // describes the expression, e.g. when hovered over it in a UI.
  386. Description string `json:"description,omitempty"`
  387. // Expression: Textual representation of an expression in
  388. // Common Expression Language syntax.
  389. //
  390. // The application context of the containing message determines
  391. // which
  392. // well-known feature set of CEL is supported.
  393. Expression string `json:"expression,omitempty"`
  394. // Location: An optional string indicating the location of the
  395. // expression for error
  396. // reporting, e.g. a file name and a position in the file.
  397. Location string `json:"location,omitempty"`
  398. // Title: An optional title for the expression, i.e. a short string
  399. // describing
  400. // its purpose. This can be used e.g. in UIs which allow to enter
  401. // the
  402. // expression.
  403. Title string `json:"title,omitempty"`
  404. // ForceSendFields is a list of field names (e.g. "Description") to
  405. // unconditionally include in API requests. By default, fields with
  406. // empty values are omitted from API requests. However, any non-pointer,
  407. // non-interface field appearing in ForceSendFields will be sent to the
  408. // server regardless of whether the field is empty or not. This may be
  409. // used to include empty fields in Patch requests.
  410. ForceSendFields []string `json:"-"`
  411. // NullFields is a list of field names (e.g. "Description") to include
  412. // in API requests with the JSON null value. By default, fields with
  413. // empty values are omitted from API requests. However, any field with
  414. // an empty value appearing in NullFields will be sent to the server as
  415. // null. It is an error if a field in this list has a non-empty value.
  416. // This may be used to include null fields in Patch requests.
  417. NullFields []string `json:"-"`
  418. }
  419. func (s *Expr) MarshalJSON() ([]byte, error) {
  420. type NoMethod Expr
  421. raw := NoMethod(*s)
  422. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  423. }
  424. // ListReposResponse: Response for ListRepos. The size is not set in
  425. // the returned repositories.
  426. type ListReposResponse struct {
  427. // NextPageToken: If non-empty, additional repositories exist within the
  428. // project. These
  429. // can be retrieved by including this value in the next
  430. // ListReposRequest's
  431. // page_token field.
  432. NextPageToken string `json:"nextPageToken,omitempty"`
  433. // Repos: The listed repos.
  434. Repos []*Repo `json:"repos,omitempty"`
  435. // ServerResponse contains the HTTP response code and headers from the
  436. // server.
  437. googleapi.ServerResponse `json:"-"`
  438. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  439. // unconditionally include in API requests. By default, fields with
  440. // empty values are omitted from API requests. However, any non-pointer,
  441. // non-interface field appearing in ForceSendFields will be sent to the
  442. // server regardless of whether the field is empty or not. This may be
  443. // used to include empty fields in Patch requests.
  444. ForceSendFields []string `json:"-"`
  445. // NullFields is a list of field names (e.g. "NextPageToken") to include
  446. // in API requests with the JSON null value. By default, fields with
  447. // empty values are omitted from API requests. However, any field with
  448. // an empty value appearing in NullFields will be sent to the server as
  449. // null. It is an error if a field in this list has a non-empty value.
  450. // This may be used to include null fields in Patch requests.
  451. NullFields []string `json:"-"`
  452. }
  453. func (s *ListReposResponse) MarshalJSON() ([]byte, error) {
  454. type NoMethod ListReposResponse
  455. raw := NoMethod(*s)
  456. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  457. }
  458. // MirrorConfig: Configuration to automatically mirror a repository from
  459. // another
  460. // hosting service, for example GitHub or Bitbucket.
  461. type MirrorConfig struct {
  462. // DeployKeyId: ID of the SSH deploy key at the other hosting
  463. // service.
  464. // Removing this key from the other service would deauthorize
  465. // Google Cloud Source Repositories from mirroring.
  466. DeployKeyId string `json:"deployKeyId,omitempty"`
  467. // Url: URL of the main repository at the other hosting service.
  468. Url string `json:"url,omitempty"`
  469. // WebhookId: ID of the webhook listening to updates to trigger
  470. // mirroring.
  471. // Removing this webhook from the other hosting service will stop
  472. // Google Cloud Source Repositories from receiving notifications,
  473. // and thereby disabling mirroring.
  474. WebhookId string `json:"webhookId,omitempty"`
  475. // ForceSendFields is a list of field names (e.g. "DeployKeyId") to
  476. // unconditionally include in API requests. By default, fields with
  477. // empty values are omitted from API requests. However, any non-pointer,
  478. // non-interface field appearing in ForceSendFields will be sent to the
  479. // server regardless of whether the field is empty or not. This may be
  480. // used to include empty fields in Patch requests.
  481. ForceSendFields []string `json:"-"`
  482. // NullFields is a list of field names (e.g. "DeployKeyId") to include
  483. // in API requests with the JSON null value. By default, fields with
  484. // empty values are omitted from API requests. However, any field with
  485. // an empty value appearing in NullFields will be sent to the server as
  486. // null. It is an error if a field in this list has a non-empty value.
  487. // This may be used to include null fields in Patch requests.
  488. NullFields []string `json:"-"`
  489. }
  490. func (s *MirrorConfig) MarshalJSON() ([]byte, error) {
  491. type NoMethod MirrorConfig
  492. raw := NoMethod(*s)
  493. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  494. }
  495. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  496. // used to
  497. // specify access control policies for Cloud Platform resources.
  498. //
  499. //
  500. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  501. // of
  502. // `members` to a `role`, where the members can be user accounts, Google
  503. // groups,
  504. // Google domains, and service accounts. A `role` is a named list of
  505. // permissions
  506. // defined by IAM.
  507. //
  508. // **JSON Example**
  509. //
  510. // {
  511. // "bindings": [
  512. // {
  513. // "role": "roles/owner",
  514. // "members": [
  515. // "user:mike@example.com",
  516. // "group:admins@example.com",
  517. // "domain:google.com",
  518. //
  519. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  520. // ]
  521. // },
  522. // {
  523. // "role": "roles/viewer",
  524. // "members": ["user:sean@example.com"]
  525. // }
  526. // ]
  527. // }
  528. //
  529. // **YAML Example**
  530. //
  531. // bindings:
  532. // - members:
  533. // - user:mike@example.com
  534. // - group:admins@example.com
  535. // - domain:google.com
  536. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  537. // role: roles/owner
  538. // - members:
  539. // - user:sean@example.com
  540. // role: roles/viewer
  541. //
  542. //
  543. // For a description of IAM and its features, see the
  544. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  545. type Policy struct {
  546. // AuditConfigs: Specifies cloud audit logging configuration for this
  547. // policy.
  548. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  549. // Bindings: Associates a list of `members` to a `role`.
  550. // `bindings` with no members will result in an error.
  551. Bindings []*Binding `json:"bindings,omitempty"`
  552. // Etag: `etag` is used for optimistic concurrency control as a way to
  553. // help
  554. // prevent simultaneous updates of a policy from overwriting each
  555. // other.
  556. // It is strongly suggested that systems make use of the `etag` in
  557. // the
  558. // read-modify-write cycle to perform policy updates in order to avoid
  559. // race
  560. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  561. // and
  562. // systems are expected to put that etag in the request to
  563. // `setIamPolicy` to
  564. // ensure that their change will be applied to the same version of the
  565. // policy.
  566. //
  567. // If no `etag` is provided in the call to `setIamPolicy`, then the
  568. // existing
  569. // policy is overwritten blindly.
  570. Etag string `json:"etag,omitempty"`
  571. // Version: Deprecated.
  572. Version int64 `json:"version,omitempty"`
  573. // ServerResponse contains the HTTP response code and headers from the
  574. // server.
  575. googleapi.ServerResponse `json:"-"`
  576. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  577. // unconditionally include in API requests. By default, fields with
  578. // empty values are omitted from API requests. However, any non-pointer,
  579. // non-interface field appearing in ForceSendFields will be sent to the
  580. // server regardless of whether the field is empty or not. This may be
  581. // used to include empty fields in Patch requests.
  582. ForceSendFields []string `json:"-"`
  583. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  584. // in API requests with the JSON null value. By default, fields with
  585. // empty values are omitted from API requests. However, any field with
  586. // an empty value appearing in NullFields will be sent to the server as
  587. // null. It is an error if a field in this list has a non-empty value.
  588. // This may be used to include null fields in Patch requests.
  589. NullFields []string `json:"-"`
  590. }
  591. func (s *Policy) MarshalJSON() ([]byte, error) {
  592. type NoMethod Policy
  593. raw := NoMethod(*s)
  594. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  595. }
  596. // ProjectConfig: Cloud Source Repositories configuration of a project.
  597. type ProjectConfig struct {
  598. // EnablePrivateKeyCheck: Reject a Git push that contains a private key.
  599. EnablePrivateKeyCheck bool `json:"enablePrivateKeyCheck,omitempty"`
  600. // Name: The name of the project. Values are of the form
  601. // `projects/<project>`.
  602. Name string `json:"name,omitempty"`
  603. // PubsubConfigs: How this project publishes a change in the
  604. // repositories through Cloud
  605. // Pub/Sub. Keyed by the topic names.
  606. PubsubConfigs map[string]PubsubConfig `json:"pubsubConfigs,omitempty"`
  607. // ServerResponse contains the HTTP response code and headers from the
  608. // server.
  609. googleapi.ServerResponse `json:"-"`
  610. // ForceSendFields is a list of field names (e.g.
  611. // "EnablePrivateKeyCheck") to unconditionally include in API requests.
  612. // By default, fields with empty values are omitted from API requests.
  613. // However, any non-pointer, non-interface field appearing in
  614. // ForceSendFields will be sent to the server regardless of whether the
  615. // field is empty or not. This may be used to include empty fields in
  616. // Patch requests.
  617. ForceSendFields []string `json:"-"`
  618. // NullFields is a list of field names (e.g. "EnablePrivateKeyCheck") to
  619. // include in API requests with the JSON null value. By default, fields
  620. // with empty values are omitted from API requests. However, any field
  621. // with an empty value appearing in NullFields will be sent to the
  622. // server as null. It is an error if a field in this list has a
  623. // non-empty value. This may be used to include null fields in Patch
  624. // requests.
  625. NullFields []string `json:"-"`
  626. }
  627. func (s *ProjectConfig) MarshalJSON() ([]byte, error) {
  628. type NoMethod ProjectConfig
  629. raw := NoMethod(*s)
  630. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  631. }
  632. // PubsubConfig: Configuration to publish a Cloud Pub/Sub message.
  633. type PubsubConfig struct {
  634. // MessageFormat: The format of the Cloud Pub/Sub messages.
  635. //
  636. // Possible values:
  637. // "MESSAGE_FORMAT_UNSPECIFIED" - Unspecified.
  638. // "PROTOBUF" - The message payload is a serialized protocol buffer of
  639. // SourceRepoEvent.
  640. // "JSON" - The message payload is a JSON string of SourceRepoEvent.
  641. MessageFormat string `json:"messageFormat,omitempty"`
  642. // ServiceAccountEmail: Email address of the service account used for
  643. // publishing Cloud Pub/Sub
  644. // messages. This service account needs to be in the same project as
  645. // the
  646. // PubsubConfig. When added, the caller needs to
  647. // have
  648. // iam.serviceAccounts.actAs permission on this service account.
  649. // If
  650. // unspecified, it defaults to the compute engine default service
  651. // account.
  652. ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
  653. // Topic: A topic of Cloud Pub/Sub. Values are of the
  654. // form
  655. // `projects/<project>/topics/<topic>`. The project needs to be the
  656. // same
  657. // project as this config is in.
  658. Topic string `json:"topic,omitempty"`
  659. // ForceSendFields is a list of field names (e.g. "MessageFormat") to
  660. // unconditionally include in API requests. By default, fields with
  661. // empty values are omitted from API requests. However, any non-pointer,
  662. // non-interface field appearing in ForceSendFields will be sent to the
  663. // server regardless of whether the field is empty or not. This may be
  664. // used to include empty fields in Patch requests.
  665. ForceSendFields []string `json:"-"`
  666. // NullFields is a list of field names (e.g. "MessageFormat") to include
  667. // in API requests with the JSON null value. By default, fields with
  668. // empty values are omitted from API requests. However, any field with
  669. // an empty value appearing in NullFields will be sent to the server as
  670. // null. It is an error if a field in this list has a non-empty value.
  671. // This may be used to include null fields in Patch requests.
  672. NullFields []string `json:"-"`
  673. }
  674. func (s *PubsubConfig) MarshalJSON() ([]byte, error) {
  675. type NoMethod PubsubConfig
  676. raw := NoMethod(*s)
  677. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  678. }
  679. // Repo: A repository (or repo) is a Git repository storing versioned
  680. // source content.
  681. type Repo struct {
  682. // MirrorConfig: How this repository mirrors a repository managed by
  683. // another service.
  684. // Read-only field.
  685. MirrorConfig *MirrorConfig `json:"mirrorConfig,omitempty"`
  686. // Name: Resource name of the repository, of the
  687. // form
  688. // `projects/<project>/repos/<repo>`. The repo name may contain
  689. // slashes.
  690. // eg, `projects/myproject/repos/name/with/slash`
  691. Name string `json:"name,omitempty"`
  692. // PubsubConfigs: How this repository publishes a change in the
  693. // repository through Cloud
  694. // Pub/Sub. Keyed by the topic names.
  695. PubsubConfigs map[string]PubsubConfig `json:"pubsubConfigs,omitempty"`
  696. // Size: The disk usage of the repo, in bytes. Read-only field. Size is
  697. // only
  698. // returned by GetRepo.
  699. Size int64 `json:"size,omitempty,string"`
  700. // Url: URL to clone the repository from Google Cloud Source
  701. // Repositories.
  702. // Read-only field.
  703. Url string `json:"url,omitempty"`
  704. // ServerResponse contains the HTTP response code and headers from the
  705. // server.
  706. googleapi.ServerResponse `json:"-"`
  707. // ForceSendFields is a list of field names (e.g. "MirrorConfig") to
  708. // unconditionally include in API requests. By default, fields with
  709. // empty values are omitted from API requests. However, any non-pointer,
  710. // non-interface field appearing in ForceSendFields will be sent to the
  711. // server regardless of whether the field is empty or not. This may be
  712. // used to include empty fields in Patch requests.
  713. ForceSendFields []string `json:"-"`
  714. // NullFields is a list of field names (e.g. "MirrorConfig") to include
  715. // in API requests with the JSON null value. By default, fields with
  716. // empty values are omitted from API requests. However, any field with
  717. // an empty value appearing in NullFields will be sent to the server as
  718. // null. It is an error if a field in this list has a non-empty value.
  719. // This may be used to include null fields in Patch requests.
  720. NullFields []string `json:"-"`
  721. }
  722. func (s *Repo) MarshalJSON() ([]byte, error) {
  723. type NoMethod Repo
  724. raw := NoMethod(*s)
  725. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  726. }
  727. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  728. type SetIamPolicyRequest struct {
  729. // Policy: REQUIRED: The complete policy to be applied to the
  730. // `resource`. The size of
  731. // the policy is limited to a few 10s of KB. An empty policy is a
  732. // valid policy but certain Cloud Platform services (such as
  733. // Projects)
  734. // might reject them.
  735. Policy *Policy `json:"policy,omitempty"`
  736. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  737. // policy to modify. Only
  738. // the fields in the mask will be modified. If no mask is provided,
  739. // the
  740. // following default mask is used:
  741. // paths: "bindings, etag"
  742. // This field is only used by Cloud IAM.
  743. UpdateMask string `json:"updateMask,omitempty"`
  744. // ForceSendFields is a list of field names (e.g. "Policy") to
  745. // unconditionally include in API requests. By default, fields with
  746. // empty values are omitted from API requests. However, any non-pointer,
  747. // non-interface field appearing in ForceSendFields will be sent to the
  748. // server regardless of whether the field is empty or not. This may be
  749. // used to include empty fields in Patch requests.
  750. ForceSendFields []string `json:"-"`
  751. // NullFields is a list of field names (e.g. "Policy") to include in API
  752. // requests with the JSON null value. By default, fields with empty
  753. // values are omitted from API requests. However, any field with an
  754. // empty value appearing in NullFields will be sent to the server as
  755. // null. It is an error if a field in this list has a non-empty value.
  756. // This may be used to include null fields in Patch requests.
  757. NullFields []string `json:"-"`
  758. }
  759. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  760. type NoMethod SetIamPolicyRequest
  761. raw := NoMethod(*s)
  762. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  763. }
  764. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  765. // method.
  766. type TestIamPermissionsRequest struct {
  767. // Permissions: The set of permissions to check for the `resource`.
  768. // Permissions with
  769. // wildcards (such as '*' or 'storage.*') are not allowed. For
  770. // more
  771. // information see
  772. // [IAM
  773. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  774. Permissions []string `json:"permissions,omitempty"`
  775. // ForceSendFields is a list of field names (e.g. "Permissions") to
  776. // unconditionally include in API requests. By default, fields with
  777. // empty values are omitted from API requests. However, any non-pointer,
  778. // non-interface field appearing in ForceSendFields will be sent to the
  779. // server regardless of whether the field is empty or not. This may be
  780. // used to include empty fields in Patch requests.
  781. ForceSendFields []string `json:"-"`
  782. // NullFields is a list of field names (e.g. "Permissions") to include
  783. // in API requests with the JSON null value. By default, fields with
  784. // empty values are omitted from API requests. However, any field with
  785. // an empty value appearing in NullFields will be sent to the server as
  786. // null. It is an error if a field in this list has a non-empty value.
  787. // This may be used to include null fields in Patch requests.
  788. NullFields []string `json:"-"`
  789. }
  790. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  791. type NoMethod TestIamPermissionsRequest
  792. raw := NoMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  794. }
  795. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  796. // method.
  797. type TestIamPermissionsResponse struct {
  798. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  799. // the caller is
  800. // allowed.
  801. Permissions []string `json:"permissions,omitempty"`
  802. // ServerResponse contains the HTTP response code and headers from the
  803. // server.
  804. googleapi.ServerResponse `json:"-"`
  805. // ForceSendFields is a list of field names (e.g. "Permissions") to
  806. // unconditionally include in API requests. By default, fields with
  807. // empty values are omitted from API requests. However, any non-pointer,
  808. // non-interface field appearing in ForceSendFields will be sent to the
  809. // server regardless of whether the field is empty or not. This may be
  810. // used to include empty fields in Patch requests.
  811. ForceSendFields []string `json:"-"`
  812. // NullFields is a list of field names (e.g. "Permissions") to include
  813. // in API requests with the JSON null value. By default, fields with
  814. // empty values are omitted from API requests. However, any field with
  815. // an empty value appearing in NullFields will be sent to the server as
  816. // null. It is an error if a field in this list has a non-empty value.
  817. // This may be used to include null fields in Patch requests.
  818. NullFields []string `json:"-"`
  819. }
  820. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  821. type NoMethod TestIamPermissionsResponse
  822. raw := NoMethod(*s)
  823. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  824. }
  825. // UpdateProjectConfigRequest: Request for UpdateProjectConfig.
  826. type UpdateProjectConfigRequest struct {
  827. // ProjectConfig: The new configuration for the project.
  828. ProjectConfig *ProjectConfig `json:"projectConfig,omitempty"`
  829. // UpdateMask: A FieldMask specifying which fields of the project_config
  830. // to modify. Only
  831. // the fields in the mask will be modified. If no mask is provided,
  832. // this
  833. // request is no-op.
  834. UpdateMask string `json:"updateMask,omitempty"`
  835. // ForceSendFields is a list of field names (e.g. "ProjectConfig") to
  836. // unconditionally include in API requests. By default, fields with
  837. // empty values are omitted from API requests. However, any non-pointer,
  838. // non-interface field appearing in ForceSendFields will be sent to the
  839. // server regardless of whether the field is empty or not. This may be
  840. // used to include empty fields in Patch requests.
  841. ForceSendFields []string `json:"-"`
  842. // NullFields is a list of field names (e.g. "ProjectConfig") to include
  843. // in API requests with the JSON null value. By default, fields with
  844. // empty values are omitted from API requests. However, any field with
  845. // an empty value appearing in NullFields will be sent to the server as
  846. // null. It is an error if a field in this list has a non-empty value.
  847. // This may be used to include null fields in Patch requests.
  848. NullFields []string `json:"-"`
  849. }
  850. func (s *UpdateProjectConfigRequest) MarshalJSON() ([]byte, error) {
  851. type NoMethod UpdateProjectConfigRequest
  852. raw := NoMethod(*s)
  853. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  854. }
  855. // UpdateRepoRequest: Request for UpdateRepo.
  856. type UpdateRepoRequest struct {
  857. // Repo: The new configuration for the repository.
  858. Repo *Repo `json:"repo,omitempty"`
  859. // UpdateMask: A FieldMask specifying which fields of the repo to
  860. // modify. Only the fields
  861. // in the mask will be modified. If no mask is provided, this request
  862. // is
  863. // no-op.
  864. UpdateMask string `json:"updateMask,omitempty"`
  865. // ForceSendFields is a list of field names (e.g. "Repo") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "Repo") to include in API
  873. // requests with the JSON null value. By default, fields with empty
  874. // values are omitted from API requests. However, any field with an
  875. // empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *UpdateRepoRequest) MarshalJSON() ([]byte, error) {
  881. type NoMethod UpdateRepoRequest
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. // method id "sourcerepo.projects.getConfig":
  886. type ProjectsGetConfigCall struct {
  887. s *Service
  888. name string
  889. urlParams_ gensupport.URLParams
  890. ifNoneMatch_ string
  891. ctx_ context.Context
  892. header_ http.Header
  893. }
  894. // GetConfig: Returns the Cloud Source Repositories configuration of the
  895. // project.
  896. func (r *ProjectsService) GetConfig(name string) *ProjectsGetConfigCall {
  897. c := &ProjectsGetConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  898. c.name = name
  899. return c
  900. }
  901. // Fields allows partial responses to be retrieved. See
  902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  903. // for more information.
  904. func (c *ProjectsGetConfigCall) Fields(s ...googleapi.Field) *ProjectsGetConfigCall {
  905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  906. return c
  907. }
  908. // IfNoneMatch sets the optional parameter which makes the operation
  909. // fail if the object's ETag matches the given value. This is useful for
  910. // getting updates only after the object has changed since the last
  911. // request. Use googleapi.IsNotModified to check whether the response
  912. // error from Do is the result of In-None-Match.
  913. func (c *ProjectsGetConfigCall) IfNoneMatch(entityTag string) *ProjectsGetConfigCall {
  914. c.ifNoneMatch_ = entityTag
  915. return c
  916. }
  917. // Context sets the context to be used in this call's Do method. Any
  918. // pending HTTP request will be aborted if the provided context is
  919. // canceled.
  920. func (c *ProjectsGetConfigCall) Context(ctx context.Context) *ProjectsGetConfigCall {
  921. c.ctx_ = ctx
  922. return c
  923. }
  924. // Header returns an http.Header that can be modified by the caller to
  925. // add HTTP headers to the request.
  926. func (c *ProjectsGetConfigCall) Header() http.Header {
  927. if c.header_ == nil {
  928. c.header_ = make(http.Header)
  929. }
  930. return c.header_
  931. }
  932. func (c *ProjectsGetConfigCall) doRequest(alt string) (*http.Response, error) {
  933. reqHeaders := make(http.Header)
  934. for k, v := range c.header_ {
  935. reqHeaders[k] = v
  936. }
  937. reqHeaders.Set("User-Agent", c.s.userAgent())
  938. if c.ifNoneMatch_ != "" {
  939. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  940. }
  941. var body io.Reader = nil
  942. c.urlParams_.Set("alt", alt)
  943. c.urlParams_.Set("prettyPrint", "false")
  944. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/config")
  945. urls += "?" + c.urlParams_.Encode()
  946. req, err := http.NewRequest("GET", urls, body)
  947. if err != nil {
  948. return nil, err
  949. }
  950. req.Header = reqHeaders
  951. googleapi.Expand(req.URL, map[string]string{
  952. "name": c.name,
  953. })
  954. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  955. }
  956. // Do executes the "sourcerepo.projects.getConfig" call.
  957. // Exactly one of *ProjectConfig or error will be non-nil. Any non-2xx
  958. // status code is an error. Response headers are in either
  959. // *ProjectConfig.ServerResponse.Header or (if a response was returned
  960. // at all) in error.(*googleapi.Error).Header. Use
  961. // googleapi.IsNotModified to check whether the returned error was
  962. // because http.StatusNotModified was returned.
  963. func (c *ProjectsGetConfigCall) Do(opts ...googleapi.CallOption) (*ProjectConfig, error) {
  964. gensupport.SetOptions(c.urlParams_, opts...)
  965. res, err := c.doRequest("json")
  966. if res != nil && res.StatusCode == http.StatusNotModified {
  967. if res.Body != nil {
  968. res.Body.Close()
  969. }
  970. return nil, &googleapi.Error{
  971. Code: res.StatusCode,
  972. Header: res.Header,
  973. }
  974. }
  975. if err != nil {
  976. return nil, err
  977. }
  978. defer googleapi.CloseBody(res)
  979. if err := googleapi.CheckResponse(res); err != nil {
  980. return nil, err
  981. }
  982. ret := &ProjectConfig{
  983. ServerResponse: googleapi.ServerResponse{
  984. Header: res.Header,
  985. HTTPStatusCode: res.StatusCode,
  986. },
  987. }
  988. target := &ret
  989. if err := gensupport.DecodeResponse(target, res); err != nil {
  990. return nil, err
  991. }
  992. return ret, nil
  993. // {
  994. // "description": "Returns the Cloud Source Repositories configuration of the project.",
  995. // "flatPath": "v1/projects/{projectsId}/config",
  996. // "httpMethod": "GET",
  997. // "id": "sourcerepo.projects.getConfig",
  998. // "parameterOrder": [
  999. // "name"
  1000. // ],
  1001. // "parameters": {
  1002. // "name": {
  1003. // "description": "The name of the requested project. Values are of the form\n`projects/\u003cproject\u003e`.",
  1004. // "location": "path",
  1005. // "pattern": "^projects/[^/]+$",
  1006. // "required": true,
  1007. // "type": "string"
  1008. // }
  1009. // },
  1010. // "path": "v1/{+name}/config",
  1011. // "response": {
  1012. // "$ref": "ProjectConfig"
  1013. // },
  1014. // "scopes": [
  1015. // "https://www.googleapis.com/auth/cloud-platform"
  1016. // ]
  1017. // }
  1018. }
  1019. // method id "sourcerepo.projects.updateConfig":
  1020. type ProjectsUpdateConfigCall struct {
  1021. s *Service
  1022. name string
  1023. updateprojectconfigrequest *UpdateProjectConfigRequest
  1024. urlParams_ gensupport.URLParams
  1025. ctx_ context.Context
  1026. header_ http.Header
  1027. }
  1028. // UpdateConfig: Updates the Cloud Source Repositories configuration of
  1029. // the project.
  1030. func (r *ProjectsService) UpdateConfig(name string, updateprojectconfigrequest *UpdateProjectConfigRequest) *ProjectsUpdateConfigCall {
  1031. c := &ProjectsUpdateConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1032. c.name = name
  1033. c.updateprojectconfigrequest = updateprojectconfigrequest
  1034. return c
  1035. }
  1036. // Fields allows partial responses to be retrieved. See
  1037. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1038. // for more information.
  1039. func (c *ProjectsUpdateConfigCall) Fields(s ...googleapi.Field) *ProjectsUpdateConfigCall {
  1040. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1041. return c
  1042. }
  1043. // Context sets the context to be used in this call's Do method. Any
  1044. // pending HTTP request will be aborted if the provided context is
  1045. // canceled.
  1046. func (c *ProjectsUpdateConfigCall) Context(ctx context.Context) *ProjectsUpdateConfigCall {
  1047. c.ctx_ = ctx
  1048. return c
  1049. }
  1050. // Header returns an http.Header that can be modified by the caller to
  1051. // add HTTP headers to the request.
  1052. func (c *ProjectsUpdateConfigCall) Header() http.Header {
  1053. if c.header_ == nil {
  1054. c.header_ = make(http.Header)
  1055. }
  1056. return c.header_
  1057. }
  1058. func (c *ProjectsUpdateConfigCall) doRequest(alt string) (*http.Response, error) {
  1059. reqHeaders := make(http.Header)
  1060. for k, v := range c.header_ {
  1061. reqHeaders[k] = v
  1062. }
  1063. reqHeaders.Set("User-Agent", c.s.userAgent())
  1064. var body io.Reader = nil
  1065. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updateprojectconfigrequest)
  1066. if err != nil {
  1067. return nil, err
  1068. }
  1069. reqHeaders.Set("Content-Type", "application/json")
  1070. c.urlParams_.Set("alt", alt)
  1071. c.urlParams_.Set("prettyPrint", "false")
  1072. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/config")
  1073. urls += "?" + c.urlParams_.Encode()
  1074. req, err := http.NewRequest("PATCH", urls, body)
  1075. if err != nil {
  1076. return nil, err
  1077. }
  1078. req.Header = reqHeaders
  1079. googleapi.Expand(req.URL, map[string]string{
  1080. "name": c.name,
  1081. })
  1082. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1083. }
  1084. // Do executes the "sourcerepo.projects.updateConfig" call.
  1085. // Exactly one of *ProjectConfig or error will be non-nil. Any non-2xx
  1086. // status code is an error. Response headers are in either
  1087. // *ProjectConfig.ServerResponse.Header or (if a response was returned
  1088. // at all) in error.(*googleapi.Error).Header. Use
  1089. // googleapi.IsNotModified to check whether the returned error was
  1090. // because http.StatusNotModified was returned.
  1091. func (c *ProjectsUpdateConfigCall) Do(opts ...googleapi.CallOption) (*ProjectConfig, error) {
  1092. gensupport.SetOptions(c.urlParams_, opts...)
  1093. res, err := c.doRequest("json")
  1094. if res != nil && res.StatusCode == http.StatusNotModified {
  1095. if res.Body != nil {
  1096. res.Body.Close()
  1097. }
  1098. return nil, &googleapi.Error{
  1099. Code: res.StatusCode,
  1100. Header: res.Header,
  1101. }
  1102. }
  1103. if err != nil {
  1104. return nil, err
  1105. }
  1106. defer googleapi.CloseBody(res)
  1107. if err := googleapi.CheckResponse(res); err != nil {
  1108. return nil, err
  1109. }
  1110. ret := &ProjectConfig{
  1111. ServerResponse: googleapi.ServerResponse{
  1112. Header: res.Header,
  1113. HTTPStatusCode: res.StatusCode,
  1114. },
  1115. }
  1116. target := &ret
  1117. if err := gensupport.DecodeResponse(target, res); err != nil {
  1118. return nil, err
  1119. }
  1120. return ret, nil
  1121. // {
  1122. // "description": "Updates the Cloud Source Repositories configuration of the project.",
  1123. // "flatPath": "v1/projects/{projectsId}/config",
  1124. // "httpMethod": "PATCH",
  1125. // "id": "sourcerepo.projects.updateConfig",
  1126. // "parameterOrder": [
  1127. // "name"
  1128. // ],
  1129. // "parameters": {
  1130. // "name": {
  1131. // "description": "The name of the requested project. Values are of the form\n`projects/\u003cproject\u003e`.",
  1132. // "location": "path",
  1133. // "pattern": "^projects/[^/]+$",
  1134. // "required": true,
  1135. // "type": "string"
  1136. // }
  1137. // },
  1138. // "path": "v1/{+name}/config",
  1139. // "request": {
  1140. // "$ref": "UpdateProjectConfigRequest"
  1141. // },
  1142. // "response": {
  1143. // "$ref": "ProjectConfig"
  1144. // },
  1145. // "scopes": [
  1146. // "https://www.googleapis.com/auth/cloud-platform"
  1147. // ]
  1148. // }
  1149. }
  1150. // method id "sourcerepo.projects.repos.create":
  1151. type ProjectsReposCreateCall struct {
  1152. s *Service
  1153. parent string
  1154. repo *Repo
  1155. urlParams_ gensupport.URLParams
  1156. ctx_ context.Context
  1157. header_ http.Header
  1158. }
  1159. // Create: Creates a repo in the given project with the given name.
  1160. //
  1161. // If the named repository already exists, `CreateRepo`
  1162. // returns
  1163. // `ALREADY_EXISTS`.
  1164. func (r *ProjectsReposService) Create(parent string, repo *Repo) *ProjectsReposCreateCall {
  1165. c := &ProjectsReposCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1166. c.parent = parent
  1167. c.repo = repo
  1168. return c
  1169. }
  1170. // Fields allows partial responses to be retrieved. See
  1171. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1172. // for more information.
  1173. func (c *ProjectsReposCreateCall) Fields(s ...googleapi.Field) *ProjectsReposCreateCall {
  1174. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1175. return c
  1176. }
  1177. // Context sets the context to be used in this call's Do method. Any
  1178. // pending HTTP request will be aborted if the provided context is
  1179. // canceled.
  1180. func (c *ProjectsReposCreateCall) Context(ctx context.Context) *ProjectsReposCreateCall {
  1181. c.ctx_ = ctx
  1182. return c
  1183. }
  1184. // Header returns an http.Header that can be modified by the caller to
  1185. // add HTTP headers to the request.
  1186. func (c *ProjectsReposCreateCall) Header() http.Header {
  1187. if c.header_ == nil {
  1188. c.header_ = make(http.Header)
  1189. }
  1190. return c.header_
  1191. }
  1192. func (c *ProjectsReposCreateCall) doRequest(alt string) (*http.Response, error) {
  1193. reqHeaders := make(http.Header)
  1194. for k, v := range c.header_ {
  1195. reqHeaders[k] = v
  1196. }
  1197. reqHeaders.Set("User-Agent", c.s.userAgent())
  1198. var body io.Reader = nil
  1199. body, err := googleapi.WithoutDataWrapper.JSONReader(c.repo)
  1200. if err != nil {
  1201. return nil, err
  1202. }
  1203. reqHeaders.Set("Content-Type", "application/json")
  1204. c.urlParams_.Set("alt", alt)
  1205. c.urlParams_.Set("prettyPrint", "false")
  1206. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/repos")
  1207. urls += "?" + c.urlParams_.Encode()
  1208. req, err := http.NewRequest("POST", urls, body)
  1209. if err != nil {
  1210. return nil, err
  1211. }
  1212. req.Header = reqHeaders
  1213. googleapi.Expand(req.URL, map[string]string{
  1214. "parent": c.parent,
  1215. })
  1216. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1217. }
  1218. // Do executes the "sourcerepo.projects.repos.create" call.
  1219. // Exactly one of *Repo or error will be non-nil. Any non-2xx status
  1220. // code is an error. Response headers are in either
  1221. // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1222. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1223. // whether the returned error was because http.StatusNotModified was
  1224. // returned.
  1225. func (c *ProjectsReposCreateCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1226. gensupport.SetOptions(c.urlParams_, opts...)
  1227. res, err := c.doRequest("json")
  1228. if res != nil && res.StatusCode == http.StatusNotModified {
  1229. if res.Body != nil {
  1230. res.Body.Close()
  1231. }
  1232. return nil, &googleapi.Error{
  1233. Code: res.StatusCode,
  1234. Header: res.Header,
  1235. }
  1236. }
  1237. if err != nil {
  1238. return nil, err
  1239. }
  1240. defer googleapi.CloseBody(res)
  1241. if err := googleapi.CheckResponse(res); err != nil {
  1242. return nil, err
  1243. }
  1244. ret := &Repo{
  1245. ServerResponse: googleapi.ServerResponse{
  1246. Header: res.Header,
  1247. HTTPStatusCode: res.StatusCode,
  1248. },
  1249. }
  1250. target := &ret
  1251. if err := gensupport.DecodeResponse(target, res); err != nil {
  1252. return nil, err
  1253. }
  1254. return ret, nil
  1255. // {
  1256. // "description": "Creates a repo in the given project with the given name.\n\nIf the named repository already exists, `CreateRepo` returns\n`ALREADY_EXISTS`.",
  1257. // "flatPath": "v1/projects/{projectsId}/repos",
  1258. // "httpMethod": "POST",
  1259. // "id": "sourcerepo.projects.repos.create",
  1260. // "parameterOrder": [
  1261. // "parent"
  1262. // ],
  1263. // "parameters": {
  1264. // "parent": {
  1265. // "description": "The project in which to create the repo. Values are of the form\n`projects/\u003cproject\u003e`.",
  1266. // "location": "path",
  1267. // "pattern": "^projects/[^/]+$",
  1268. // "required": true,
  1269. // "type": "string"
  1270. // }
  1271. // },
  1272. // "path": "v1/{+parent}/repos",
  1273. // "request": {
  1274. // "$ref": "Repo"
  1275. // },
  1276. // "response": {
  1277. // "$ref": "Repo"
  1278. // },
  1279. // "scopes": [
  1280. // "https://www.googleapis.com/auth/cloud-platform",
  1281. // "https://www.googleapis.com/auth/source.full_control"
  1282. // ]
  1283. // }
  1284. }
  1285. // method id "sourcerepo.projects.repos.delete":
  1286. type ProjectsReposDeleteCall struct {
  1287. s *Service
  1288. name string
  1289. urlParams_ gensupport.URLParams
  1290. ctx_ context.Context
  1291. header_ http.Header
  1292. }
  1293. // Delete: Deletes a repo.
  1294. func (r *ProjectsReposService) Delete(name string) *ProjectsReposDeleteCall {
  1295. c := &ProjectsReposDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1296. c.name = name
  1297. return c
  1298. }
  1299. // Fields allows partial responses to be retrieved. See
  1300. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1301. // for more information.
  1302. func (c *ProjectsReposDeleteCall) Fields(s ...googleapi.Field) *ProjectsReposDeleteCall {
  1303. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1304. return c
  1305. }
  1306. // Context sets the context to be used in this call's Do method. Any
  1307. // pending HTTP request will be aborted if the provided context is
  1308. // canceled.
  1309. func (c *ProjectsReposDeleteCall) Context(ctx context.Context) *ProjectsReposDeleteCall {
  1310. c.ctx_ = ctx
  1311. return c
  1312. }
  1313. // Header returns an http.Header that can be modified by the caller to
  1314. // add HTTP headers to the request.
  1315. func (c *ProjectsReposDeleteCall) Header() http.Header {
  1316. if c.header_ == nil {
  1317. c.header_ = make(http.Header)
  1318. }
  1319. return c.header_
  1320. }
  1321. func (c *ProjectsReposDeleteCall) doRequest(alt string) (*http.Response, error) {
  1322. reqHeaders := make(http.Header)
  1323. for k, v := range c.header_ {
  1324. reqHeaders[k] = v
  1325. }
  1326. reqHeaders.Set("User-Agent", c.s.userAgent())
  1327. var body io.Reader = nil
  1328. c.urlParams_.Set("alt", alt)
  1329. c.urlParams_.Set("prettyPrint", "false")
  1330. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1331. urls += "?" + c.urlParams_.Encode()
  1332. req, err := http.NewRequest("DELETE", urls, body)
  1333. if err != nil {
  1334. return nil, err
  1335. }
  1336. req.Header = reqHeaders
  1337. googleapi.Expand(req.URL, map[string]string{
  1338. "name": c.name,
  1339. })
  1340. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1341. }
  1342. // Do executes the "sourcerepo.projects.repos.delete" call.
  1343. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1344. // code is an error. Response headers are in either
  1345. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1346. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1347. // check whether the returned error was because http.StatusNotModified
  1348. // was returned.
  1349. func (c *ProjectsReposDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1350. gensupport.SetOptions(c.urlParams_, opts...)
  1351. res, err := c.doRequest("json")
  1352. if res != nil && res.StatusCode == http.StatusNotModified {
  1353. if res.Body != nil {
  1354. res.Body.Close()
  1355. }
  1356. return nil, &googleapi.Error{
  1357. Code: res.StatusCode,
  1358. Header: res.Header,
  1359. }
  1360. }
  1361. if err != nil {
  1362. return nil, err
  1363. }
  1364. defer googleapi.CloseBody(res)
  1365. if err := googleapi.CheckResponse(res); err != nil {
  1366. return nil, err
  1367. }
  1368. ret := &Empty{
  1369. ServerResponse: googleapi.ServerResponse{
  1370. Header: res.Header,
  1371. HTTPStatusCode: res.StatusCode,
  1372. },
  1373. }
  1374. target := &ret
  1375. if err := gensupport.DecodeResponse(target, res); err != nil {
  1376. return nil, err
  1377. }
  1378. return ret, nil
  1379. // {
  1380. // "description": "Deletes a repo.",
  1381. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}",
  1382. // "httpMethod": "DELETE",
  1383. // "id": "sourcerepo.projects.repos.delete",
  1384. // "parameterOrder": [
  1385. // "name"
  1386. // ],
  1387. // "parameters": {
  1388. // "name": {
  1389. // "description": "The name of the repo to delete. Values are of the form\n`projects/\u003cproject\u003e/repos/\u003crepo\u003e`.",
  1390. // "location": "path",
  1391. // "pattern": "^projects/[^/]+/repos/.+$",
  1392. // "required": true,
  1393. // "type": "string"
  1394. // }
  1395. // },
  1396. // "path": "v1/{+name}",
  1397. // "response": {
  1398. // "$ref": "Empty"
  1399. // },
  1400. // "scopes": [
  1401. // "https://www.googleapis.com/auth/cloud-platform",
  1402. // "https://www.googleapis.com/auth/source.full_control"
  1403. // ]
  1404. // }
  1405. }
  1406. // method id "sourcerepo.projects.repos.get":
  1407. type ProjectsReposGetCall struct {
  1408. s *Service
  1409. name string
  1410. urlParams_ gensupport.URLParams
  1411. ifNoneMatch_ string
  1412. ctx_ context.Context
  1413. header_ http.Header
  1414. }
  1415. // Get: Returns information about a repo.
  1416. func (r *ProjectsReposService) Get(name string) *ProjectsReposGetCall {
  1417. c := &ProjectsReposGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1418. c.name = name
  1419. return c
  1420. }
  1421. // Fields allows partial responses to be retrieved. See
  1422. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1423. // for more information.
  1424. func (c *ProjectsReposGetCall) Fields(s ...googleapi.Field) *ProjectsReposGetCall {
  1425. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1426. return c
  1427. }
  1428. // IfNoneMatch sets the optional parameter which makes the operation
  1429. // fail if the object's ETag matches the given value. This is useful for
  1430. // getting updates only after the object has changed since the last
  1431. // request. Use googleapi.IsNotModified to check whether the response
  1432. // error from Do is the result of In-None-Match.
  1433. func (c *ProjectsReposGetCall) IfNoneMatch(entityTag string) *ProjectsReposGetCall {
  1434. c.ifNoneMatch_ = entityTag
  1435. return c
  1436. }
  1437. // Context sets the context to be used in this call's Do method. Any
  1438. // pending HTTP request will be aborted if the provided context is
  1439. // canceled.
  1440. func (c *ProjectsReposGetCall) Context(ctx context.Context) *ProjectsReposGetCall {
  1441. c.ctx_ = ctx
  1442. return c
  1443. }
  1444. // Header returns an http.Header that can be modified by the caller to
  1445. // add HTTP headers to the request.
  1446. func (c *ProjectsReposGetCall) Header() http.Header {
  1447. if c.header_ == nil {
  1448. c.header_ = make(http.Header)
  1449. }
  1450. return c.header_
  1451. }
  1452. func (c *ProjectsReposGetCall) doRequest(alt string) (*http.Response, error) {
  1453. reqHeaders := make(http.Header)
  1454. for k, v := range c.header_ {
  1455. reqHeaders[k] = v
  1456. }
  1457. reqHeaders.Set("User-Agent", c.s.userAgent())
  1458. if c.ifNoneMatch_ != "" {
  1459. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1460. }
  1461. var body io.Reader = nil
  1462. c.urlParams_.Set("alt", alt)
  1463. c.urlParams_.Set("prettyPrint", "false")
  1464. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1465. urls += "?" + c.urlParams_.Encode()
  1466. req, err := http.NewRequest("GET", urls, body)
  1467. if err != nil {
  1468. return nil, err
  1469. }
  1470. req.Header = reqHeaders
  1471. googleapi.Expand(req.URL, map[string]string{
  1472. "name": c.name,
  1473. })
  1474. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1475. }
  1476. // Do executes the "sourcerepo.projects.repos.get" call.
  1477. // Exactly one of *Repo or error will be non-nil. Any non-2xx status
  1478. // code is an error. Response headers are in either
  1479. // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1480. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1481. // whether the returned error was because http.StatusNotModified was
  1482. // returned.
  1483. func (c *ProjectsReposGetCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1484. gensupport.SetOptions(c.urlParams_, opts...)
  1485. res, err := c.doRequest("json")
  1486. if res != nil && res.StatusCode == http.StatusNotModified {
  1487. if res.Body != nil {
  1488. res.Body.Close()
  1489. }
  1490. return nil, &googleapi.Error{
  1491. Code: res.StatusCode,
  1492. Header: res.Header,
  1493. }
  1494. }
  1495. if err != nil {
  1496. return nil, err
  1497. }
  1498. defer googleapi.CloseBody(res)
  1499. if err := googleapi.CheckResponse(res); err != nil {
  1500. return nil, err
  1501. }
  1502. ret := &Repo{
  1503. ServerResponse: googleapi.ServerResponse{
  1504. Header: res.Header,
  1505. HTTPStatusCode: res.StatusCode,
  1506. },
  1507. }
  1508. target := &ret
  1509. if err := gensupport.DecodeResponse(target, res); err != nil {
  1510. return nil, err
  1511. }
  1512. return ret, nil
  1513. // {
  1514. // "description": "Returns information about a repo.",
  1515. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}",
  1516. // "httpMethod": "GET",
  1517. // "id": "sourcerepo.projects.repos.get",
  1518. // "parameterOrder": [
  1519. // "name"
  1520. // ],
  1521. // "parameters": {
  1522. // "name": {
  1523. // "description": "The name of the requested repository. Values are of the form\n`projects/\u003cproject\u003e/repos/\u003crepo\u003e`.",
  1524. // "location": "path",
  1525. // "pattern": "^projects/[^/]+/repos/.+$",
  1526. // "required": true,
  1527. // "type": "string"
  1528. // }
  1529. // },
  1530. // "path": "v1/{+name}",
  1531. // "response": {
  1532. // "$ref": "Repo"
  1533. // },
  1534. // "scopes": [
  1535. // "https://www.googleapis.com/auth/cloud-platform",
  1536. // "https://www.googleapis.com/auth/source.full_control",
  1537. // "https://www.googleapis.com/auth/source.read_only",
  1538. // "https://www.googleapis.com/auth/source.read_write"
  1539. // ]
  1540. // }
  1541. }
  1542. // method id "sourcerepo.projects.repos.getIamPolicy":
  1543. type ProjectsReposGetIamPolicyCall struct {
  1544. s *Service
  1545. resource string
  1546. urlParams_ gensupport.URLParams
  1547. ifNoneMatch_ string
  1548. ctx_ context.Context
  1549. header_ http.Header
  1550. }
  1551. // GetIamPolicy: Gets the access control policy for a resource.
  1552. // Returns an empty policy if the resource exists and does not have a
  1553. // policy
  1554. // set.
  1555. func (r *ProjectsReposService) GetIamPolicy(resource string) *ProjectsReposGetIamPolicyCall {
  1556. c := &ProjectsReposGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1557. c.resource = resource
  1558. return c
  1559. }
  1560. // Fields allows partial responses to be retrieved. See
  1561. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1562. // for more information.
  1563. func (c *ProjectsReposGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsReposGetIamPolicyCall {
  1564. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1565. return c
  1566. }
  1567. // IfNoneMatch sets the optional parameter which makes the operation
  1568. // fail if the object's ETag matches the given value. This is useful for
  1569. // getting updates only after the object has changed since the last
  1570. // request. Use googleapi.IsNotModified to check whether the response
  1571. // error from Do is the result of In-None-Match.
  1572. func (c *ProjectsReposGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsReposGetIamPolicyCall {
  1573. c.ifNoneMatch_ = entityTag
  1574. return c
  1575. }
  1576. // Context sets the context to be used in this call's Do method. Any
  1577. // pending HTTP request will be aborted if the provided context is
  1578. // canceled.
  1579. func (c *ProjectsReposGetIamPolicyCall) Context(ctx context.Context) *ProjectsReposGetIamPolicyCall {
  1580. c.ctx_ = ctx
  1581. return c
  1582. }
  1583. // Header returns an http.Header that can be modified by the caller to
  1584. // add HTTP headers to the request.
  1585. func (c *ProjectsReposGetIamPolicyCall) Header() http.Header {
  1586. if c.header_ == nil {
  1587. c.header_ = make(http.Header)
  1588. }
  1589. return c.header_
  1590. }
  1591. func (c *ProjectsReposGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1592. reqHeaders := make(http.Header)
  1593. for k, v := range c.header_ {
  1594. reqHeaders[k] = v
  1595. }
  1596. reqHeaders.Set("User-Agent", c.s.userAgent())
  1597. if c.ifNoneMatch_ != "" {
  1598. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1599. }
  1600. var body io.Reader = nil
  1601. c.urlParams_.Set("alt", alt)
  1602. c.urlParams_.Set("prettyPrint", "false")
  1603. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  1604. urls += "?" + c.urlParams_.Encode()
  1605. req, err := http.NewRequest("GET", urls, body)
  1606. if err != nil {
  1607. return nil, err
  1608. }
  1609. req.Header = reqHeaders
  1610. googleapi.Expand(req.URL, map[string]string{
  1611. "resource": c.resource,
  1612. })
  1613. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1614. }
  1615. // Do executes the "sourcerepo.projects.repos.getIamPolicy" call.
  1616. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1617. // code is an error. Response headers are in either
  1618. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1619. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1620. // check whether the returned error was because http.StatusNotModified
  1621. // was returned.
  1622. func (c *ProjectsReposGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1623. gensupport.SetOptions(c.urlParams_, opts...)
  1624. res, err := c.doRequest("json")
  1625. if res != nil && res.StatusCode == http.StatusNotModified {
  1626. if res.Body != nil {
  1627. res.Body.Close()
  1628. }
  1629. return nil, &googleapi.Error{
  1630. Code: res.StatusCode,
  1631. Header: res.Header,
  1632. }
  1633. }
  1634. if err != nil {
  1635. return nil, err
  1636. }
  1637. defer googleapi.CloseBody(res)
  1638. if err := googleapi.CheckResponse(res); err != nil {
  1639. return nil, err
  1640. }
  1641. ret := &Policy{
  1642. ServerResponse: googleapi.ServerResponse{
  1643. Header: res.Header,
  1644. HTTPStatusCode: res.StatusCode,
  1645. },
  1646. }
  1647. target := &ret
  1648. if err := gensupport.DecodeResponse(target, res); err != nil {
  1649. return nil, err
  1650. }
  1651. return ret, nil
  1652. // {
  1653. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  1654. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}:getIamPolicy",
  1655. // "httpMethod": "GET",
  1656. // "id": "sourcerepo.projects.repos.getIamPolicy",
  1657. // "parameterOrder": [
  1658. // "resource"
  1659. // ],
  1660. // "parameters": {
  1661. // "resource": {
  1662. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1663. // "location": "path",
  1664. // "pattern": "^projects/[^/]+/repos/.+$",
  1665. // "required": true,
  1666. // "type": "string"
  1667. // }
  1668. // },
  1669. // "path": "v1/{+resource}:getIamPolicy",
  1670. // "response": {
  1671. // "$ref": "Policy"
  1672. // },
  1673. // "scopes": [
  1674. // "https://www.googleapis.com/auth/cloud-platform",
  1675. // "https://www.googleapis.com/auth/source.full_control",
  1676. // "https://www.googleapis.com/auth/source.read_only",
  1677. // "https://www.googleapis.com/auth/source.read_write"
  1678. // ]
  1679. // }
  1680. }
  1681. // method id "sourcerepo.projects.repos.list":
  1682. type ProjectsReposListCall struct {
  1683. s *Service
  1684. name string
  1685. urlParams_ gensupport.URLParams
  1686. ifNoneMatch_ string
  1687. ctx_ context.Context
  1688. header_ http.Header
  1689. }
  1690. // List: Returns all repos belonging to a project. The sizes of the
  1691. // repos are
  1692. // not set by ListRepos. To get the size of a repo, use GetRepo.
  1693. func (r *ProjectsReposService) List(name string) *ProjectsReposListCall {
  1694. c := &ProjectsReposListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1695. c.name = name
  1696. return c
  1697. }
  1698. // PageSize sets the optional parameter "pageSize": Maximum number of
  1699. // repositories to return; between 1 and 500.
  1700. // If not set or zero, defaults to 100 at the server.
  1701. func (c *ProjectsReposListCall) PageSize(pageSize int64) *ProjectsReposListCall {
  1702. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1703. return c
  1704. }
  1705. // PageToken sets the optional parameter "pageToken": Resume listing
  1706. // repositories where a prior ListReposResponse
  1707. // left off. This is an opaque token that must be obtained from
  1708. // a recent, prior ListReposResponse's next_page_token field.
  1709. func (c *ProjectsReposListCall) PageToken(pageToken string) *ProjectsReposListCall {
  1710. c.urlParams_.Set("pageToken", pageToken)
  1711. return c
  1712. }
  1713. // Fields allows partial responses to be retrieved. See
  1714. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1715. // for more information.
  1716. func (c *ProjectsReposListCall) Fields(s ...googleapi.Field) *ProjectsReposListCall {
  1717. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1718. return c
  1719. }
  1720. // IfNoneMatch sets the optional parameter which makes the operation
  1721. // fail if the object's ETag matches the given value. This is useful for
  1722. // getting updates only after the object has changed since the last
  1723. // request. Use googleapi.IsNotModified to check whether the response
  1724. // error from Do is the result of In-None-Match.
  1725. func (c *ProjectsReposListCall) IfNoneMatch(entityTag string) *ProjectsReposListCall {
  1726. c.ifNoneMatch_ = entityTag
  1727. return c
  1728. }
  1729. // Context sets the context to be used in this call's Do method. Any
  1730. // pending HTTP request will be aborted if the provided context is
  1731. // canceled.
  1732. func (c *ProjectsReposListCall) Context(ctx context.Context) *ProjectsReposListCall {
  1733. c.ctx_ = ctx
  1734. return c
  1735. }
  1736. // Header returns an http.Header that can be modified by the caller to
  1737. // add HTTP headers to the request.
  1738. func (c *ProjectsReposListCall) Header() http.Header {
  1739. if c.header_ == nil {
  1740. c.header_ = make(http.Header)
  1741. }
  1742. return c.header_
  1743. }
  1744. func (c *ProjectsReposListCall) doRequest(alt string) (*http.Response, error) {
  1745. reqHeaders := make(http.Header)
  1746. for k, v := range c.header_ {
  1747. reqHeaders[k] = v
  1748. }
  1749. reqHeaders.Set("User-Agent", c.s.userAgent())
  1750. if c.ifNoneMatch_ != "" {
  1751. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1752. }
  1753. var body io.Reader = nil
  1754. c.urlParams_.Set("alt", alt)
  1755. c.urlParams_.Set("prettyPrint", "false")
  1756. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/repos")
  1757. urls += "?" + c.urlParams_.Encode()
  1758. req, err := http.NewRequest("GET", urls, body)
  1759. if err != nil {
  1760. return nil, err
  1761. }
  1762. req.Header = reqHeaders
  1763. googleapi.Expand(req.URL, map[string]string{
  1764. "name": c.name,
  1765. })
  1766. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1767. }
  1768. // Do executes the "sourcerepo.projects.repos.list" call.
  1769. // Exactly one of *ListReposResponse or error will be non-nil. Any
  1770. // non-2xx status code is an error. Response headers are in either
  1771. // *ListReposResponse.ServerResponse.Header or (if a response was
  1772. // returned at all) in error.(*googleapi.Error).Header. Use
  1773. // googleapi.IsNotModified to check whether the returned error was
  1774. // because http.StatusNotModified was returned.
  1775. func (c *ProjectsReposListCall) Do(opts ...googleapi.CallOption) (*ListReposResponse, error) {
  1776. gensupport.SetOptions(c.urlParams_, opts...)
  1777. res, err := c.doRequest("json")
  1778. if res != nil && res.StatusCode == http.StatusNotModified {
  1779. if res.Body != nil {
  1780. res.Body.Close()
  1781. }
  1782. return nil, &googleapi.Error{
  1783. Code: res.StatusCode,
  1784. Header: res.Header,
  1785. }
  1786. }
  1787. if err != nil {
  1788. return nil, err
  1789. }
  1790. defer googleapi.CloseBody(res)
  1791. if err := googleapi.CheckResponse(res); err != nil {
  1792. return nil, err
  1793. }
  1794. ret := &ListReposResponse{
  1795. ServerResponse: googleapi.ServerResponse{
  1796. Header: res.Header,
  1797. HTTPStatusCode: res.StatusCode,
  1798. },
  1799. }
  1800. target := &ret
  1801. if err := gensupport.DecodeResponse(target, res); err != nil {
  1802. return nil, err
  1803. }
  1804. return ret, nil
  1805. // {
  1806. // "description": "Returns all repos belonging to a project. The sizes of the repos are\nnot set by ListRepos. To get the size of a repo, use GetRepo.",
  1807. // "flatPath": "v1/projects/{projectsId}/repos",
  1808. // "httpMethod": "GET",
  1809. // "id": "sourcerepo.projects.repos.list",
  1810. // "parameterOrder": [
  1811. // "name"
  1812. // ],
  1813. // "parameters": {
  1814. // "name": {
  1815. // "description": "The project ID whose repos should be listed. Values are of the form\n`projects/\u003cproject\u003e`.",
  1816. // "location": "path",
  1817. // "pattern": "^projects/[^/]+$",
  1818. // "required": true,
  1819. // "type": "string"
  1820. // },
  1821. // "pageSize": {
  1822. // "description": "Maximum number of repositories to return; between 1 and 500.\nIf not set or zero, defaults to 100 at the server.",
  1823. // "format": "int32",
  1824. // "location": "query",
  1825. // "type": "integer"
  1826. // },
  1827. // "pageToken": {
  1828. // "description": "Resume listing repositories where a prior ListReposResponse\nleft off. This is an opaque token that must be obtained from\na recent, prior ListReposResponse's next_page_token field.",
  1829. // "location": "query",
  1830. // "type": "string"
  1831. // }
  1832. // },
  1833. // "path": "v1/{+name}/repos",
  1834. // "response": {
  1835. // "$ref": "ListReposResponse"
  1836. // },
  1837. // "scopes": [
  1838. // "https://www.googleapis.com/auth/cloud-platform",
  1839. // "https://www.googleapis.com/auth/source.full_control",
  1840. // "https://www.googleapis.com/auth/source.read_only",
  1841. // "https://www.googleapis.com/auth/source.read_write"
  1842. // ]
  1843. // }
  1844. }
  1845. // Pages invokes f for each page of results.
  1846. // A non-nil error returned from f will halt the iteration.
  1847. // The provided context supersedes any context provided to the Context method.
  1848. func (c *ProjectsReposListCall) Pages(ctx context.Context, f func(*ListReposResponse) error) error {
  1849. c.ctx_ = ctx
  1850. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1851. for {
  1852. x, err := c.Do()
  1853. if err != nil {
  1854. return err
  1855. }
  1856. if err := f(x); err != nil {
  1857. return err
  1858. }
  1859. if x.NextPageToken == "" {
  1860. return nil
  1861. }
  1862. c.PageToken(x.NextPageToken)
  1863. }
  1864. }
  1865. // method id "sourcerepo.projects.repos.patch":
  1866. type ProjectsReposPatchCall struct {
  1867. s *Service
  1868. name string
  1869. updatereporequest *UpdateRepoRequest
  1870. urlParams_ gensupport.URLParams
  1871. ctx_ context.Context
  1872. header_ http.Header
  1873. }
  1874. // Patch: Updates information about a repo.
  1875. func (r *ProjectsReposService) Patch(name string, updatereporequest *UpdateRepoRequest) *ProjectsReposPatchCall {
  1876. c := &ProjectsReposPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1877. c.name = name
  1878. c.updatereporequest = updatereporequest
  1879. return c
  1880. }
  1881. // Fields allows partial responses to be retrieved. See
  1882. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1883. // for more information.
  1884. func (c *ProjectsReposPatchCall) Fields(s ...googleapi.Field) *ProjectsReposPatchCall {
  1885. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1886. return c
  1887. }
  1888. // Context sets the context to be used in this call's Do method. Any
  1889. // pending HTTP request will be aborted if the provided context is
  1890. // canceled.
  1891. func (c *ProjectsReposPatchCall) Context(ctx context.Context) *ProjectsReposPatchCall {
  1892. c.ctx_ = ctx
  1893. return c
  1894. }
  1895. // Header returns an http.Header that can be modified by the caller to
  1896. // add HTTP headers to the request.
  1897. func (c *ProjectsReposPatchCall) Header() http.Header {
  1898. if c.header_ == nil {
  1899. c.header_ = make(http.Header)
  1900. }
  1901. return c.header_
  1902. }
  1903. func (c *ProjectsReposPatchCall) doRequest(alt string) (*http.Response, error) {
  1904. reqHeaders := make(http.Header)
  1905. for k, v := range c.header_ {
  1906. reqHeaders[k] = v
  1907. }
  1908. reqHeaders.Set("User-Agent", c.s.userAgent())
  1909. var body io.Reader = nil
  1910. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatereporequest)
  1911. if err != nil {
  1912. return nil, err
  1913. }
  1914. reqHeaders.Set("Content-Type", "application/json")
  1915. c.urlParams_.Set("alt", alt)
  1916. c.urlParams_.Set("prettyPrint", "false")
  1917. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1918. urls += "?" + c.urlParams_.Encode()
  1919. req, err := http.NewRequest("PATCH", urls, body)
  1920. if err != nil {
  1921. return nil, err
  1922. }
  1923. req.Header = reqHeaders
  1924. googleapi.Expand(req.URL, map[string]string{
  1925. "name": c.name,
  1926. })
  1927. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1928. }
  1929. // Do executes the "sourcerepo.projects.repos.patch" call.
  1930. // Exactly one of *Repo or error will be non-nil. Any non-2xx status
  1931. // code is an error. Response headers are in either
  1932. // *Repo.ServerResponse.Header or (if a response was returned at all) in
  1933. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1934. // whether the returned error was because http.StatusNotModified was
  1935. // returned.
  1936. func (c *ProjectsReposPatchCall) Do(opts ...googleapi.CallOption) (*Repo, error) {
  1937. gensupport.SetOptions(c.urlParams_, opts...)
  1938. res, err := c.doRequest("json")
  1939. if res != nil && res.StatusCode == http.StatusNotModified {
  1940. if res.Body != nil {
  1941. res.Body.Close()
  1942. }
  1943. return nil, &googleapi.Error{
  1944. Code: res.StatusCode,
  1945. Header: res.Header,
  1946. }
  1947. }
  1948. if err != nil {
  1949. return nil, err
  1950. }
  1951. defer googleapi.CloseBody(res)
  1952. if err := googleapi.CheckResponse(res); err != nil {
  1953. return nil, err
  1954. }
  1955. ret := &Repo{
  1956. ServerResponse: googleapi.ServerResponse{
  1957. Header: res.Header,
  1958. HTTPStatusCode: res.StatusCode,
  1959. },
  1960. }
  1961. target := &ret
  1962. if err := gensupport.DecodeResponse(target, res); err != nil {
  1963. return nil, err
  1964. }
  1965. return ret, nil
  1966. // {
  1967. // "description": "Updates information about a repo.",
  1968. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}",
  1969. // "httpMethod": "PATCH",
  1970. // "id": "sourcerepo.projects.repos.patch",
  1971. // "parameterOrder": [
  1972. // "name"
  1973. // ],
  1974. // "parameters": {
  1975. // "name": {
  1976. // "description": "The name of the requested repository. Values are of the form\n`projects/\u003cproject\u003e/repos/\u003crepo\u003e`.",
  1977. // "location": "path",
  1978. // "pattern": "^projects/[^/]+/repos/.+$",
  1979. // "required": true,
  1980. // "type": "string"
  1981. // }
  1982. // },
  1983. // "path": "v1/{+name}",
  1984. // "request": {
  1985. // "$ref": "UpdateRepoRequest"
  1986. // },
  1987. // "response": {
  1988. // "$ref": "Repo"
  1989. // },
  1990. // "scopes": [
  1991. // "https://www.googleapis.com/auth/cloud-platform"
  1992. // ]
  1993. // }
  1994. }
  1995. // method id "sourcerepo.projects.repos.setIamPolicy":
  1996. type ProjectsReposSetIamPolicyCall struct {
  1997. s *Service
  1998. resource string
  1999. setiampolicyrequest *SetIamPolicyRequest
  2000. urlParams_ gensupport.URLParams
  2001. ctx_ context.Context
  2002. header_ http.Header
  2003. }
  2004. // SetIamPolicy: Sets the access control policy on the specified
  2005. // resource. Replaces any
  2006. // existing policy.
  2007. func (r *ProjectsReposService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsReposSetIamPolicyCall {
  2008. c := &ProjectsReposSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2009. c.resource = resource
  2010. c.setiampolicyrequest = setiampolicyrequest
  2011. return c
  2012. }
  2013. // Fields allows partial responses to be retrieved. See
  2014. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2015. // for more information.
  2016. func (c *ProjectsReposSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsReposSetIamPolicyCall {
  2017. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2018. return c
  2019. }
  2020. // Context sets the context to be used in this call's Do method. Any
  2021. // pending HTTP request will be aborted if the provided context is
  2022. // canceled.
  2023. func (c *ProjectsReposSetIamPolicyCall) Context(ctx context.Context) *ProjectsReposSetIamPolicyCall {
  2024. c.ctx_ = ctx
  2025. return c
  2026. }
  2027. // Header returns an http.Header that can be modified by the caller to
  2028. // add HTTP headers to the request.
  2029. func (c *ProjectsReposSetIamPolicyCall) Header() http.Header {
  2030. if c.header_ == nil {
  2031. c.header_ = make(http.Header)
  2032. }
  2033. return c.header_
  2034. }
  2035. func (c *ProjectsReposSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2036. reqHeaders := make(http.Header)
  2037. for k, v := range c.header_ {
  2038. reqHeaders[k] = v
  2039. }
  2040. reqHeaders.Set("User-Agent", c.s.userAgent())
  2041. var body io.Reader = nil
  2042. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2043. if err != nil {
  2044. return nil, err
  2045. }
  2046. reqHeaders.Set("Content-Type", "application/json")
  2047. c.urlParams_.Set("alt", alt)
  2048. c.urlParams_.Set("prettyPrint", "false")
  2049. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2050. urls += "?" + c.urlParams_.Encode()
  2051. req, err := http.NewRequest("POST", urls, body)
  2052. if err != nil {
  2053. return nil, err
  2054. }
  2055. req.Header = reqHeaders
  2056. googleapi.Expand(req.URL, map[string]string{
  2057. "resource": c.resource,
  2058. })
  2059. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2060. }
  2061. // Do executes the "sourcerepo.projects.repos.setIamPolicy" call.
  2062. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2063. // code is an error. Response headers are in either
  2064. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2065. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2066. // check whether the returned error was because http.StatusNotModified
  2067. // was returned.
  2068. func (c *ProjectsReposSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2069. gensupport.SetOptions(c.urlParams_, opts...)
  2070. res, err := c.doRequest("json")
  2071. if res != nil && res.StatusCode == http.StatusNotModified {
  2072. if res.Body != nil {
  2073. res.Body.Close()
  2074. }
  2075. return nil, &googleapi.Error{
  2076. Code: res.StatusCode,
  2077. Header: res.Header,
  2078. }
  2079. }
  2080. if err != nil {
  2081. return nil, err
  2082. }
  2083. defer googleapi.CloseBody(res)
  2084. if err := googleapi.CheckResponse(res); err != nil {
  2085. return nil, err
  2086. }
  2087. ret := &Policy{
  2088. ServerResponse: googleapi.ServerResponse{
  2089. Header: res.Header,
  2090. HTTPStatusCode: res.StatusCode,
  2091. },
  2092. }
  2093. target := &ret
  2094. if err := gensupport.DecodeResponse(target, res); err != nil {
  2095. return nil, err
  2096. }
  2097. return ret, nil
  2098. // {
  2099. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2100. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}:setIamPolicy",
  2101. // "httpMethod": "POST",
  2102. // "id": "sourcerepo.projects.repos.setIamPolicy",
  2103. // "parameterOrder": [
  2104. // "resource"
  2105. // ],
  2106. // "parameters": {
  2107. // "resource": {
  2108. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2109. // "location": "path",
  2110. // "pattern": "^projects/[^/]+/repos/.+$",
  2111. // "required": true,
  2112. // "type": "string"
  2113. // }
  2114. // },
  2115. // "path": "v1/{+resource}:setIamPolicy",
  2116. // "request": {
  2117. // "$ref": "SetIamPolicyRequest"
  2118. // },
  2119. // "response": {
  2120. // "$ref": "Policy"
  2121. // },
  2122. // "scopes": [
  2123. // "https://www.googleapis.com/auth/cloud-platform",
  2124. // "https://www.googleapis.com/auth/source.full_control"
  2125. // ]
  2126. // }
  2127. }
  2128. // method id "sourcerepo.projects.repos.testIamPermissions":
  2129. type ProjectsReposTestIamPermissionsCall struct {
  2130. s *Service
  2131. resource string
  2132. testiampermissionsrequest *TestIamPermissionsRequest
  2133. urlParams_ gensupport.URLParams
  2134. ctx_ context.Context
  2135. header_ http.Header
  2136. }
  2137. // TestIamPermissions: Returns permissions that a caller has on the
  2138. // specified resource.
  2139. // If the resource does not exist, this will return an empty set
  2140. // of
  2141. // permissions, not a NOT_FOUND error.
  2142. func (r *ProjectsReposService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsReposTestIamPermissionsCall {
  2143. c := &ProjectsReposTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2144. c.resource = resource
  2145. c.testiampermissionsrequest = testiampermissionsrequest
  2146. return c
  2147. }
  2148. // Fields allows partial responses to be retrieved. See
  2149. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2150. // for more information.
  2151. func (c *ProjectsReposTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsReposTestIamPermissionsCall {
  2152. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2153. return c
  2154. }
  2155. // Context sets the context to be used in this call's Do method. Any
  2156. // pending HTTP request will be aborted if the provided context is
  2157. // canceled.
  2158. func (c *ProjectsReposTestIamPermissionsCall) Context(ctx context.Context) *ProjectsReposTestIamPermissionsCall {
  2159. c.ctx_ = ctx
  2160. return c
  2161. }
  2162. // Header returns an http.Header that can be modified by the caller to
  2163. // add HTTP headers to the request.
  2164. func (c *ProjectsReposTestIamPermissionsCall) Header() http.Header {
  2165. if c.header_ == nil {
  2166. c.header_ = make(http.Header)
  2167. }
  2168. return c.header_
  2169. }
  2170. func (c *ProjectsReposTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2171. reqHeaders := make(http.Header)
  2172. for k, v := range c.header_ {
  2173. reqHeaders[k] = v
  2174. }
  2175. reqHeaders.Set("User-Agent", c.s.userAgent())
  2176. var body io.Reader = nil
  2177. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2178. if err != nil {
  2179. return nil, err
  2180. }
  2181. reqHeaders.Set("Content-Type", "application/json")
  2182. c.urlParams_.Set("alt", alt)
  2183. c.urlParams_.Set("prettyPrint", "false")
  2184. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2185. urls += "?" + c.urlParams_.Encode()
  2186. req, err := http.NewRequest("POST", urls, body)
  2187. if err != nil {
  2188. return nil, err
  2189. }
  2190. req.Header = reqHeaders
  2191. googleapi.Expand(req.URL, map[string]string{
  2192. "resource": c.resource,
  2193. })
  2194. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2195. }
  2196. // Do executes the "sourcerepo.projects.repos.testIamPermissions" call.
  2197. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2198. // Any non-2xx status code is an error. Response headers are in either
  2199. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2200. // was returned at all) in error.(*googleapi.Error).Header. Use
  2201. // googleapi.IsNotModified to check whether the returned error was
  2202. // because http.StatusNotModified was returned.
  2203. func (c *ProjectsReposTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2204. gensupport.SetOptions(c.urlParams_, opts...)
  2205. res, err := c.doRequest("json")
  2206. if res != nil && res.StatusCode == http.StatusNotModified {
  2207. if res.Body != nil {
  2208. res.Body.Close()
  2209. }
  2210. return nil, &googleapi.Error{
  2211. Code: res.StatusCode,
  2212. Header: res.Header,
  2213. }
  2214. }
  2215. if err != nil {
  2216. return nil, err
  2217. }
  2218. defer googleapi.CloseBody(res)
  2219. if err := googleapi.CheckResponse(res); err != nil {
  2220. return nil, err
  2221. }
  2222. ret := &TestIamPermissionsResponse{
  2223. ServerResponse: googleapi.ServerResponse{
  2224. Header: res.Header,
  2225. HTTPStatusCode: res.StatusCode,
  2226. },
  2227. }
  2228. target := &ret
  2229. if err := gensupport.DecodeResponse(target, res); err != nil {
  2230. return nil, err
  2231. }
  2232. return ret, nil
  2233. // {
  2234. // "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.",
  2235. // "flatPath": "v1/projects/{projectsId}/repos/{reposId}:testIamPermissions",
  2236. // "httpMethod": "POST",
  2237. // "id": "sourcerepo.projects.repos.testIamPermissions",
  2238. // "parameterOrder": [
  2239. // "resource"
  2240. // ],
  2241. // "parameters": {
  2242. // "resource": {
  2243. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2244. // "location": "path",
  2245. // "pattern": "^projects/[^/]+/repos/.+$",
  2246. // "required": true,
  2247. // "type": "string"
  2248. // }
  2249. // },
  2250. // "path": "v1/{+resource}:testIamPermissions",
  2251. // "request": {
  2252. // "$ref": "TestIamPermissionsRequest"
  2253. // },
  2254. // "response": {
  2255. // "$ref": "TestIamPermissionsResponse"
  2256. // },
  2257. // "scopes": [
  2258. // "https://www.googleapis.com/auth/cloud-platform",
  2259. // "https://www.googleapis.com/auth/source.full_control",
  2260. // "https://www.googleapis.com/auth/source.read_only",
  2261. // "https://www.googleapis.com/auth/source.read_write"
  2262. // ]
  2263. // }
  2264. }