You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2324 lines
78 KiB

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