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.
 
 
 

3947 lines
139 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 cloudfunctions provides access to the Cloud Functions API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/functions
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudfunctions/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudfunctionsService, err := cloudfunctions.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // cloudfunctionsService, err := cloudfunctions.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // cloudfunctionsService, err := cloudfunctions.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package cloudfunctions // import "google.golang.org/api/cloudfunctions/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "cloudfunctions:v1"
  67. const apiName = "cloudfunctions"
  68. const apiVersion = "v1"
  69. const basePath = "https://cloudfunctions.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Operations = NewOperationsService(s)
  106. s.Projects = NewProjectsService(s)
  107. return s, nil
  108. }
  109. type Service struct {
  110. client *http.Client
  111. BasePath string // API endpoint base URL
  112. UserAgent string // optional additional User-Agent fragment
  113. Operations *OperationsService
  114. Projects *ProjectsService
  115. }
  116. func (s *Service) userAgent() string {
  117. if s.UserAgent == "" {
  118. return googleapi.UserAgent
  119. }
  120. return googleapi.UserAgent + " " + s.UserAgent
  121. }
  122. func NewOperationsService(s *Service) *OperationsService {
  123. rs := &OperationsService{s: s}
  124. return rs
  125. }
  126. type OperationsService struct {
  127. s *Service
  128. }
  129. func NewProjectsService(s *Service) *ProjectsService {
  130. rs := &ProjectsService{s: s}
  131. rs.Locations = NewProjectsLocationsService(s)
  132. return rs
  133. }
  134. type ProjectsService struct {
  135. s *Service
  136. Locations *ProjectsLocationsService
  137. }
  138. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  139. rs := &ProjectsLocationsService{s: s}
  140. rs.Functions = NewProjectsLocationsFunctionsService(s)
  141. return rs
  142. }
  143. type ProjectsLocationsService struct {
  144. s *Service
  145. Functions *ProjectsLocationsFunctionsService
  146. }
  147. func NewProjectsLocationsFunctionsService(s *Service) *ProjectsLocationsFunctionsService {
  148. rs := &ProjectsLocationsFunctionsService{s: s}
  149. return rs
  150. }
  151. type ProjectsLocationsFunctionsService struct {
  152. s *Service
  153. }
  154. // AuditConfig: Specifies the audit configuration for a service.
  155. // The configuration determines which permission types are logged, and
  156. // what
  157. // identities, if any, are exempted from logging.
  158. // An AuditConfig must have one or more AuditLogConfigs.
  159. //
  160. // If there are AuditConfigs for both `allServices` and a specific
  161. // service,
  162. // the union of the two AuditConfigs is used for that service: the
  163. // log_types
  164. // specified in each AuditConfig are enabled, and the exempted_members
  165. // in each
  166. // AuditLogConfig are exempted.
  167. //
  168. // Example Policy with multiple AuditConfigs:
  169. //
  170. // {
  171. // "audit_configs": [
  172. // {
  173. // "service": "allServices"
  174. // "audit_log_configs": [
  175. // {
  176. // "log_type": "DATA_READ",
  177. // "exempted_members": [
  178. // "user:foo@gmail.com"
  179. // ]
  180. // },
  181. // {
  182. // "log_type": "DATA_WRITE",
  183. // },
  184. // {
  185. // "log_type": "ADMIN_READ",
  186. // }
  187. // ]
  188. // },
  189. // {
  190. // "service": "fooservice.googleapis.com"
  191. // "audit_log_configs": [
  192. // {
  193. // "log_type": "DATA_READ",
  194. // },
  195. // {
  196. // "log_type": "DATA_WRITE",
  197. // "exempted_members": [
  198. // "user:bar@gmail.com"
  199. // ]
  200. // }
  201. // ]
  202. // }
  203. // ]
  204. // }
  205. //
  206. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  207. // ADMIN_READ
  208. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  209. // and
  210. // bar@gmail.com from DATA_WRITE logging.
  211. type AuditConfig struct {
  212. // AuditLogConfigs: The configuration for logging of each type of
  213. // permission.
  214. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  215. // Service: Specifies a service that will be enabled for audit
  216. // logging.
  217. // For example, `storage.googleapis.com`,
  218. // `cloudsql.googleapis.com`.
  219. // `allServices` is a special value that covers all services.
  220. Service string `json:"service,omitempty"`
  221. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  222. // unconditionally include in API requests. By default, fields with
  223. // empty values are omitted from API requests. However, any non-pointer,
  224. // non-interface field appearing in ForceSendFields will be sent to the
  225. // server regardless of whether the field is empty or not. This may be
  226. // used to include empty fields in Patch requests.
  227. ForceSendFields []string `json:"-"`
  228. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  229. // include in API requests with the JSON null value. By default, fields
  230. // with empty values are omitted from API requests. However, any field
  231. // with an empty value appearing in NullFields will be sent to the
  232. // server as null. It is an error if a field in this list has a
  233. // non-empty value. This may be used to include null fields in Patch
  234. // requests.
  235. NullFields []string `json:"-"`
  236. }
  237. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  238. type NoMethod AuditConfig
  239. raw := NoMethod(*s)
  240. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  241. }
  242. // AuditLogConfig: Provides the configuration for logging a type of
  243. // permissions.
  244. // Example:
  245. //
  246. // {
  247. // "audit_log_configs": [
  248. // {
  249. // "log_type": "DATA_READ",
  250. // "exempted_members": [
  251. // "user:foo@gmail.com"
  252. // ]
  253. // },
  254. // {
  255. // "log_type": "DATA_WRITE",
  256. // }
  257. // ]
  258. // }
  259. //
  260. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  261. // exempting
  262. // foo@gmail.com from DATA_READ logging.
  263. type AuditLogConfig struct {
  264. // ExemptedMembers: Specifies the identities that do not cause logging
  265. // for this type of
  266. // permission.
  267. // Follows the same format of Binding.members.
  268. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  269. // LogType: The log type that this config enables.
  270. //
  271. // Possible values:
  272. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  273. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  274. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  275. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  276. LogType string `json:"logType,omitempty"`
  277. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  278. // unconditionally include in API requests. By default, fields with
  279. // empty values are omitted from API requests. However, any non-pointer,
  280. // non-interface field appearing in ForceSendFields will be sent to the
  281. // server regardless of whether the field is empty or not. This may be
  282. // used to include empty fields in Patch requests.
  283. ForceSendFields []string `json:"-"`
  284. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  285. // include in API requests with the JSON null value. By default, fields
  286. // with empty values are omitted from API requests. However, any field
  287. // with an empty value appearing in NullFields will be sent to the
  288. // server as null. It is an error if a field in this list has a
  289. // non-empty value. This may be used to include null fields in Patch
  290. // requests.
  291. NullFields []string `json:"-"`
  292. }
  293. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  294. type NoMethod AuditLogConfig
  295. raw := NoMethod(*s)
  296. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  297. }
  298. // Binding: Associates `members` with a `role`.
  299. type Binding struct {
  300. // Condition: Unimplemented. The condition that is associated with this
  301. // binding.
  302. // NOTE: an unsatisfied condition will not allow user access via
  303. // current
  304. // binding. Different bindings, including their conditions, are
  305. // examined
  306. // independently.
  307. Condition *Expr `json:"condition,omitempty"`
  308. // Members: Specifies the identities requesting access for a Cloud
  309. // Platform resource.
  310. // `members` can have the following values:
  311. //
  312. // * `allUsers`: A special identifier that represents anyone who is
  313. // on the internet; with or without a Google account.
  314. //
  315. // * `allAuthenticatedUsers`: A special identifier that represents
  316. // anyone
  317. // who is authenticated with a Google account or a service
  318. // account.
  319. //
  320. // * `user:{emailid}`: An email address that represents a specific
  321. // Google
  322. // account. For example, `alice@gmail.com` .
  323. //
  324. //
  325. // * `serviceAccount:{emailid}`: An email address that represents a
  326. // service
  327. // account. For example,
  328. // `my-other-app@appspot.gserviceaccount.com`.
  329. //
  330. // * `group:{emailid}`: An email address that represents a Google
  331. // group.
  332. // For example, `admins@example.com`.
  333. //
  334. //
  335. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  336. // the
  337. // users of that domain. For example, `google.com` or
  338. // `example.com`.
  339. //
  340. //
  341. Members []string `json:"members,omitempty"`
  342. // Role: Role that is assigned to `members`.
  343. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  344. Role string `json:"role,omitempty"`
  345. // ForceSendFields is a list of field names (e.g. "Condition") to
  346. // unconditionally include in API requests. By default, fields with
  347. // empty values are omitted from API requests. However, any non-pointer,
  348. // non-interface field appearing in ForceSendFields will be sent to the
  349. // server regardless of whether the field is empty or not. This may be
  350. // used to include empty fields in Patch requests.
  351. ForceSendFields []string `json:"-"`
  352. // NullFields is a list of field names (e.g. "Condition") to include in
  353. // API requests with the JSON null value. By default, fields with empty
  354. // values are omitted from API requests. However, any field with an
  355. // empty value appearing in NullFields will be sent to the server as
  356. // null. It is an error if a field in this list has a non-empty value.
  357. // This may be used to include null fields in Patch requests.
  358. NullFields []string `json:"-"`
  359. }
  360. func (s *Binding) MarshalJSON() ([]byte, error) {
  361. type NoMethod Binding
  362. raw := NoMethod(*s)
  363. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  364. }
  365. // CallFunctionRequest: Request for the `CallFunction` method.
  366. type CallFunctionRequest struct {
  367. // Data: Input to be passed to the function.
  368. Data string `json:"data,omitempty"`
  369. // ForceSendFields is a list of field names (e.g. "Data") to
  370. // unconditionally include in API requests. By default, fields with
  371. // empty values are omitted from API requests. However, any non-pointer,
  372. // non-interface field appearing in ForceSendFields will be sent to the
  373. // server regardless of whether the field is empty or not. This may be
  374. // used to include empty fields in Patch requests.
  375. ForceSendFields []string `json:"-"`
  376. // NullFields is a list of field names (e.g. "Data") to include in API
  377. // requests with the JSON null value. By default, fields with empty
  378. // values are omitted from API requests. However, any field with an
  379. // empty value appearing in NullFields will be sent to the server as
  380. // null. It is an error if a field in this list has a non-empty value.
  381. // This may be used to include null fields in Patch requests.
  382. NullFields []string `json:"-"`
  383. }
  384. func (s *CallFunctionRequest) MarshalJSON() ([]byte, error) {
  385. type NoMethod CallFunctionRequest
  386. raw := NoMethod(*s)
  387. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  388. }
  389. // CallFunctionResponse: Response of `CallFunction` method.
  390. type CallFunctionResponse struct {
  391. // Error: Either system or user-function generated error. Set if
  392. // execution
  393. // was not successful.
  394. Error string `json:"error,omitempty"`
  395. // ExecutionId: Execution id of function invocation.
  396. ExecutionId string `json:"executionId,omitempty"`
  397. // Result: Result populated for successful execution of synchronous
  398. // function. Will
  399. // not be populated if function does not return a result through
  400. // context.
  401. Result string `json:"result,omitempty"`
  402. // ServerResponse contains the HTTP response code and headers from the
  403. // server.
  404. googleapi.ServerResponse `json:"-"`
  405. // ForceSendFields is a list of field names (e.g. "Error") to
  406. // unconditionally include in API requests. By default, fields with
  407. // empty values are omitted from API requests. However, any non-pointer,
  408. // non-interface field appearing in ForceSendFields will be sent to the
  409. // server regardless of whether the field is empty or not. This may be
  410. // used to include empty fields in Patch requests.
  411. ForceSendFields []string `json:"-"`
  412. // NullFields is a list of field names (e.g. "Error") to include in API
  413. // requests with the JSON null value. By default, fields with empty
  414. // values are omitted from API requests. However, any field with an
  415. // empty value appearing in NullFields will be sent to the server as
  416. // null. It is an error if a field in this list has a non-empty value.
  417. // This may be used to include null fields in Patch requests.
  418. NullFields []string `json:"-"`
  419. }
  420. func (s *CallFunctionResponse) MarshalJSON() ([]byte, error) {
  421. type NoMethod CallFunctionResponse
  422. raw := NoMethod(*s)
  423. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  424. }
  425. // CloudFunction: Describes a Cloud Function that contains user
  426. // computation executed in
  427. // response to an event. It encapsulate function and triggers
  428. // configurations.
  429. // LINT.IfChange
  430. type CloudFunction struct {
  431. // AvailableMemoryMb: The amount of memory in MB available for a
  432. // function.
  433. // Defaults to 256MB.
  434. AvailableMemoryMb int64 `json:"availableMemoryMb,omitempty"`
  435. // Description: User-provided description of a function.
  436. Description string `json:"description,omitempty"`
  437. // EntryPoint: The name of the function (as defined in source code) that
  438. // will be
  439. // executed. Defaults to the resource name suffix, if not specified.
  440. // For
  441. // backward compatibility, if function with given name is not found,
  442. // then the
  443. // system will try to use function named "function".
  444. // For Node.js this is name of a function exported by the module
  445. // specified
  446. // in `source_location`.
  447. EntryPoint string `json:"entryPoint,omitempty"`
  448. // EnvironmentVariables: Environment variables that shall be available
  449. // during function execution.
  450. EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
  451. // EventTrigger: A source that fires events in response to a condition
  452. // in another service.
  453. EventTrigger *EventTrigger `json:"eventTrigger,omitempty"`
  454. // HttpsTrigger: An HTTPS endpoint type of source that can be triggered
  455. // via URL.
  456. HttpsTrigger *HttpsTrigger `json:"httpsTrigger,omitempty"`
  457. // Labels: Labels associated with this Cloud Function.
  458. Labels map[string]string `json:"labels,omitempty"`
  459. // MaxInstances: The limit on the maximum number of function instances
  460. // that may coexist at a
  461. // given time. This feature is currently in alpha, available only
  462. // for
  463. // whitelisted users.
  464. MaxInstances int64 `json:"maxInstances,omitempty"`
  465. // Name: A user-defined name of the function. Function names must be
  466. // unique
  467. // globally and match pattern `projects/*/locations/*/functions/*`
  468. Name string `json:"name,omitempty"`
  469. // Network: The VPC Network that this cloud function can connect to. It
  470. // can be
  471. // either the fully-qualified URI, or the short name of the network
  472. // resource.
  473. // If the short network name is used, the network must belong to the
  474. // same
  475. // project. Otherwise, it must belong to a project within the
  476. // same
  477. // organization. The format of this field is
  478. // either
  479. // `projects/{project}/global/networks/{network}` or `{network}`,
  480. // where
  481. // {project} is a project id where the network is defined, and {network}
  482. // is
  483. // the short name of the network.
  484. //
  485. // This field is mutually exclusive with `vpc_connector` and will be
  486. // replaced
  487. // by it.
  488. //
  489. // See [the VPC
  490. // documentation](https://cloud.google.com/compute/docs/vpc) for
  491. // more information on connecting Cloud projects.
  492. //
  493. // This feature is currently in alpha, available only for whitelisted
  494. // users.
  495. Network string `json:"network,omitempty"`
  496. // Runtime: The runtime in which the function is going to run. Example
  497. // values include:
  498. // `go111`: for Go 1.11
  499. // `nodejs6`: for Node.js 6
  500. // `nodejs8`: for Node.js 8
  501. // `nodejs10`: for Node.js 10
  502. // `python37`: for Python 3.7
  503. // `ruby25`: for Ruby 2.5
  504. //
  505. // If empty, defaults to `nodejs6`.
  506. Runtime string `json:"runtime,omitempty"`
  507. // ServiceAccountEmail: The email of the function's service account. If
  508. // empty, defaults to
  509. // {project_id}@appspot.gserviceaccount.com.
  510. ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
  511. // SourceArchiveUrl: The Google Cloud Storage URL, starting with gs://,
  512. // pointing to the zip
  513. // archive which contains the function.
  514. SourceArchiveUrl string `json:"sourceArchiveUrl,omitempty"`
  515. // SourceRepository: **Beta Feature**
  516. //
  517. // The source repository where a function is hosted.
  518. SourceRepository *SourceRepository `json:"sourceRepository,omitempty"`
  519. // SourceUploadUrl: The Google Cloud Storage signed URL used for source
  520. // uploading, generated
  521. // by google.cloud.functions.v1.GenerateUploadUrl
  522. SourceUploadUrl string `json:"sourceUploadUrl,omitempty"`
  523. // Status: Output only. Status of the function deployment.
  524. //
  525. // Possible values:
  526. // "CLOUD_FUNCTION_STATUS_UNSPECIFIED" - Not specified. Invalid state.
  527. // "ACTIVE" - Function has been succesfully deployed and is serving.
  528. // "OFFLINE" - Function deployment failed and the function isn’t
  529. // serving.
  530. // "DEPLOY_IN_PROGRESS" - Function is being created or updated.
  531. // "DELETE_IN_PROGRESS" - Function is being deleted.
  532. // "UNKNOWN" - Function deployment failed and the function serving
  533. // state is undefined.
  534. // The function should be updated or deleted to move it out of this
  535. // state.
  536. Status string `json:"status,omitempty"`
  537. // Timeout: The function execution timeout. Execution is considered
  538. // failed and
  539. // can be terminated if the function is not completed at the end of
  540. // the
  541. // timeout period. Defaults to 60 seconds.
  542. Timeout string `json:"timeout,omitempty"`
  543. // UpdateTime: Output only. The last update timestamp of a Cloud
  544. // Function.
  545. UpdateTime string `json:"updateTime,omitempty"`
  546. // VersionId: Output only.
  547. // The version identifier of the Cloud Function. Each deployment
  548. // attempt
  549. // results in a new version of a function being created.
  550. VersionId int64 `json:"versionId,omitempty,string"`
  551. // VpcConnector: The VPC Network Connector that this cloud function can
  552. // connect to. It can
  553. // be either the fully-qualified URI, or the short name of the
  554. // network
  555. // connector resource. The format of this field
  556. // is
  557. // `projects/*/locations/*/connectors/*`
  558. //
  559. // This field is mutually exclusive with `network` field and will
  560. // eventually
  561. // replace it.
  562. //
  563. // See [the VPC
  564. // documentation](https://cloud.google.com/compute/docs/vpc) for
  565. // more information on connecting Cloud projects.
  566. //
  567. // This feature is currently in alpha, available only for whitelisted
  568. // users.
  569. VpcConnector string `json:"vpcConnector,omitempty"`
  570. // ServerResponse contains the HTTP response code and headers from the
  571. // server.
  572. googleapi.ServerResponse `json:"-"`
  573. // ForceSendFields is a list of field names (e.g. "AvailableMemoryMb")
  574. // to unconditionally include in API requests. By default, fields with
  575. // empty values are omitted from API requests. However, any non-pointer,
  576. // non-interface field appearing in ForceSendFields will be sent to the
  577. // server regardless of whether the field is empty or not. This may be
  578. // used to include empty fields in Patch requests.
  579. ForceSendFields []string `json:"-"`
  580. // NullFields is a list of field names (e.g. "AvailableMemoryMb") to
  581. // include in API requests with the JSON null value. By default, fields
  582. // with empty values are omitted from API requests. However, any field
  583. // with an empty value appearing in NullFields will be sent to the
  584. // server as null. It is an error if a field in this list has a
  585. // non-empty value. This may be used to include null fields in Patch
  586. // requests.
  587. NullFields []string `json:"-"`
  588. }
  589. func (s *CloudFunction) MarshalJSON() ([]byte, error) {
  590. type NoMethod CloudFunction
  591. raw := NoMethod(*s)
  592. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  593. }
  594. // EventTrigger: Describes EventTrigger, used to request events be sent
  595. // from another
  596. // service.
  597. type EventTrigger struct {
  598. // EventType: Required. The type of event to observe. For
  599. // example:
  600. // `providers/cloud.storage/eventTypes/object.change`
  601. // and
  602. // `providers/cloud.pubsub/eventTypes/topic.publish`.
  603. //
  604. // Event types match pattern `providers/*/eventTypes/*.*`.
  605. // The pattern contains:
  606. //
  607. // 1. namespace: For example, `cloud.storage` and
  608. // `google.firebase.analytics`.
  609. // 2. resource type: The type of resource on which event occurs. For
  610. // example, the Google Cloud Storage API includes the type
  611. // `object`.
  612. // 3. action: The action that generates the event. For example, action
  613. // for
  614. // a Google Cloud Storage Object is 'change'.
  615. // These parts are lower case.
  616. EventType string `json:"eventType,omitempty"`
  617. // FailurePolicy: Specifies policy for failed executions.
  618. FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"`
  619. // Resource: Required. The resource(s) from which to observe events, for
  620. // example,
  621. // `projects/_/buckets/myBucket`.
  622. //
  623. // Not all syntactically correct values are accepted by all services.
  624. // For
  625. // example:
  626. //
  627. // 1. The authorization model must support it. Google Cloud Functions
  628. // only allows EventTriggers to be deployed that observe resources in
  629. // the
  630. // same project as the `CloudFunction`.
  631. // 2. The resource type must match the pattern expected for an
  632. // `event_type`. For example, an `EventTrigger` that has an
  633. // `event_type` of "google.pubsub.topic.publish" should have a
  634. // resource
  635. // that matches Google Cloud Pub/Sub topics.
  636. //
  637. // Additionally, some services may support short names when creating
  638. // an
  639. // `EventTrigger`. These will always be returned in the normalized
  640. // "long"
  641. // format.
  642. //
  643. // See each *service's* documentation for supported formats.
  644. Resource string `json:"resource,omitempty"`
  645. // Service: The hostname of the service that should be observed.
  646. //
  647. // If no string is provided, the default service implementing the API
  648. // will
  649. // be used. For example, `storage.googleapis.com` is the default for
  650. // all
  651. // event types in the `google.storage` namespace.
  652. Service string `json:"service,omitempty"`
  653. // ForceSendFields is a list of field names (e.g. "EventType") to
  654. // unconditionally include in API requests. By default, fields with
  655. // empty values are omitted from API requests. However, any non-pointer,
  656. // non-interface field appearing in ForceSendFields will be sent to the
  657. // server regardless of whether the field is empty or not. This may be
  658. // used to include empty fields in Patch requests.
  659. ForceSendFields []string `json:"-"`
  660. // NullFields is a list of field names (e.g. "EventType") to include in
  661. // API requests with the JSON null value. By default, fields with empty
  662. // values are omitted from API requests. However, any field with an
  663. // empty value appearing in NullFields will be sent to the server as
  664. // null. It is an error if a field in this list has a non-empty value.
  665. // This may be used to include null fields in Patch requests.
  666. NullFields []string `json:"-"`
  667. }
  668. func (s *EventTrigger) MarshalJSON() ([]byte, error) {
  669. type NoMethod EventTrigger
  670. raw := NoMethod(*s)
  671. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  672. }
  673. // Expr: Represents an expression text. Example:
  674. //
  675. // title: "User account presence"
  676. // description: "Determines whether the request has a user account"
  677. // expression: "size(request.user) > 0"
  678. type Expr struct {
  679. // Description: An optional description of the expression. This is a
  680. // longer text which
  681. // describes the expression, e.g. when hovered over it in a UI.
  682. Description string `json:"description,omitempty"`
  683. // Expression: Textual representation of an expression in
  684. // Common Expression Language syntax.
  685. //
  686. // The application context of the containing message determines
  687. // which
  688. // well-known feature set of CEL is supported.
  689. Expression string `json:"expression,omitempty"`
  690. // Location: An optional string indicating the location of the
  691. // expression for error
  692. // reporting, e.g. a file name and a position in the file.
  693. Location string `json:"location,omitempty"`
  694. // Title: An optional title for the expression, i.e. a short string
  695. // describing
  696. // its purpose. This can be used e.g. in UIs which allow to enter
  697. // the
  698. // expression.
  699. Title string `json:"title,omitempty"`
  700. // ForceSendFields is a list of field names (e.g. "Description") to
  701. // unconditionally include in API requests. By default, fields with
  702. // empty values are omitted from API requests. However, any non-pointer,
  703. // non-interface field appearing in ForceSendFields will be sent to the
  704. // server regardless of whether the field is empty or not. This may be
  705. // used to include empty fields in Patch requests.
  706. ForceSendFields []string `json:"-"`
  707. // NullFields is a list of field names (e.g. "Description") to include
  708. // in API requests with the JSON null value. By default, fields with
  709. // empty values are omitted from API requests. However, any field with
  710. // an empty value appearing in NullFields will be sent to the server as
  711. // null. It is an error if a field in this list has a non-empty value.
  712. // This may be used to include null fields in Patch requests.
  713. NullFields []string `json:"-"`
  714. }
  715. func (s *Expr) MarshalJSON() ([]byte, error) {
  716. type NoMethod Expr
  717. raw := NoMethod(*s)
  718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  719. }
  720. // FailurePolicy: Describes the policy in case of function's execution
  721. // failure.
  722. // If empty, then defaults to ignoring failures (i.e. not retrying
  723. // them).
  724. type FailurePolicy struct {
  725. // Retry: If specified, then the function will be retried in case of a
  726. // failure.
  727. Retry *Retry `json:"retry,omitempty"`
  728. // ForceSendFields is a list of field names (e.g. "Retry") to
  729. // unconditionally include in API requests. By default, fields with
  730. // empty values are omitted from API requests. However, any non-pointer,
  731. // non-interface field appearing in ForceSendFields will be sent to the
  732. // server regardless of whether the field is empty or not. This may be
  733. // used to include empty fields in Patch requests.
  734. ForceSendFields []string `json:"-"`
  735. // NullFields is a list of field names (e.g. "Retry") to include in API
  736. // requests with the JSON null value. By default, fields with empty
  737. // values are omitted from API requests. However, any field with an
  738. // empty value appearing in NullFields will be sent to the server as
  739. // null. It is an error if a field in this list has a non-empty value.
  740. // This may be used to include null fields in Patch requests.
  741. NullFields []string `json:"-"`
  742. }
  743. func (s *FailurePolicy) MarshalJSON() ([]byte, error) {
  744. type NoMethod FailurePolicy
  745. raw := NoMethod(*s)
  746. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  747. }
  748. // GenerateDownloadUrlRequest: Request of `GenerateDownloadUrl` method.
  749. type GenerateDownloadUrlRequest struct {
  750. // VersionId: The optional version of function. If not set, default,
  751. // current version
  752. // is used.
  753. VersionId uint64 `json:"versionId,omitempty,string"`
  754. // ForceSendFields is a list of field names (e.g. "VersionId") 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. "VersionId") to include in
  762. // API 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 *GenerateDownloadUrlRequest) MarshalJSON() ([]byte, error) {
  770. type NoMethod GenerateDownloadUrlRequest
  771. raw := NoMethod(*s)
  772. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  773. }
  774. // GenerateDownloadUrlResponse: Response of `GenerateDownloadUrl`
  775. // method.
  776. type GenerateDownloadUrlResponse struct {
  777. // DownloadUrl: The generated Google Cloud Storage signed URL that
  778. // should be used for
  779. // function source code download.
  780. DownloadUrl string `json:"downloadUrl,omitempty"`
  781. // ServerResponse contains the HTTP response code and headers from the
  782. // server.
  783. googleapi.ServerResponse `json:"-"`
  784. // ForceSendFields is a list of field names (e.g. "DownloadUrl") to
  785. // unconditionally include in API requests. By default, fields with
  786. // empty values are omitted from API requests. However, any non-pointer,
  787. // non-interface field appearing in ForceSendFields will be sent to the
  788. // server regardless of whether the field is empty or not. This may be
  789. // used to include empty fields in Patch requests.
  790. ForceSendFields []string `json:"-"`
  791. // NullFields is a list of field names (e.g. "DownloadUrl") to include
  792. // in API requests with the JSON null value. By default, fields with
  793. // empty values are omitted from API requests. However, any field with
  794. // an empty value appearing in NullFields will be sent to the server as
  795. // null. It is an error if a field in this list has a non-empty value.
  796. // This may be used to include null fields in Patch requests.
  797. NullFields []string `json:"-"`
  798. }
  799. func (s *GenerateDownloadUrlResponse) MarshalJSON() ([]byte, error) {
  800. type NoMethod GenerateDownloadUrlResponse
  801. raw := NoMethod(*s)
  802. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  803. }
  804. // GenerateUploadUrlRequest: Request of `GenerateSourceUploadUrl`
  805. // method.
  806. type GenerateUploadUrlRequest struct {
  807. }
  808. // GenerateUploadUrlResponse: Response of `GenerateSourceUploadUrl`
  809. // method.
  810. type GenerateUploadUrlResponse struct {
  811. // UploadUrl: The generated Google Cloud Storage signed URL that should
  812. // be used for a
  813. // function source code upload. The uploaded file should be a zip
  814. // archive
  815. // which contains a function.
  816. UploadUrl string `json:"uploadUrl,omitempty"`
  817. // ServerResponse contains the HTTP response code and headers from the
  818. // server.
  819. googleapi.ServerResponse `json:"-"`
  820. // ForceSendFields is a list of field names (e.g. "UploadUrl") to
  821. // unconditionally include in API requests. By default, fields with
  822. // empty values are omitted from API requests. However, any non-pointer,
  823. // non-interface field appearing in ForceSendFields will be sent to the
  824. // server regardless of whether the field is empty or not. This may be
  825. // used to include empty fields in Patch requests.
  826. ForceSendFields []string `json:"-"`
  827. // NullFields is a list of field names (e.g. "UploadUrl") to include in
  828. // API requests with the JSON null value. By default, fields with empty
  829. // values are omitted from API requests. However, any field with an
  830. // empty value appearing in NullFields will be sent to the server as
  831. // null. It is an error if a field in this list has a non-empty value.
  832. // This may be used to include null fields in Patch requests.
  833. NullFields []string `json:"-"`
  834. }
  835. func (s *GenerateUploadUrlResponse) MarshalJSON() ([]byte, error) {
  836. type NoMethod GenerateUploadUrlResponse
  837. raw := NoMethod(*s)
  838. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  839. }
  840. // HttpsTrigger: Describes HttpsTrigger, could be used to connect web
  841. // hooks to function.
  842. type HttpsTrigger struct {
  843. // Url: Output only. The deployed url for the function.
  844. Url string `json:"url,omitempty"`
  845. // ForceSendFields is a list of field names (e.g. "Url") to
  846. // unconditionally include in API requests. By default, fields with
  847. // empty values are omitted from API requests. However, any non-pointer,
  848. // non-interface field appearing in ForceSendFields will be sent to the
  849. // server regardless of whether the field is empty or not. This may be
  850. // used to include empty fields in Patch requests.
  851. ForceSendFields []string `json:"-"`
  852. // NullFields is a list of field names (e.g. "Url") to include in API
  853. // requests with the JSON null value. By default, fields with empty
  854. // values are omitted from API requests. However, any field with an
  855. // empty value appearing in NullFields will be sent to the server as
  856. // null. It is an error if a field in this list has a non-empty value.
  857. // This may be used to include null fields in Patch requests.
  858. NullFields []string `json:"-"`
  859. }
  860. func (s *HttpsTrigger) MarshalJSON() ([]byte, error) {
  861. type NoMethod HttpsTrigger
  862. raw := NoMethod(*s)
  863. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  864. }
  865. // ListFunctionsResponse: Response for the `ListFunctions` method.
  866. type ListFunctionsResponse struct {
  867. // Functions: The functions that match the request.
  868. Functions []*CloudFunction `json:"functions,omitempty"`
  869. // NextPageToken: If not empty, indicates that there may be more
  870. // functions that match
  871. // the request; this value should be passed in a
  872. // new
  873. // google.cloud.functions.v1.ListFunctionsRequest
  874. // to get more functions.
  875. NextPageToken string `json:"nextPageToken,omitempty"`
  876. // ServerResponse contains the HTTP response code and headers from the
  877. // server.
  878. googleapi.ServerResponse `json:"-"`
  879. // ForceSendFields is a list of field names (e.g. "Functions") to
  880. // unconditionally include in API requests. By default, fields with
  881. // empty values are omitted from API requests. However, any non-pointer,
  882. // non-interface field appearing in ForceSendFields will be sent to the
  883. // server regardless of whether the field is empty or not. This may be
  884. // used to include empty fields in Patch requests.
  885. ForceSendFields []string `json:"-"`
  886. // NullFields is a list of field names (e.g. "Functions") to include in
  887. // API requests with the JSON null value. By default, fields with empty
  888. // values are omitted from API requests. However, any field with an
  889. // empty value appearing in NullFields will be sent to the server as
  890. // null. It is an error if a field in this list has a non-empty value.
  891. // This may be used to include null fields in Patch requests.
  892. NullFields []string `json:"-"`
  893. }
  894. func (s *ListFunctionsResponse) MarshalJSON() ([]byte, error) {
  895. type NoMethod ListFunctionsResponse
  896. raw := NoMethod(*s)
  897. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  898. }
  899. // ListLocationsResponse: The response message for
  900. // Locations.ListLocations.
  901. type ListLocationsResponse struct {
  902. // Locations: A list of locations that matches the specified filter in
  903. // the request.
  904. Locations []*Location `json:"locations,omitempty"`
  905. // NextPageToken: The standard List next-page token.
  906. NextPageToken string `json:"nextPageToken,omitempty"`
  907. // ServerResponse contains the HTTP response code and headers from the
  908. // server.
  909. googleapi.ServerResponse `json:"-"`
  910. // ForceSendFields is a list of field names (e.g. "Locations") to
  911. // unconditionally include in API requests. By default, fields with
  912. // empty values are omitted from API requests. However, any non-pointer,
  913. // non-interface field appearing in ForceSendFields will be sent to the
  914. // server regardless of whether the field is empty or not. This may be
  915. // used to include empty fields in Patch requests.
  916. ForceSendFields []string `json:"-"`
  917. // NullFields is a list of field names (e.g. "Locations") to include in
  918. // API requests with the JSON null value. By default, fields with empty
  919. // values are omitted from API requests. However, any field with an
  920. // empty value appearing in NullFields will be sent to the server as
  921. // null. It is an error if a field in this list has a non-empty value.
  922. // This may be used to include null fields in Patch requests.
  923. NullFields []string `json:"-"`
  924. }
  925. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  926. type NoMethod ListLocationsResponse
  927. raw := NoMethod(*s)
  928. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  929. }
  930. // ListOperationsResponse: The response message for
  931. // Operations.ListOperations.
  932. type ListOperationsResponse struct {
  933. // NextPageToken: The standard List next-page token.
  934. NextPageToken string `json:"nextPageToken,omitempty"`
  935. // Operations: A list of operations that matches the specified filter in
  936. // the request.
  937. Operations []*Operation `json:"operations,omitempty"`
  938. // ServerResponse contains the HTTP response code and headers from the
  939. // server.
  940. googleapi.ServerResponse `json:"-"`
  941. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  942. // unconditionally include in API requests. By default, fields with
  943. // empty values are omitted from API requests. However, any non-pointer,
  944. // non-interface field appearing in ForceSendFields will be sent to the
  945. // server regardless of whether the field is empty or not. This may be
  946. // used to include empty fields in Patch requests.
  947. ForceSendFields []string `json:"-"`
  948. // NullFields is a list of field names (e.g. "NextPageToken") to include
  949. // in API requests with the JSON null value. By default, fields with
  950. // empty values are omitted from API requests. However, any field with
  951. // an empty value appearing in NullFields will be sent to the server as
  952. // null. It is an error if a field in this list has a non-empty value.
  953. // This may be used to include null fields in Patch requests.
  954. NullFields []string `json:"-"`
  955. }
  956. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  957. type NoMethod ListOperationsResponse
  958. raw := NoMethod(*s)
  959. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  960. }
  961. // Location: A resource that represents Google Cloud Platform location.
  962. type Location struct {
  963. // DisplayName: The friendly name for this location, typically a nearby
  964. // city name.
  965. // For example, "Tokyo".
  966. DisplayName string `json:"displayName,omitempty"`
  967. // Labels: Cross-service attributes for the location. For example
  968. //
  969. // {"cloud.googleapis.com/region": "us-east1"}
  970. Labels map[string]string `json:"labels,omitempty"`
  971. // LocationId: The canonical id for this location. For example:
  972. // "us-east1".
  973. LocationId string `json:"locationId,omitempty"`
  974. // Metadata: Service-specific metadata. For example the available
  975. // capacity at the given
  976. // location.
  977. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  978. // Name: Resource name for the location, which may vary between
  979. // implementations.
  980. // For example: "projects/example-project/locations/us-east1"
  981. Name string `json:"name,omitempty"`
  982. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  983. // unconditionally include in API requests. By default, fields with
  984. // empty values are omitted from API requests. However, any non-pointer,
  985. // non-interface field appearing in ForceSendFields will be sent to the
  986. // server regardless of whether the field is empty or not. This may be
  987. // used to include empty fields in Patch requests.
  988. ForceSendFields []string `json:"-"`
  989. // NullFields is a list of field names (e.g. "DisplayName") to include
  990. // in API requests with the JSON null value. By default, fields with
  991. // empty values are omitted from API requests. However, any field with
  992. // an empty value appearing in NullFields will be sent to the server as
  993. // null. It is an error if a field in this list has a non-empty value.
  994. // This may be used to include null fields in Patch requests.
  995. NullFields []string `json:"-"`
  996. }
  997. func (s *Location) MarshalJSON() ([]byte, error) {
  998. type NoMethod Location
  999. raw := NoMethod(*s)
  1000. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1001. }
  1002. // Operation: This resource represents a long-running operation that is
  1003. // the result of a
  1004. // network API call.
  1005. type Operation struct {
  1006. // Done: If the value is `false`, it means the operation is still in
  1007. // progress.
  1008. // If `true`, the operation is completed, and either `error` or
  1009. // `response` is
  1010. // available.
  1011. Done bool `json:"done,omitempty"`
  1012. // Error: The error result of the operation in case of failure or
  1013. // cancellation.
  1014. Error *Status `json:"error,omitempty"`
  1015. // Metadata: Service-specific metadata associated with the operation.
  1016. // It typically
  1017. // contains progress information and common metadata such as create
  1018. // time.
  1019. // Some services might not provide such metadata. Any method that
  1020. // returns a
  1021. // long-running operation should document the metadata type, if any.
  1022. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1023. // Name: The server-assigned name, which is only unique within the same
  1024. // service that
  1025. // originally returns it. If you use the default HTTP mapping,
  1026. // the
  1027. // `name` should have the format of `operations/some/unique/name`.
  1028. Name string `json:"name,omitempty"`
  1029. // Response: The normal response of the operation in case of success.
  1030. // If the original
  1031. // method returns no data on success, such as `Delete`, the response
  1032. // is
  1033. // `google.protobuf.Empty`. If the original method is
  1034. // standard
  1035. // `Get`/`Create`/`Update`, the response should be the resource. For
  1036. // other
  1037. // methods, the response should have the type `XxxResponse`, where
  1038. // `Xxx`
  1039. // is the original method name. For example, if the original method
  1040. // name
  1041. // is `TakeSnapshot()`, the inferred response type
  1042. // is
  1043. // `TakeSnapshotResponse`.
  1044. Response googleapi.RawMessage `json:"response,omitempty"`
  1045. // ServerResponse contains the HTTP response code and headers from the
  1046. // server.
  1047. googleapi.ServerResponse `json:"-"`
  1048. // ForceSendFields is a list of field names (e.g. "Done") to
  1049. // unconditionally include in API requests. By default, fields with
  1050. // empty values are omitted from API requests. However, any non-pointer,
  1051. // non-interface field appearing in ForceSendFields will be sent to the
  1052. // server regardless of whether the field is empty or not. This may be
  1053. // used to include empty fields in Patch requests.
  1054. ForceSendFields []string `json:"-"`
  1055. // NullFields is a list of field names (e.g. "Done") to include in API
  1056. // requests with the JSON null value. By default, fields with empty
  1057. // values are omitted from API requests. However, any field with an
  1058. // empty value appearing in NullFields will be sent to the server as
  1059. // null. It is an error if a field in this list has a non-empty value.
  1060. // This may be used to include null fields in Patch requests.
  1061. NullFields []string `json:"-"`
  1062. }
  1063. func (s *Operation) MarshalJSON() ([]byte, error) {
  1064. type NoMethod Operation
  1065. raw := NoMethod(*s)
  1066. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1067. }
  1068. // OperationMetadataV1: Metadata describing an Operation
  1069. type OperationMetadataV1 struct {
  1070. // Request: The original request that started the operation.
  1071. Request googleapi.RawMessage `json:"request,omitempty"`
  1072. // Target: Target of the operation - for
  1073. // example
  1074. // projects/project-1/locations/region-1/functions/function-1
  1075. Target string `json:"target,omitempty"`
  1076. // Type: Type of operation.
  1077. //
  1078. // Possible values:
  1079. // "OPERATION_UNSPECIFIED" - Unknown operation type.
  1080. // "CREATE_FUNCTION" - Triggered by CreateFunction call
  1081. // "UPDATE_FUNCTION" - Triggered by UpdateFunction call
  1082. // "DELETE_FUNCTION" - Triggered by DeleteFunction call.
  1083. Type string `json:"type,omitempty"`
  1084. // UpdateTime: The last update timestamp of the operation.
  1085. UpdateTime string `json:"updateTime,omitempty"`
  1086. // VersionId: Version id of the function created or updated by an API
  1087. // call.
  1088. // This field is only populated for Create and Update operations.
  1089. VersionId int64 `json:"versionId,omitempty,string"`
  1090. // ForceSendFields is a list of field names (e.g. "Request") to
  1091. // unconditionally include in API requests. By default, fields with
  1092. // empty values are omitted from API requests. However, any non-pointer,
  1093. // non-interface field appearing in ForceSendFields will be sent to the
  1094. // server regardless of whether the field is empty or not. This may be
  1095. // used to include empty fields in Patch requests.
  1096. ForceSendFields []string `json:"-"`
  1097. // NullFields is a list of field names (e.g. "Request") to include in
  1098. // API requests with the JSON null value. By default, fields with empty
  1099. // values are omitted from API requests. However, any field with an
  1100. // empty value appearing in NullFields will be sent to the server as
  1101. // null. It is an error if a field in this list has a non-empty value.
  1102. // This may be used to include null fields in Patch requests.
  1103. NullFields []string `json:"-"`
  1104. }
  1105. func (s *OperationMetadataV1) MarshalJSON() ([]byte, error) {
  1106. type NoMethod OperationMetadataV1
  1107. raw := NoMethod(*s)
  1108. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1109. }
  1110. // OperationMetadataV1Beta2: Metadata describing an Operation
  1111. type OperationMetadataV1Beta2 struct {
  1112. // Request: The original request that started the operation.
  1113. Request googleapi.RawMessage `json:"request,omitempty"`
  1114. // Target: Target of the operation - for
  1115. // example
  1116. // projects/project-1/locations/region-1/functions/function-1
  1117. Target string `json:"target,omitempty"`
  1118. // Type: Type of operation.
  1119. //
  1120. // Possible values:
  1121. // "OPERATION_UNSPECIFIED" - Unknown operation type.
  1122. // "CREATE_FUNCTION" - Triggered by CreateFunction call
  1123. // "UPDATE_FUNCTION" - Triggered by UpdateFunction call
  1124. // "DELETE_FUNCTION" - Triggered by DeleteFunction call.
  1125. Type string `json:"type,omitempty"`
  1126. // UpdateTime: The last update timestamp of the operation.
  1127. UpdateTime string `json:"updateTime,omitempty"`
  1128. // VersionId: Version id of the function created or updated by an API
  1129. // call.
  1130. // This field is only populated for Create and Update operations.
  1131. VersionId int64 `json:"versionId,omitempty,string"`
  1132. // ForceSendFields is a list of field names (e.g. "Request") to
  1133. // unconditionally include in API requests. By default, fields with
  1134. // empty values are omitted from API requests. However, any non-pointer,
  1135. // non-interface field appearing in ForceSendFields will be sent to the
  1136. // server regardless of whether the field is empty or not. This may be
  1137. // used to include empty fields in Patch requests.
  1138. ForceSendFields []string `json:"-"`
  1139. // NullFields is a list of field names (e.g. "Request") to include in
  1140. // API requests with the JSON null value. By default, fields with empty
  1141. // values are omitted from API requests. However, any field with an
  1142. // empty value appearing in NullFields will be sent to the server as
  1143. // null. It is an error if a field in this list has a non-empty value.
  1144. // This may be used to include null fields in Patch requests.
  1145. NullFields []string `json:"-"`
  1146. }
  1147. func (s *OperationMetadataV1Beta2) MarshalJSON() ([]byte, error) {
  1148. type NoMethod OperationMetadataV1Beta2
  1149. raw := NoMethod(*s)
  1150. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1151. }
  1152. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1153. // used to
  1154. // specify access control policies for Cloud Platform resources.
  1155. //
  1156. //
  1157. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1158. // of
  1159. // `members` to a `role`, where the members can be user accounts, Google
  1160. // groups,
  1161. // Google domains, and service accounts. A `role` is a named list of
  1162. // permissions
  1163. // defined by IAM.
  1164. //
  1165. // **JSON Example**
  1166. //
  1167. // {
  1168. // "bindings": [
  1169. // {
  1170. // "role": "roles/owner",
  1171. // "members": [
  1172. // "user:mike@example.com",
  1173. // "group:admins@example.com",
  1174. // "domain:google.com",
  1175. //
  1176. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1177. // ]
  1178. // },
  1179. // {
  1180. // "role": "roles/viewer",
  1181. // "members": ["user:sean@example.com"]
  1182. // }
  1183. // ]
  1184. // }
  1185. //
  1186. // **YAML Example**
  1187. //
  1188. // bindings:
  1189. // - members:
  1190. // - user:mike@example.com
  1191. // - group:admins@example.com
  1192. // - domain:google.com
  1193. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1194. // role: roles/owner
  1195. // - members:
  1196. // - user:sean@example.com
  1197. // role: roles/viewer
  1198. //
  1199. //
  1200. // For a description of IAM and its features, see the
  1201. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1202. type Policy struct {
  1203. // AuditConfigs: Specifies cloud audit logging configuration for this
  1204. // policy.
  1205. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  1206. // Bindings: Associates a list of `members` to a `role`.
  1207. // `bindings` with no members will result in an error.
  1208. Bindings []*Binding `json:"bindings,omitempty"`
  1209. // Etag: `etag` is used for optimistic concurrency control as a way to
  1210. // help
  1211. // prevent simultaneous updates of a policy from overwriting each
  1212. // other.
  1213. // It is strongly suggested that systems make use of the `etag` in
  1214. // the
  1215. // read-modify-write cycle to perform policy updates in order to avoid
  1216. // race
  1217. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1218. // and
  1219. // systems are expected to put that etag in the request to
  1220. // `setIamPolicy` to
  1221. // ensure that their change will be applied to the same version of the
  1222. // policy.
  1223. //
  1224. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1225. // existing
  1226. // policy is overwritten blindly.
  1227. Etag string `json:"etag,omitempty"`
  1228. // Version: Deprecated.
  1229. Version int64 `json:"version,omitempty"`
  1230. // ServerResponse contains the HTTP response code and headers from the
  1231. // server.
  1232. googleapi.ServerResponse `json:"-"`
  1233. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  1234. // unconditionally include in API requests. By default, fields with
  1235. // empty values are omitted from API requests. However, any non-pointer,
  1236. // non-interface field appearing in ForceSendFields will be sent to the
  1237. // server regardless of whether the field is empty or not. This may be
  1238. // used to include empty fields in Patch requests.
  1239. ForceSendFields []string `json:"-"`
  1240. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  1241. // in API requests with the JSON null value. By default, fields with
  1242. // empty values are omitted from API requests. However, any field with
  1243. // an empty value appearing in NullFields will be sent to the server as
  1244. // null. It is an error if a field in this list has a non-empty value.
  1245. // This may be used to include null fields in Patch requests.
  1246. NullFields []string `json:"-"`
  1247. }
  1248. func (s *Policy) MarshalJSON() ([]byte, error) {
  1249. type NoMethod Policy
  1250. raw := NoMethod(*s)
  1251. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1252. }
  1253. // Retry: Describes the retry policy in case of function's execution
  1254. // failure.
  1255. // A function execution will be retried on any failure.
  1256. // A failed execution will be retried up to 7 days with an exponential
  1257. // backoff
  1258. // (capped at 10 seconds).
  1259. // Retried execution is charged as any other execution.
  1260. type Retry struct {
  1261. }
  1262. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1263. type SetIamPolicyRequest struct {
  1264. // Policy: REQUIRED: The complete policy to be applied to the
  1265. // `resource`. The size of
  1266. // the policy is limited to a few 10s of KB. An empty policy is a
  1267. // valid policy but certain Cloud Platform services (such as
  1268. // Projects)
  1269. // might reject them.
  1270. Policy *Policy `json:"policy,omitempty"`
  1271. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1272. // policy to modify. Only
  1273. // the fields in the mask will be modified. If no mask is provided,
  1274. // the
  1275. // following default mask is used:
  1276. // paths: "bindings, etag"
  1277. // This field is only used by Cloud IAM.
  1278. UpdateMask string `json:"updateMask,omitempty"`
  1279. // ForceSendFields is a list of field names (e.g. "Policy") to
  1280. // unconditionally include in API requests. By default, fields with
  1281. // empty values are omitted from API requests. However, any non-pointer,
  1282. // non-interface field appearing in ForceSendFields will be sent to the
  1283. // server regardless of whether the field is empty or not. This may be
  1284. // used to include empty fields in Patch requests.
  1285. ForceSendFields []string `json:"-"`
  1286. // NullFields is a list of field names (e.g. "Policy") to include in API
  1287. // requests with the JSON null value. By default, fields with empty
  1288. // values are omitted from API requests. However, any field with an
  1289. // empty value appearing in NullFields will be sent to the server as
  1290. // null. It is an error if a field in this list has a non-empty value.
  1291. // This may be used to include null fields in Patch requests.
  1292. NullFields []string `json:"-"`
  1293. }
  1294. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1295. type NoMethod SetIamPolicyRequest
  1296. raw := NoMethod(*s)
  1297. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1298. }
  1299. // SourceRepository: Describes SourceRepository, used to represent
  1300. // parameters related to
  1301. // source repository where a function is hosted.
  1302. type SourceRepository struct {
  1303. // DeployedUrl: Output only. The URL pointing to the hosted repository
  1304. // where the function
  1305. // were defined at the time of deployment. It always points to a
  1306. // specific
  1307. // commit in the format described above.
  1308. DeployedUrl string `json:"deployedUrl,omitempty"`
  1309. // Url: The URL pointing to the hosted repository where the function is
  1310. // defined.
  1311. // There are supported Cloud Source Repository URLs in the
  1312. // following
  1313. // formats:
  1314. //
  1315. // To refer to a specific
  1316. // commit:
  1317. // `https://source.developers.google.com/projects/*/repos/*/revis
  1318. // ions/*/paths/*`
  1319. // To refer to a moveable alias
  1320. // (branch):
  1321. // `https://source.developers.google.com/projects/*/repos/*/mov
  1322. // eable-aliases/*/paths/*`
  1323. // In particular, to refer to HEAD use `master` moveable alias.
  1324. // To refer to a specific fixed alias
  1325. // (tag):
  1326. // `https://source.developers.google.com/projects/*/repos/*/fixed-
  1327. // aliases/*/paths/*`
  1328. //
  1329. // You may omit `paths/*` if you want to use the main directory.
  1330. Url string `json:"url,omitempty"`
  1331. // ForceSendFields is a list of field names (e.g. "DeployedUrl") to
  1332. // unconditionally include in API requests. By default, fields with
  1333. // empty values are omitted from API requests. However, any non-pointer,
  1334. // non-interface field appearing in ForceSendFields will be sent to the
  1335. // server regardless of whether the field is empty or not. This may be
  1336. // used to include empty fields in Patch requests.
  1337. ForceSendFields []string `json:"-"`
  1338. // NullFields is a list of field names (e.g. "DeployedUrl") to include
  1339. // in API requests with the JSON null value. By default, fields with
  1340. // empty values are omitted from API requests. However, any field with
  1341. // an empty value appearing in NullFields will be sent to the server as
  1342. // null. It is an error if a field in this list has a non-empty value.
  1343. // This may be used to include null fields in Patch requests.
  1344. NullFields []string `json:"-"`
  1345. }
  1346. func (s *SourceRepository) MarshalJSON() ([]byte, error) {
  1347. type NoMethod SourceRepository
  1348. raw := NoMethod(*s)
  1349. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1350. }
  1351. // Status: The `Status` type defines a logical error model that is
  1352. // suitable for different
  1353. // programming environments, including REST APIs and RPC APIs. It is
  1354. // used by
  1355. // [gRPC](https://github.com/grpc). The error model is designed to
  1356. // be:
  1357. //
  1358. // - Simple to use and understand for most users
  1359. // - Flexible enough to meet unexpected needs
  1360. //
  1361. // # Overview
  1362. //
  1363. // The `Status` message contains three pieces of data: error code, error
  1364. // message,
  1365. // and error details. The error code should be an enum value
  1366. // of
  1367. // google.rpc.Code, but it may accept additional error codes if needed.
  1368. // The
  1369. // error message should be a developer-facing English message that
  1370. // helps
  1371. // developers *understand* and *resolve* the error. If a localized
  1372. // user-facing
  1373. // error message is needed, put the localized message in the error
  1374. // details or
  1375. // localize it in the client. The optional error details may contain
  1376. // arbitrary
  1377. // information about the error. There is a predefined set of error
  1378. // detail types
  1379. // in the package `google.rpc` that can be used for common error
  1380. // conditions.
  1381. //
  1382. // # Language mapping
  1383. //
  1384. // The `Status` message is the logical representation of the error
  1385. // model, but it
  1386. // is not necessarily the actual wire format. When the `Status` message
  1387. // is
  1388. // exposed in different client libraries and different wire protocols,
  1389. // it can be
  1390. // mapped differently. For example, it will likely be mapped to some
  1391. // exceptions
  1392. // in Java, but more likely mapped to some error codes in C.
  1393. //
  1394. // # Other uses
  1395. //
  1396. // The error model and the `Status` message can be used in a variety
  1397. // of
  1398. // environments, either with or without APIs, to provide a
  1399. // consistent developer experience across different
  1400. // environments.
  1401. //
  1402. // Example uses of this error model include:
  1403. //
  1404. // - Partial errors. If a service needs to return partial errors to the
  1405. // client,
  1406. // it may embed the `Status` in the normal response to indicate the
  1407. // partial
  1408. // errors.
  1409. //
  1410. // - Workflow errors. A typical workflow has multiple steps. Each step
  1411. // may
  1412. // have a `Status` message for error reporting.
  1413. //
  1414. // - Batch operations. If a client uses batch request and batch
  1415. // response, the
  1416. // `Status` message should be used directly inside batch response,
  1417. // one for
  1418. // each error sub-response.
  1419. //
  1420. // - Asynchronous operations. If an API call embeds asynchronous
  1421. // operation
  1422. // results in its response, the status of those operations should
  1423. // be
  1424. // represented directly using the `Status` message.
  1425. //
  1426. // - Logging. If some API errors are stored in logs, the message
  1427. // `Status` could
  1428. // be used directly after any stripping needed for security/privacy
  1429. // reasons.
  1430. type Status struct {
  1431. // Code: The status code, which should be an enum value of
  1432. // google.rpc.Code.
  1433. Code int64 `json:"code,omitempty"`
  1434. // Details: A list of messages that carry the error details. There is a
  1435. // common set of
  1436. // message types for APIs to use.
  1437. Details []googleapi.RawMessage `json:"details,omitempty"`
  1438. // Message: A developer-facing error message, which should be in
  1439. // English. Any
  1440. // user-facing error message should be localized and sent in
  1441. // the
  1442. // google.rpc.Status.details field, or localized by the client.
  1443. Message string `json:"message,omitempty"`
  1444. // ForceSendFields is a list of field names (e.g. "Code") to
  1445. // unconditionally include in API requests. By default, fields with
  1446. // empty values are omitted from API requests. However, any non-pointer,
  1447. // non-interface field appearing in ForceSendFields will be sent to the
  1448. // server regardless of whether the field is empty or not. This may be
  1449. // used to include empty fields in Patch requests.
  1450. ForceSendFields []string `json:"-"`
  1451. // NullFields is a list of field names (e.g. "Code") to include in API
  1452. // requests with the JSON null value. By default, fields with empty
  1453. // values are omitted from API requests. However, any field with an
  1454. // empty value appearing in NullFields will be sent to the server as
  1455. // null. It is an error if a field in this list has a non-empty value.
  1456. // This may be used to include null fields in Patch requests.
  1457. NullFields []string `json:"-"`
  1458. }
  1459. func (s *Status) MarshalJSON() ([]byte, error) {
  1460. type NoMethod Status
  1461. raw := NoMethod(*s)
  1462. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1463. }
  1464. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1465. // method.
  1466. type TestIamPermissionsRequest struct {
  1467. // Permissions: The set of permissions to check for the `resource`.
  1468. // Permissions with
  1469. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1470. // more
  1471. // information see
  1472. // [IAM
  1473. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1474. Permissions []string `json:"permissions,omitempty"`
  1475. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1476. // unconditionally include in API requests. By default, fields with
  1477. // empty values are omitted from API requests. However, any non-pointer,
  1478. // non-interface field appearing in ForceSendFields will be sent to the
  1479. // server regardless of whether the field is empty or not. This may be
  1480. // used to include empty fields in Patch requests.
  1481. ForceSendFields []string `json:"-"`
  1482. // NullFields is a list of field names (e.g. "Permissions") to include
  1483. // in API requests with the JSON null value. By default, fields with
  1484. // empty values are omitted from API requests. However, any field with
  1485. // an empty value appearing in NullFields will be sent to the server as
  1486. // null. It is an error if a field in this list has a non-empty value.
  1487. // This may be used to include null fields in Patch requests.
  1488. NullFields []string `json:"-"`
  1489. }
  1490. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1491. type NoMethod TestIamPermissionsRequest
  1492. raw := NoMethod(*s)
  1493. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1494. }
  1495. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1496. // method.
  1497. type TestIamPermissionsResponse struct {
  1498. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1499. // the caller is
  1500. // allowed.
  1501. Permissions []string `json:"permissions,omitempty"`
  1502. // ServerResponse contains the HTTP response code and headers from the
  1503. // server.
  1504. googleapi.ServerResponse `json:"-"`
  1505. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1506. // unconditionally include in API requests. By default, fields with
  1507. // empty values are omitted from API requests. However, any non-pointer,
  1508. // non-interface field appearing in ForceSendFields will be sent to the
  1509. // server regardless of whether the field is empty or not. This may be
  1510. // used to include empty fields in Patch requests.
  1511. ForceSendFields []string `json:"-"`
  1512. // NullFields is a list of field names (e.g. "Permissions") to include
  1513. // in API requests with the JSON null value. By default, fields with
  1514. // empty values are omitted from API requests. However, any field with
  1515. // an empty value appearing in NullFields will be sent to the server as
  1516. // null. It is an error if a field in this list has a non-empty value.
  1517. // This may be used to include null fields in Patch requests.
  1518. NullFields []string `json:"-"`
  1519. }
  1520. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1521. type NoMethod TestIamPermissionsResponse
  1522. raw := NoMethod(*s)
  1523. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1524. }
  1525. // method id "cloudfunctions.operations.get":
  1526. type OperationsGetCall struct {
  1527. s *Service
  1528. name string
  1529. urlParams_ gensupport.URLParams
  1530. ifNoneMatch_ string
  1531. ctx_ context.Context
  1532. header_ http.Header
  1533. }
  1534. // Get: Gets the latest state of a long-running operation. Clients can
  1535. // use this
  1536. // method to poll the operation result at intervals as recommended by
  1537. // the API
  1538. // service.
  1539. func (r *OperationsService) Get(name string) *OperationsGetCall {
  1540. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1541. c.name = name
  1542. return c
  1543. }
  1544. // Fields allows partial responses to be retrieved. See
  1545. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1546. // for more information.
  1547. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  1548. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1549. return c
  1550. }
  1551. // IfNoneMatch sets the optional parameter which makes the operation
  1552. // fail if the object's ETag matches the given value. This is useful for
  1553. // getting updates only after the object has changed since the last
  1554. // request. Use googleapi.IsNotModified to check whether the response
  1555. // error from Do is the result of In-None-Match.
  1556. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  1557. c.ifNoneMatch_ = entityTag
  1558. return c
  1559. }
  1560. // Context sets the context to be used in this call's Do method. Any
  1561. // pending HTTP request will be aborted if the provided context is
  1562. // canceled.
  1563. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  1564. c.ctx_ = ctx
  1565. return c
  1566. }
  1567. // Header returns an http.Header that can be modified by the caller to
  1568. // add HTTP headers to the request.
  1569. func (c *OperationsGetCall) Header() http.Header {
  1570. if c.header_ == nil {
  1571. c.header_ = make(http.Header)
  1572. }
  1573. return c.header_
  1574. }
  1575. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1576. reqHeaders := make(http.Header)
  1577. for k, v := range c.header_ {
  1578. reqHeaders[k] = v
  1579. }
  1580. reqHeaders.Set("User-Agent", c.s.userAgent())
  1581. if c.ifNoneMatch_ != "" {
  1582. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1583. }
  1584. var body io.Reader = nil
  1585. c.urlParams_.Set("alt", alt)
  1586. c.urlParams_.Set("prettyPrint", "false")
  1587. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1588. urls += "?" + c.urlParams_.Encode()
  1589. req, err := http.NewRequest("GET", urls, body)
  1590. if err != nil {
  1591. return nil, err
  1592. }
  1593. req.Header = reqHeaders
  1594. googleapi.Expand(req.URL, map[string]string{
  1595. "name": c.name,
  1596. })
  1597. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1598. }
  1599. // Do executes the "cloudfunctions.operations.get" call.
  1600. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1601. // status code is an error. Response headers are in either
  1602. // *Operation.ServerResponse.Header or (if a response was returned at
  1603. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1604. // to check whether the returned error was because
  1605. // http.StatusNotModified was returned.
  1606. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1607. gensupport.SetOptions(c.urlParams_, opts...)
  1608. res, err := c.doRequest("json")
  1609. if res != nil && res.StatusCode == http.StatusNotModified {
  1610. if res.Body != nil {
  1611. res.Body.Close()
  1612. }
  1613. return nil, &googleapi.Error{
  1614. Code: res.StatusCode,
  1615. Header: res.Header,
  1616. }
  1617. }
  1618. if err != nil {
  1619. return nil, err
  1620. }
  1621. defer googleapi.CloseBody(res)
  1622. if err := googleapi.CheckResponse(res); err != nil {
  1623. return nil, err
  1624. }
  1625. ret := &Operation{
  1626. ServerResponse: googleapi.ServerResponse{
  1627. Header: res.Header,
  1628. HTTPStatusCode: res.StatusCode,
  1629. },
  1630. }
  1631. target := &ret
  1632. if err := gensupport.DecodeResponse(target, res); err != nil {
  1633. return nil, err
  1634. }
  1635. return ret, nil
  1636. // {
  1637. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  1638. // "flatPath": "v1/operations/{operationsId}",
  1639. // "httpMethod": "GET",
  1640. // "id": "cloudfunctions.operations.get",
  1641. // "parameterOrder": [
  1642. // "name"
  1643. // ],
  1644. // "parameters": {
  1645. // "name": {
  1646. // "description": "The name of the operation resource.",
  1647. // "location": "path",
  1648. // "pattern": "^operations/[^/]+$",
  1649. // "required": true,
  1650. // "type": "string"
  1651. // }
  1652. // },
  1653. // "path": "v1/{+name}",
  1654. // "response": {
  1655. // "$ref": "Operation"
  1656. // },
  1657. // "scopes": [
  1658. // "https://www.googleapis.com/auth/cloud-platform"
  1659. // ]
  1660. // }
  1661. }
  1662. // method id "cloudfunctions.operations.list":
  1663. type OperationsListCall struct {
  1664. s *Service
  1665. urlParams_ gensupport.URLParams
  1666. ifNoneMatch_ string
  1667. ctx_ context.Context
  1668. header_ http.Header
  1669. }
  1670. // List: Lists operations that match the specified filter in the
  1671. // request. If the
  1672. // server doesn't support this method, it returns
  1673. // `UNIMPLEMENTED`.
  1674. //
  1675. // NOTE: the `name` binding allows API services to override the
  1676. // binding
  1677. // to use different resource name schemes, such as `users/*/operations`.
  1678. // To
  1679. // override the binding, API services can add a binding such
  1680. // as
  1681. // "/v1/{name=users/*}/operations" to their service configuration.
  1682. // For backwards compatibility, the default name includes the
  1683. // operations
  1684. // collection id, however overriding users must ensure the name
  1685. // binding
  1686. // is the parent resource, without the operations collection id.
  1687. func (r *OperationsService) List() *OperationsListCall {
  1688. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1689. return c
  1690. }
  1691. // Filter sets the optional parameter "filter": Required. A filter for
  1692. // matching the requested operations.<br><br> The supported formats of
  1693. // <b>filter</b> are:<br> To query for specific function:
  1694. // <code>project:*,location:*,function:*</code><br> To query for all of
  1695. // the latest operations for a project:
  1696. // <code>project:*,latest:true</code>
  1697. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  1698. c.urlParams_.Set("filter", filter)
  1699. return c
  1700. }
  1701. // Name sets the optional parameter "name": Must not be set.
  1702. func (c *OperationsListCall) Name(name string) *OperationsListCall {
  1703. c.urlParams_.Set("name", name)
  1704. return c
  1705. }
  1706. // PageSize sets the optional parameter "pageSize": The standard list
  1707. // page size.
  1708. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  1709. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1710. return c
  1711. }
  1712. // PageToken sets the optional parameter "pageToken": The standard list
  1713. // page token.
  1714. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  1715. c.urlParams_.Set("pageToken", pageToken)
  1716. return c
  1717. }
  1718. // Fields allows partial responses to be retrieved. See
  1719. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1720. // for more information.
  1721. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  1722. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1723. return c
  1724. }
  1725. // IfNoneMatch sets the optional parameter which makes the operation
  1726. // fail if the object's ETag matches the given value. This is useful for
  1727. // getting updates only after the object has changed since the last
  1728. // request. Use googleapi.IsNotModified to check whether the response
  1729. // error from Do is the result of In-None-Match.
  1730. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  1731. c.ifNoneMatch_ = entityTag
  1732. return c
  1733. }
  1734. // Context sets the context to be used in this call's Do method. Any
  1735. // pending HTTP request will be aborted if the provided context is
  1736. // canceled.
  1737. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  1738. c.ctx_ = ctx
  1739. return c
  1740. }
  1741. // Header returns an http.Header that can be modified by the caller to
  1742. // add HTTP headers to the request.
  1743. func (c *OperationsListCall) Header() http.Header {
  1744. if c.header_ == nil {
  1745. c.header_ = make(http.Header)
  1746. }
  1747. return c.header_
  1748. }
  1749. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  1750. reqHeaders := make(http.Header)
  1751. for k, v := range c.header_ {
  1752. reqHeaders[k] = v
  1753. }
  1754. reqHeaders.Set("User-Agent", c.s.userAgent())
  1755. if c.ifNoneMatch_ != "" {
  1756. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1757. }
  1758. var body io.Reader = nil
  1759. c.urlParams_.Set("alt", alt)
  1760. c.urlParams_.Set("prettyPrint", "false")
  1761. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/operations")
  1762. urls += "?" + c.urlParams_.Encode()
  1763. req, err := http.NewRequest("GET", urls, body)
  1764. if err != nil {
  1765. return nil, err
  1766. }
  1767. req.Header = reqHeaders
  1768. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1769. }
  1770. // Do executes the "cloudfunctions.operations.list" call.
  1771. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  1772. // non-2xx status code is an error. Response headers are in either
  1773. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  1774. // returned at all) in error.(*googleapi.Error).Header. Use
  1775. // googleapi.IsNotModified to check whether the returned error was
  1776. // because http.StatusNotModified was returned.
  1777. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  1778. gensupport.SetOptions(c.urlParams_, opts...)
  1779. res, err := c.doRequest("json")
  1780. if res != nil && res.StatusCode == http.StatusNotModified {
  1781. if res.Body != nil {
  1782. res.Body.Close()
  1783. }
  1784. return nil, &googleapi.Error{
  1785. Code: res.StatusCode,
  1786. Header: res.Header,
  1787. }
  1788. }
  1789. if err != nil {
  1790. return nil, err
  1791. }
  1792. defer googleapi.CloseBody(res)
  1793. if err := googleapi.CheckResponse(res); err != nil {
  1794. return nil, err
  1795. }
  1796. ret := &ListOperationsResponse{
  1797. ServerResponse: googleapi.ServerResponse{
  1798. Header: res.Header,
  1799. HTTPStatusCode: res.StatusCode,
  1800. },
  1801. }
  1802. target := &ret
  1803. if err := gensupport.DecodeResponse(target, res); err != nil {
  1804. return nil, err
  1805. }
  1806. return ret, nil
  1807. // {
  1808. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  1809. // "flatPath": "v1/operations",
  1810. // "httpMethod": "GET",
  1811. // "id": "cloudfunctions.operations.list",
  1812. // "parameterOrder": [],
  1813. // "parameters": {
  1814. // "filter": {
  1815. // "description": "Required. A filter for matching the requested operations.\u003cbr\u003e\u003cbr\u003e The supported formats of \u003cb\u003efilter\u003c/b\u003e are:\u003cbr\u003e To query for specific function: \u003ccode\u003eproject:*,location:*,function:*\u003c/code\u003e\u003cbr\u003e To query for all of the latest operations for a project: \u003ccode\u003eproject:*,latest:true\u003c/code\u003e",
  1816. // "location": "query",
  1817. // "type": "string"
  1818. // },
  1819. // "name": {
  1820. // "description": "Must not be set.",
  1821. // "location": "query",
  1822. // "type": "string"
  1823. // },
  1824. // "pageSize": {
  1825. // "description": "The standard list page size.",
  1826. // "format": "int32",
  1827. // "location": "query",
  1828. // "type": "integer"
  1829. // },
  1830. // "pageToken": {
  1831. // "description": "The standard list page token.",
  1832. // "location": "query",
  1833. // "type": "string"
  1834. // }
  1835. // },
  1836. // "path": "v1/operations",
  1837. // "response": {
  1838. // "$ref": "ListOperationsResponse"
  1839. // },
  1840. // "scopes": [
  1841. // "https://www.googleapis.com/auth/cloud-platform"
  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 *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) 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 "cloudfunctions.projects.locations.list":
  1866. type ProjectsLocationsListCall struct {
  1867. s *Service
  1868. name string
  1869. urlParams_ gensupport.URLParams
  1870. ifNoneMatch_ string
  1871. ctx_ context.Context
  1872. header_ http.Header
  1873. }
  1874. // List: Lists information about the supported locations for this
  1875. // service.
  1876. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  1877. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1878. c.name = name
  1879. return c
  1880. }
  1881. // Filter sets the optional parameter "filter": The standard list
  1882. // filter.
  1883. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  1884. c.urlParams_.Set("filter", filter)
  1885. return c
  1886. }
  1887. // PageSize sets the optional parameter "pageSize": The standard list
  1888. // page size.
  1889. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  1890. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1891. return c
  1892. }
  1893. // PageToken sets the optional parameter "pageToken": The standard list
  1894. // page token.
  1895. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  1896. c.urlParams_.Set("pageToken", pageToken)
  1897. return c
  1898. }
  1899. // Fields allows partial responses to be retrieved. See
  1900. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1901. // for more information.
  1902. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  1903. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1904. return c
  1905. }
  1906. // IfNoneMatch sets the optional parameter which makes the operation
  1907. // fail if the object's ETag matches the given value. This is useful for
  1908. // getting updates only after the object has changed since the last
  1909. // request. Use googleapi.IsNotModified to check whether the response
  1910. // error from Do is the result of In-None-Match.
  1911. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  1912. c.ifNoneMatch_ = entityTag
  1913. return c
  1914. }
  1915. // Context sets the context to be used in this call's Do method. Any
  1916. // pending HTTP request will be aborted if the provided context is
  1917. // canceled.
  1918. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  1919. c.ctx_ = ctx
  1920. return c
  1921. }
  1922. // Header returns an http.Header that can be modified by the caller to
  1923. // add HTTP headers to the request.
  1924. func (c *ProjectsLocationsListCall) Header() http.Header {
  1925. if c.header_ == nil {
  1926. c.header_ = make(http.Header)
  1927. }
  1928. return c.header_
  1929. }
  1930. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  1931. reqHeaders := make(http.Header)
  1932. for k, v := range c.header_ {
  1933. reqHeaders[k] = v
  1934. }
  1935. reqHeaders.Set("User-Agent", c.s.userAgent())
  1936. if c.ifNoneMatch_ != "" {
  1937. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1938. }
  1939. var body io.Reader = nil
  1940. c.urlParams_.Set("alt", alt)
  1941. c.urlParams_.Set("prettyPrint", "false")
  1942. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations")
  1943. urls += "?" + c.urlParams_.Encode()
  1944. req, err := http.NewRequest("GET", urls, body)
  1945. if err != nil {
  1946. return nil, err
  1947. }
  1948. req.Header = reqHeaders
  1949. googleapi.Expand(req.URL, map[string]string{
  1950. "name": c.name,
  1951. })
  1952. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1953. }
  1954. // Do executes the "cloudfunctions.projects.locations.list" call.
  1955. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  1956. // non-2xx status code is an error. Response headers are in either
  1957. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  1958. // returned at all) in error.(*googleapi.Error).Header. Use
  1959. // googleapi.IsNotModified to check whether the returned error was
  1960. // because http.StatusNotModified was returned.
  1961. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  1962. gensupport.SetOptions(c.urlParams_, opts...)
  1963. res, err := c.doRequest("json")
  1964. if res != nil && res.StatusCode == http.StatusNotModified {
  1965. if res.Body != nil {
  1966. res.Body.Close()
  1967. }
  1968. return nil, &googleapi.Error{
  1969. Code: res.StatusCode,
  1970. Header: res.Header,
  1971. }
  1972. }
  1973. if err != nil {
  1974. return nil, err
  1975. }
  1976. defer googleapi.CloseBody(res)
  1977. if err := googleapi.CheckResponse(res); err != nil {
  1978. return nil, err
  1979. }
  1980. ret := &ListLocationsResponse{
  1981. ServerResponse: googleapi.ServerResponse{
  1982. Header: res.Header,
  1983. HTTPStatusCode: res.StatusCode,
  1984. },
  1985. }
  1986. target := &ret
  1987. if err := gensupport.DecodeResponse(target, res); err != nil {
  1988. return nil, err
  1989. }
  1990. return ret, nil
  1991. // {
  1992. // "description": "Lists information about the supported locations for this service.",
  1993. // "flatPath": "v1/projects/{projectsId}/locations",
  1994. // "httpMethod": "GET",
  1995. // "id": "cloudfunctions.projects.locations.list",
  1996. // "parameterOrder": [
  1997. // "name"
  1998. // ],
  1999. // "parameters": {
  2000. // "filter": {
  2001. // "description": "The standard list filter.",
  2002. // "location": "query",
  2003. // "type": "string"
  2004. // },
  2005. // "name": {
  2006. // "description": "The resource that owns the locations collection, if applicable.",
  2007. // "location": "path",
  2008. // "pattern": "^projects/[^/]+$",
  2009. // "required": true,
  2010. // "type": "string"
  2011. // },
  2012. // "pageSize": {
  2013. // "description": "The standard list page size.",
  2014. // "format": "int32",
  2015. // "location": "query",
  2016. // "type": "integer"
  2017. // },
  2018. // "pageToken": {
  2019. // "description": "The standard list page token.",
  2020. // "location": "query",
  2021. // "type": "string"
  2022. // }
  2023. // },
  2024. // "path": "v1/{+name}/locations",
  2025. // "response": {
  2026. // "$ref": "ListLocationsResponse"
  2027. // },
  2028. // "scopes": [
  2029. // "https://www.googleapis.com/auth/cloud-platform"
  2030. // ]
  2031. // }
  2032. }
  2033. // Pages invokes f for each page of results.
  2034. // A non-nil error returned from f will halt the iteration.
  2035. // The provided context supersedes any context provided to the Context method.
  2036. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  2037. c.ctx_ = ctx
  2038. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2039. for {
  2040. x, err := c.Do()
  2041. if err != nil {
  2042. return err
  2043. }
  2044. if err := f(x); err != nil {
  2045. return err
  2046. }
  2047. if x.NextPageToken == "" {
  2048. return nil
  2049. }
  2050. c.PageToken(x.NextPageToken)
  2051. }
  2052. }
  2053. // method id "cloudfunctions.projects.locations.functions.call":
  2054. type ProjectsLocationsFunctionsCallCall struct {
  2055. s *Service
  2056. name string
  2057. callfunctionrequest *CallFunctionRequest
  2058. urlParams_ gensupport.URLParams
  2059. ctx_ context.Context
  2060. header_ http.Header
  2061. }
  2062. // Call: Synchronously invokes a deployed Cloud Function. To be used for
  2063. // testing
  2064. // purposes as very limited traffic is allowed. For more information
  2065. // on
  2066. // the actual limits, refer to
  2067. // [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
  2068. func (r *ProjectsLocationsFunctionsService) Call(name string, callfunctionrequest *CallFunctionRequest) *ProjectsLocationsFunctionsCallCall {
  2069. c := &ProjectsLocationsFunctionsCallCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2070. c.name = name
  2071. c.callfunctionrequest = callfunctionrequest
  2072. return c
  2073. }
  2074. // Fields allows partial responses to be retrieved. See
  2075. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2076. // for more information.
  2077. func (c *ProjectsLocationsFunctionsCallCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCallCall {
  2078. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2079. return c
  2080. }
  2081. // Context sets the context to be used in this call's Do method. Any
  2082. // pending HTTP request will be aborted if the provided context is
  2083. // canceled.
  2084. func (c *ProjectsLocationsFunctionsCallCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCallCall {
  2085. c.ctx_ = ctx
  2086. return c
  2087. }
  2088. // Header returns an http.Header that can be modified by the caller to
  2089. // add HTTP headers to the request.
  2090. func (c *ProjectsLocationsFunctionsCallCall) Header() http.Header {
  2091. if c.header_ == nil {
  2092. c.header_ = make(http.Header)
  2093. }
  2094. return c.header_
  2095. }
  2096. func (c *ProjectsLocationsFunctionsCallCall) doRequest(alt string) (*http.Response, error) {
  2097. reqHeaders := make(http.Header)
  2098. for k, v := range c.header_ {
  2099. reqHeaders[k] = v
  2100. }
  2101. reqHeaders.Set("User-Agent", c.s.userAgent())
  2102. var body io.Reader = nil
  2103. body, err := googleapi.WithoutDataWrapper.JSONReader(c.callfunctionrequest)
  2104. if err != nil {
  2105. return nil, err
  2106. }
  2107. reqHeaders.Set("Content-Type", "application/json")
  2108. c.urlParams_.Set("alt", alt)
  2109. c.urlParams_.Set("prettyPrint", "false")
  2110. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:call")
  2111. urls += "?" + c.urlParams_.Encode()
  2112. req, err := http.NewRequest("POST", urls, body)
  2113. if err != nil {
  2114. return nil, err
  2115. }
  2116. req.Header = reqHeaders
  2117. googleapi.Expand(req.URL, map[string]string{
  2118. "name": c.name,
  2119. })
  2120. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2121. }
  2122. // Do executes the "cloudfunctions.projects.locations.functions.call" call.
  2123. // Exactly one of *CallFunctionResponse or error will be non-nil. Any
  2124. // non-2xx status code is an error. Response headers are in either
  2125. // *CallFunctionResponse.ServerResponse.Header or (if a response was
  2126. // returned at all) in error.(*googleapi.Error).Header. Use
  2127. // googleapi.IsNotModified to check whether the returned error was
  2128. // because http.StatusNotModified was returned.
  2129. func (c *ProjectsLocationsFunctionsCallCall) Do(opts ...googleapi.CallOption) (*CallFunctionResponse, error) {
  2130. gensupport.SetOptions(c.urlParams_, opts...)
  2131. res, err := c.doRequest("json")
  2132. if res != nil && res.StatusCode == http.StatusNotModified {
  2133. if res.Body != nil {
  2134. res.Body.Close()
  2135. }
  2136. return nil, &googleapi.Error{
  2137. Code: res.StatusCode,
  2138. Header: res.Header,
  2139. }
  2140. }
  2141. if err != nil {
  2142. return nil, err
  2143. }
  2144. defer googleapi.CloseBody(res)
  2145. if err := googleapi.CheckResponse(res); err != nil {
  2146. return nil, err
  2147. }
  2148. ret := &CallFunctionResponse{
  2149. ServerResponse: googleapi.ServerResponse{
  2150. Header: res.Header,
  2151. HTTPStatusCode: res.StatusCode,
  2152. },
  2153. }
  2154. target := &ret
  2155. if err := gensupport.DecodeResponse(target, res); err != nil {
  2156. return nil, err
  2157. }
  2158. return ret, nil
  2159. // {
  2160. // "description": "Synchronously invokes a deployed Cloud Function. To be used for testing\npurposes as very limited traffic is allowed. For more information on\nthe actual limits, refer to\n[Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).",
  2161. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:call",
  2162. // "httpMethod": "POST",
  2163. // "id": "cloudfunctions.projects.locations.functions.call",
  2164. // "parameterOrder": [
  2165. // "name"
  2166. // ],
  2167. // "parameters": {
  2168. // "name": {
  2169. // "description": "The name of the function to be called.",
  2170. // "location": "path",
  2171. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2172. // "required": true,
  2173. // "type": "string"
  2174. // }
  2175. // },
  2176. // "path": "v1/{+name}:call",
  2177. // "request": {
  2178. // "$ref": "CallFunctionRequest"
  2179. // },
  2180. // "response": {
  2181. // "$ref": "CallFunctionResponse"
  2182. // },
  2183. // "scopes": [
  2184. // "https://www.googleapis.com/auth/cloud-platform"
  2185. // ]
  2186. // }
  2187. }
  2188. // method id "cloudfunctions.projects.locations.functions.create":
  2189. type ProjectsLocationsFunctionsCreateCall struct {
  2190. s *Service
  2191. location string
  2192. cloudfunction *CloudFunction
  2193. urlParams_ gensupport.URLParams
  2194. ctx_ context.Context
  2195. header_ http.Header
  2196. }
  2197. // Create: Creates a new function. If a function with the given name
  2198. // already exists in
  2199. // the specified project, the long running operation will
  2200. // return
  2201. // `ALREADY_EXISTS` error.
  2202. func (r *ProjectsLocationsFunctionsService) Create(location string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsCreateCall {
  2203. c := &ProjectsLocationsFunctionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2204. c.location = location
  2205. c.cloudfunction = cloudfunction
  2206. return c
  2207. }
  2208. // Fields allows partial responses to be retrieved. See
  2209. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2210. // for more information.
  2211. func (c *ProjectsLocationsFunctionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCreateCall {
  2212. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2213. return c
  2214. }
  2215. // Context sets the context to be used in this call's Do method. Any
  2216. // pending HTTP request will be aborted if the provided context is
  2217. // canceled.
  2218. func (c *ProjectsLocationsFunctionsCreateCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCreateCall {
  2219. c.ctx_ = ctx
  2220. return c
  2221. }
  2222. // Header returns an http.Header that can be modified by the caller to
  2223. // add HTTP headers to the request.
  2224. func (c *ProjectsLocationsFunctionsCreateCall) Header() http.Header {
  2225. if c.header_ == nil {
  2226. c.header_ = make(http.Header)
  2227. }
  2228. return c.header_
  2229. }
  2230. func (c *ProjectsLocationsFunctionsCreateCall) doRequest(alt string) (*http.Response, error) {
  2231. reqHeaders := make(http.Header)
  2232. for k, v := range c.header_ {
  2233. reqHeaders[k] = v
  2234. }
  2235. reqHeaders.Set("User-Agent", c.s.userAgent())
  2236. var body io.Reader = nil
  2237. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction)
  2238. if err != nil {
  2239. return nil, err
  2240. }
  2241. reqHeaders.Set("Content-Type", "application/json")
  2242. c.urlParams_.Set("alt", alt)
  2243. c.urlParams_.Set("prettyPrint", "false")
  2244. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+location}/functions")
  2245. urls += "?" + c.urlParams_.Encode()
  2246. req, err := http.NewRequest("POST", urls, body)
  2247. if err != nil {
  2248. return nil, err
  2249. }
  2250. req.Header = reqHeaders
  2251. googleapi.Expand(req.URL, map[string]string{
  2252. "location": c.location,
  2253. })
  2254. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2255. }
  2256. // Do executes the "cloudfunctions.projects.locations.functions.create" call.
  2257. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2258. // status code is an error. Response headers are in either
  2259. // *Operation.ServerResponse.Header or (if a response was returned at
  2260. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2261. // to check whether the returned error was because
  2262. // http.StatusNotModified was returned.
  2263. func (c *ProjectsLocationsFunctionsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2264. gensupport.SetOptions(c.urlParams_, opts...)
  2265. res, err := c.doRequest("json")
  2266. if res != nil && res.StatusCode == http.StatusNotModified {
  2267. if res.Body != nil {
  2268. res.Body.Close()
  2269. }
  2270. return nil, &googleapi.Error{
  2271. Code: res.StatusCode,
  2272. Header: res.Header,
  2273. }
  2274. }
  2275. if err != nil {
  2276. return nil, err
  2277. }
  2278. defer googleapi.CloseBody(res)
  2279. if err := googleapi.CheckResponse(res); err != nil {
  2280. return nil, err
  2281. }
  2282. ret := &Operation{
  2283. ServerResponse: googleapi.ServerResponse{
  2284. Header: res.Header,
  2285. HTTPStatusCode: res.StatusCode,
  2286. },
  2287. }
  2288. target := &ret
  2289. if err := gensupport.DecodeResponse(target, res); err != nil {
  2290. return nil, err
  2291. }
  2292. return ret, nil
  2293. // {
  2294. // "description": "Creates a new function. If a function with the given name already exists in\nthe specified project, the long running operation will return\n`ALREADY_EXISTS` error.",
  2295. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions",
  2296. // "httpMethod": "POST",
  2297. // "id": "cloudfunctions.projects.locations.functions.create",
  2298. // "parameterOrder": [
  2299. // "location"
  2300. // ],
  2301. // "parameters": {
  2302. // "location": {
  2303. // "description": "The project and location in which the function should be created, specified\nin the format `projects/*/locations/*`",
  2304. // "location": "path",
  2305. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2306. // "required": true,
  2307. // "type": "string"
  2308. // }
  2309. // },
  2310. // "path": "v1/{+location}/functions",
  2311. // "request": {
  2312. // "$ref": "CloudFunction"
  2313. // },
  2314. // "response": {
  2315. // "$ref": "Operation"
  2316. // },
  2317. // "scopes": [
  2318. // "https://www.googleapis.com/auth/cloud-platform"
  2319. // ]
  2320. // }
  2321. }
  2322. // method id "cloudfunctions.projects.locations.functions.delete":
  2323. type ProjectsLocationsFunctionsDeleteCall struct {
  2324. s *Service
  2325. name string
  2326. urlParams_ gensupport.URLParams
  2327. ctx_ context.Context
  2328. header_ http.Header
  2329. }
  2330. // Delete: Deletes a function with the given name from the specified
  2331. // project. If the
  2332. // given function is used by some trigger, the trigger will be updated
  2333. // to
  2334. // remove this function.
  2335. func (r *ProjectsLocationsFunctionsService) Delete(name string) *ProjectsLocationsFunctionsDeleteCall {
  2336. c := &ProjectsLocationsFunctionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2337. c.name = name
  2338. return c
  2339. }
  2340. // Fields allows partial responses to be retrieved. See
  2341. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2342. // for more information.
  2343. func (c *ProjectsLocationsFunctionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsDeleteCall {
  2344. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2345. return c
  2346. }
  2347. // Context sets the context to be used in this call's Do method. Any
  2348. // pending HTTP request will be aborted if the provided context is
  2349. // canceled.
  2350. func (c *ProjectsLocationsFunctionsDeleteCall) Context(ctx context.Context) *ProjectsLocationsFunctionsDeleteCall {
  2351. c.ctx_ = ctx
  2352. return c
  2353. }
  2354. // Header returns an http.Header that can be modified by the caller to
  2355. // add HTTP headers to the request.
  2356. func (c *ProjectsLocationsFunctionsDeleteCall) Header() http.Header {
  2357. if c.header_ == nil {
  2358. c.header_ = make(http.Header)
  2359. }
  2360. return c.header_
  2361. }
  2362. func (c *ProjectsLocationsFunctionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2363. reqHeaders := make(http.Header)
  2364. for k, v := range c.header_ {
  2365. reqHeaders[k] = v
  2366. }
  2367. reqHeaders.Set("User-Agent", c.s.userAgent())
  2368. var body io.Reader = nil
  2369. c.urlParams_.Set("alt", alt)
  2370. c.urlParams_.Set("prettyPrint", "false")
  2371. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2372. urls += "?" + c.urlParams_.Encode()
  2373. req, err := http.NewRequest("DELETE", urls, body)
  2374. if err != nil {
  2375. return nil, err
  2376. }
  2377. req.Header = reqHeaders
  2378. googleapi.Expand(req.URL, map[string]string{
  2379. "name": c.name,
  2380. })
  2381. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2382. }
  2383. // Do executes the "cloudfunctions.projects.locations.functions.delete" call.
  2384. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2385. // status code is an error. Response headers are in either
  2386. // *Operation.ServerResponse.Header or (if a response was returned at
  2387. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2388. // to check whether the returned error was because
  2389. // http.StatusNotModified was returned.
  2390. func (c *ProjectsLocationsFunctionsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2391. gensupport.SetOptions(c.urlParams_, opts...)
  2392. res, err := c.doRequest("json")
  2393. if res != nil && res.StatusCode == http.StatusNotModified {
  2394. if res.Body != nil {
  2395. res.Body.Close()
  2396. }
  2397. return nil, &googleapi.Error{
  2398. Code: res.StatusCode,
  2399. Header: res.Header,
  2400. }
  2401. }
  2402. if err != nil {
  2403. return nil, err
  2404. }
  2405. defer googleapi.CloseBody(res)
  2406. if err := googleapi.CheckResponse(res); err != nil {
  2407. return nil, err
  2408. }
  2409. ret := &Operation{
  2410. ServerResponse: googleapi.ServerResponse{
  2411. Header: res.Header,
  2412. HTTPStatusCode: res.StatusCode,
  2413. },
  2414. }
  2415. target := &ret
  2416. if err := gensupport.DecodeResponse(target, res); err != nil {
  2417. return nil, err
  2418. }
  2419. return ret, nil
  2420. // {
  2421. // "description": "Deletes a function with the given name from the specified project. If the\ngiven function is used by some trigger, the trigger will be updated to\nremove this function.",
  2422. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  2423. // "httpMethod": "DELETE",
  2424. // "id": "cloudfunctions.projects.locations.functions.delete",
  2425. // "parameterOrder": [
  2426. // "name"
  2427. // ],
  2428. // "parameters": {
  2429. // "name": {
  2430. // "description": "The name of the function which should be deleted.",
  2431. // "location": "path",
  2432. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2433. // "required": true,
  2434. // "type": "string"
  2435. // }
  2436. // },
  2437. // "path": "v1/{+name}",
  2438. // "response": {
  2439. // "$ref": "Operation"
  2440. // },
  2441. // "scopes": [
  2442. // "https://www.googleapis.com/auth/cloud-platform"
  2443. // ]
  2444. // }
  2445. }
  2446. // method id "cloudfunctions.projects.locations.functions.generateDownloadUrl":
  2447. type ProjectsLocationsFunctionsGenerateDownloadUrlCall struct {
  2448. s *Service
  2449. name string
  2450. generatedownloadurlrequest *GenerateDownloadUrlRequest
  2451. urlParams_ gensupport.URLParams
  2452. ctx_ context.Context
  2453. header_ http.Header
  2454. }
  2455. // GenerateDownloadUrl: Returns a signed URL for downloading deployed
  2456. // function source code.
  2457. // The URL is only valid for a limited period and should be used
  2458. // within
  2459. // minutes after generation.
  2460. // For more information about the signed URL usage
  2461. // see:
  2462. // https://cloud.google.com/storage/docs/access-control/signed-urls
  2463. func (r *ProjectsLocationsFunctionsService) GenerateDownloadUrl(name string, generatedownloadurlrequest *GenerateDownloadUrlRequest) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2464. c := &ProjectsLocationsFunctionsGenerateDownloadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2465. c.name = name
  2466. c.generatedownloadurlrequest = generatedownloadurlrequest
  2467. return c
  2468. }
  2469. // Fields allows partial responses to be retrieved. See
  2470. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2471. // for more information.
  2472. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2473. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2474. return c
  2475. }
  2476. // Context sets the context to be used in this call's Do method. Any
  2477. // pending HTTP request will be aborted if the provided context is
  2478. // canceled.
  2479. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2480. c.ctx_ = ctx
  2481. return c
  2482. }
  2483. // Header returns an http.Header that can be modified by the caller to
  2484. // add HTTP headers to the request.
  2485. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Header() http.Header {
  2486. if c.header_ == nil {
  2487. c.header_ = make(http.Header)
  2488. }
  2489. return c.header_
  2490. }
  2491. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) doRequest(alt string) (*http.Response, error) {
  2492. reqHeaders := make(http.Header)
  2493. for k, v := range c.header_ {
  2494. reqHeaders[k] = v
  2495. }
  2496. reqHeaders.Set("User-Agent", c.s.userAgent())
  2497. var body io.Reader = nil
  2498. body, err := googleapi.WithoutDataWrapper.JSONReader(c.generatedownloadurlrequest)
  2499. if err != nil {
  2500. return nil, err
  2501. }
  2502. reqHeaders.Set("Content-Type", "application/json")
  2503. c.urlParams_.Set("alt", alt)
  2504. c.urlParams_.Set("prettyPrint", "false")
  2505. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:generateDownloadUrl")
  2506. urls += "?" + c.urlParams_.Encode()
  2507. req, err := http.NewRequest("POST", urls, body)
  2508. if err != nil {
  2509. return nil, err
  2510. }
  2511. req.Header = reqHeaders
  2512. googleapi.Expand(req.URL, map[string]string{
  2513. "name": c.name,
  2514. })
  2515. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2516. }
  2517. // Do executes the "cloudfunctions.projects.locations.functions.generateDownloadUrl" call.
  2518. // Exactly one of *GenerateDownloadUrlResponse or error will be non-nil.
  2519. // Any non-2xx status code is an error. Response headers are in either
  2520. // *GenerateDownloadUrlResponse.ServerResponse.Header or (if a response
  2521. // was returned at all) in error.(*googleapi.Error).Header. Use
  2522. // googleapi.IsNotModified to check whether the returned error was
  2523. // because http.StatusNotModified was returned.
  2524. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateDownloadUrlResponse, error) {
  2525. gensupport.SetOptions(c.urlParams_, opts...)
  2526. res, err := c.doRequest("json")
  2527. if res != nil && res.StatusCode == http.StatusNotModified {
  2528. if res.Body != nil {
  2529. res.Body.Close()
  2530. }
  2531. return nil, &googleapi.Error{
  2532. Code: res.StatusCode,
  2533. Header: res.Header,
  2534. }
  2535. }
  2536. if err != nil {
  2537. return nil, err
  2538. }
  2539. defer googleapi.CloseBody(res)
  2540. if err := googleapi.CheckResponse(res); err != nil {
  2541. return nil, err
  2542. }
  2543. ret := &GenerateDownloadUrlResponse{
  2544. ServerResponse: googleapi.ServerResponse{
  2545. Header: res.Header,
  2546. HTTPStatusCode: res.StatusCode,
  2547. },
  2548. }
  2549. target := &ret
  2550. if err := gensupport.DecodeResponse(target, res); err != nil {
  2551. return nil, err
  2552. }
  2553. return ret, nil
  2554. // {
  2555. // "description": "Returns a signed URL for downloading deployed function source code.\nThe URL is only valid for a limited period and should be used within\nminutes after generation.\nFor more information about the signed URL usage see:\nhttps://cloud.google.com/storage/docs/access-control/signed-urls",
  2556. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:generateDownloadUrl",
  2557. // "httpMethod": "POST",
  2558. // "id": "cloudfunctions.projects.locations.functions.generateDownloadUrl",
  2559. // "parameterOrder": [
  2560. // "name"
  2561. // ],
  2562. // "parameters": {
  2563. // "name": {
  2564. // "description": "The name of function for which source code Google Cloud Storage signed\nURL should be generated.",
  2565. // "location": "path",
  2566. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2567. // "required": true,
  2568. // "type": "string"
  2569. // }
  2570. // },
  2571. // "path": "v1/{+name}:generateDownloadUrl",
  2572. // "request": {
  2573. // "$ref": "GenerateDownloadUrlRequest"
  2574. // },
  2575. // "response": {
  2576. // "$ref": "GenerateDownloadUrlResponse"
  2577. // },
  2578. // "scopes": [
  2579. // "https://www.googleapis.com/auth/cloud-platform"
  2580. // ]
  2581. // }
  2582. }
  2583. // method id "cloudfunctions.projects.locations.functions.generateUploadUrl":
  2584. type ProjectsLocationsFunctionsGenerateUploadUrlCall struct {
  2585. s *Service
  2586. parent string
  2587. generateuploadurlrequest *GenerateUploadUrlRequest
  2588. urlParams_ gensupport.URLParams
  2589. ctx_ context.Context
  2590. header_ http.Header
  2591. }
  2592. // GenerateUploadUrl: Returns a signed URL for uploading a function
  2593. // source code.
  2594. // For more information about the signed URL usage
  2595. // see:
  2596. // https://cloud.google.com/storage/docs/access-control/signed-urls.
  2597. //
  2598. // Once the function source code upload is complete, the used signed
  2599. // URL should be provided in CreateFunction or UpdateFunction request
  2600. // as a reference to the function source code.
  2601. //
  2602. // When uploading source code to the generated signed URL, please
  2603. // follow
  2604. // these restrictions:
  2605. //
  2606. // * Source file type should be a zip file.
  2607. // * Source file size should not exceed 100MB limit.
  2608. // * No credentials should be attached - the signed URLs provide access
  2609. // to the
  2610. // target bucket using internal service identity; if credentials were
  2611. // attached, the identity from the credentials would be used, but
  2612. // that
  2613. // identity does not have permissions to upload files to the
  2614. // URL.
  2615. //
  2616. // When making a HTTP PUT request, these two headers need to be
  2617. // specified:
  2618. //
  2619. // * `content-type: application/zip`
  2620. // * `x-goog-content-length-range: 0,104857600`
  2621. //
  2622. // And this header SHOULD NOT be specified:
  2623. //
  2624. // * `Authorization: Bearer YOUR_TOKEN`
  2625. func (r *ProjectsLocationsFunctionsService) GenerateUploadUrl(parent string, generateuploadurlrequest *GenerateUploadUrlRequest) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2626. c := &ProjectsLocationsFunctionsGenerateUploadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2627. c.parent = parent
  2628. c.generateuploadurlrequest = generateuploadurlrequest
  2629. return c
  2630. }
  2631. // Fields allows partial responses to be retrieved. See
  2632. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2633. // for more information.
  2634. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2635. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2636. return c
  2637. }
  2638. // Context sets the context to be used in this call's Do method. Any
  2639. // pending HTTP request will be aborted if the provided context is
  2640. // canceled.
  2641. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2642. c.ctx_ = ctx
  2643. return c
  2644. }
  2645. // Header returns an http.Header that can be modified by the caller to
  2646. // add HTTP headers to the request.
  2647. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Header() http.Header {
  2648. if c.header_ == nil {
  2649. c.header_ = make(http.Header)
  2650. }
  2651. return c.header_
  2652. }
  2653. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) doRequest(alt string) (*http.Response, error) {
  2654. reqHeaders := make(http.Header)
  2655. for k, v := range c.header_ {
  2656. reqHeaders[k] = v
  2657. }
  2658. reqHeaders.Set("User-Agent", c.s.userAgent())
  2659. var body io.Reader = nil
  2660. body, err := googleapi.WithoutDataWrapper.JSONReader(c.generateuploadurlrequest)
  2661. if err != nil {
  2662. return nil, err
  2663. }
  2664. reqHeaders.Set("Content-Type", "application/json")
  2665. c.urlParams_.Set("alt", alt)
  2666. c.urlParams_.Set("prettyPrint", "false")
  2667. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/functions:generateUploadUrl")
  2668. urls += "?" + c.urlParams_.Encode()
  2669. req, err := http.NewRequest("POST", urls, body)
  2670. if err != nil {
  2671. return nil, err
  2672. }
  2673. req.Header = reqHeaders
  2674. googleapi.Expand(req.URL, map[string]string{
  2675. "parent": c.parent,
  2676. })
  2677. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2678. }
  2679. // Do executes the "cloudfunctions.projects.locations.functions.generateUploadUrl" call.
  2680. // Exactly one of *GenerateUploadUrlResponse or error will be non-nil.
  2681. // Any non-2xx status code is an error. Response headers are in either
  2682. // *GenerateUploadUrlResponse.ServerResponse.Header or (if a response
  2683. // was returned at all) in error.(*googleapi.Error).Header. Use
  2684. // googleapi.IsNotModified to check whether the returned error was
  2685. // because http.StatusNotModified was returned.
  2686. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateUploadUrlResponse, error) {
  2687. gensupport.SetOptions(c.urlParams_, opts...)
  2688. res, err := c.doRequest("json")
  2689. if res != nil && res.StatusCode == http.StatusNotModified {
  2690. if res.Body != nil {
  2691. res.Body.Close()
  2692. }
  2693. return nil, &googleapi.Error{
  2694. Code: res.StatusCode,
  2695. Header: res.Header,
  2696. }
  2697. }
  2698. if err != nil {
  2699. return nil, err
  2700. }
  2701. defer googleapi.CloseBody(res)
  2702. if err := googleapi.CheckResponse(res); err != nil {
  2703. return nil, err
  2704. }
  2705. ret := &GenerateUploadUrlResponse{
  2706. ServerResponse: googleapi.ServerResponse{
  2707. Header: res.Header,
  2708. HTTPStatusCode: res.StatusCode,
  2709. },
  2710. }
  2711. target := &ret
  2712. if err := gensupport.DecodeResponse(target, res); err != nil {
  2713. return nil, err
  2714. }
  2715. return ret, nil
  2716. // {
  2717. // "description": "Returns a signed URL for uploading a function source code.\nFor more information about the signed URL usage see:\nhttps://cloud.google.com/storage/docs/access-control/signed-urls.\nOnce the function source code upload is complete, the used signed\nURL should be provided in CreateFunction or UpdateFunction request\nas a reference to the function source code.\n\nWhen uploading source code to the generated signed URL, please follow\nthese restrictions:\n\n* Source file type should be a zip file.\n* Source file size should not exceed 100MB limit.\n* No credentials should be attached - the signed URLs provide access to the\n target bucket using internal service identity; if credentials were\n attached, the identity from the credentials would be used, but that\n identity does not have permissions to upload files to the URL.\n\nWhen making a HTTP PUT request, these two headers need to be specified:\n\n* `content-type: application/zip`\n* `x-goog-content-length-range: 0,104857600`\n\nAnd this header SHOULD NOT be specified:\n\n* `Authorization: Bearer YOUR_TOKEN`",
  2718. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions:generateUploadUrl",
  2719. // "httpMethod": "POST",
  2720. // "id": "cloudfunctions.projects.locations.functions.generateUploadUrl",
  2721. // "parameterOrder": [
  2722. // "parent"
  2723. // ],
  2724. // "parameters": {
  2725. // "parent": {
  2726. // "description": "The project and location in which the Google Cloud Storage signed URL\nshould be generated, specified in the format `projects/*/locations/*`.",
  2727. // "location": "path",
  2728. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2729. // "required": true,
  2730. // "type": "string"
  2731. // }
  2732. // },
  2733. // "path": "v1/{+parent}/functions:generateUploadUrl",
  2734. // "request": {
  2735. // "$ref": "GenerateUploadUrlRequest"
  2736. // },
  2737. // "response": {
  2738. // "$ref": "GenerateUploadUrlResponse"
  2739. // },
  2740. // "scopes": [
  2741. // "https://www.googleapis.com/auth/cloud-platform"
  2742. // ]
  2743. // }
  2744. }
  2745. // method id "cloudfunctions.projects.locations.functions.get":
  2746. type ProjectsLocationsFunctionsGetCall struct {
  2747. s *Service
  2748. name string
  2749. urlParams_ gensupport.URLParams
  2750. ifNoneMatch_ string
  2751. ctx_ context.Context
  2752. header_ http.Header
  2753. }
  2754. // Get: Returns a function with the given name from the requested
  2755. // project.
  2756. func (r *ProjectsLocationsFunctionsService) Get(name string) *ProjectsLocationsFunctionsGetCall {
  2757. c := &ProjectsLocationsFunctionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2758. c.name = name
  2759. return c
  2760. }
  2761. // Fields allows partial responses to be retrieved. See
  2762. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2763. // for more information.
  2764. func (c *ProjectsLocationsFunctionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGetCall {
  2765. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2766. return c
  2767. }
  2768. // IfNoneMatch sets the optional parameter which makes the operation
  2769. // fail if the object's ETag matches the given value. This is useful for
  2770. // getting updates only after the object has changed since the last
  2771. // request. Use googleapi.IsNotModified to check whether the response
  2772. // error from Do is the result of In-None-Match.
  2773. func (c *ProjectsLocationsFunctionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetCall {
  2774. c.ifNoneMatch_ = entityTag
  2775. return c
  2776. }
  2777. // Context sets the context to be used in this call's Do method. Any
  2778. // pending HTTP request will be aborted if the provided context is
  2779. // canceled.
  2780. func (c *ProjectsLocationsFunctionsGetCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGetCall {
  2781. c.ctx_ = ctx
  2782. return c
  2783. }
  2784. // Header returns an http.Header that can be modified by the caller to
  2785. // add HTTP headers to the request.
  2786. func (c *ProjectsLocationsFunctionsGetCall) Header() http.Header {
  2787. if c.header_ == nil {
  2788. c.header_ = make(http.Header)
  2789. }
  2790. return c.header_
  2791. }
  2792. func (c *ProjectsLocationsFunctionsGetCall) doRequest(alt string) (*http.Response, error) {
  2793. reqHeaders := make(http.Header)
  2794. for k, v := range c.header_ {
  2795. reqHeaders[k] = v
  2796. }
  2797. reqHeaders.Set("User-Agent", c.s.userAgent())
  2798. if c.ifNoneMatch_ != "" {
  2799. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2800. }
  2801. var body io.Reader = nil
  2802. c.urlParams_.Set("alt", alt)
  2803. c.urlParams_.Set("prettyPrint", "false")
  2804. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2805. urls += "?" + c.urlParams_.Encode()
  2806. req, err := http.NewRequest("GET", urls, body)
  2807. if err != nil {
  2808. return nil, err
  2809. }
  2810. req.Header = reqHeaders
  2811. googleapi.Expand(req.URL, map[string]string{
  2812. "name": c.name,
  2813. })
  2814. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2815. }
  2816. // Do executes the "cloudfunctions.projects.locations.functions.get" call.
  2817. // Exactly one of *CloudFunction or error will be non-nil. Any non-2xx
  2818. // status code is an error. Response headers are in either
  2819. // *CloudFunction.ServerResponse.Header or (if a response was returned
  2820. // at all) in error.(*googleapi.Error).Header. Use
  2821. // googleapi.IsNotModified to check whether the returned error was
  2822. // because http.StatusNotModified was returned.
  2823. func (c *ProjectsLocationsFunctionsGetCall) Do(opts ...googleapi.CallOption) (*CloudFunction, error) {
  2824. gensupport.SetOptions(c.urlParams_, opts...)
  2825. res, err := c.doRequest("json")
  2826. if res != nil && res.StatusCode == http.StatusNotModified {
  2827. if res.Body != nil {
  2828. res.Body.Close()
  2829. }
  2830. return nil, &googleapi.Error{
  2831. Code: res.StatusCode,
  2832. Header: res.Header,
  2833. }
  2834. }
  2835. if err != nil {
  2836. return nil, err
  2837. }
  2838. defer googleapi.CloseBody(res)
  2839. if err := googleapi.CheckResponse(res); err != nil {
  2840. return nil, err
  2841. }
  2842. ret := &CloudFunction{
  2843. ServerResponse: googleapi.ServerResponse{
  2844. Header: res.Header,
  2845. HTTPStatusCode: res.StatusCode,
  2846. },
  2847. }
  2848. target := &ret
  2849. if err := gensupport.DecodeResponse(target, res); err != nil {
  2850. return nil, err
  2851. }
  2852. return ret, nil
  2853. // {
  2854. // "description": "Returns a function with the given name from the requested project.",
  2855. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  2856. // "httpMethod": "GET",
  2857. // "id": "cloudfunctions.projects.locations.functions.get",
  2858. // "parameterOrder": [
  2859. // "name"
  2860. // ],
  2861. // "parameters": {
  2862. // "name": {
  2863. // "description": "The name of the function which details should be obtained.",
  2864. // "location": "path",
  2865. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2866. // "required": true,
  2867. // "type": "string"
  2868. // }
  2869. // },
  2870. // "path": "v1/{+name}",
  2871. // "response": {
  2872. // "$ref": "CloudFunction"
  2873. // },
  2874. // "scopes": [
  2875. // "https://www.googleapis.com/auth/cloud-platform"
  2876. // ]
  2877. // }
  2878. }
  2879. // method id "cloudfunctions.projects.locations.functions.getIamPolicy":
  2880. type ProjectsLocationsFunctionsGetIamPolicyCall struct {
  2881. s *Service
  2882. resource string
  2883. urlParams_ gensupport.URLParams
  2884. ifNoneMatch_ string
  2885. ctx_ context.Context
  2886. header_ http.Header
  2887. }
  2888. // GetIamPolicy: Gets the IAM access control policy for a
  2889. // function.
  2890. // Returns an empty policy if the function exists and does not have a
  2891. // policy
  2892. // set.
  2893. func (r *ProjectsLocationsFunctionsService) GetIamPolicy(resource string) *ProjectsLocationsFunctionsGetIamPolicyCall {
  2894. c := &ProjectsLocationsFunctionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2895. c.resource = resource
  2896. return c
  2897. }
  2898. // Fields allows partial responses to be retrieved. See
  2899. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2900. // for more information.
  2901. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGetIamPolicyCall {
  2902. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2903. return c
  2904. }
  2905. // IfNoneMatch sets the optional parameter which makes the operation
  2906. // fail if the object's ETag matches the given value. This is useful for
  2907. // getting updates only after the object has changed since the last
  2908. // request. Use googleapi.IsNotModified to check whether the response
  2909. // error from Do is the result of In-None-Match.
  2910. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetIamPolicyCall {
  2911. c.ifNoneMatch_ = entityTag
  2912. return c
  2913. }
  2914. // Context sets the context to be used in this call's Do method. Any
  2915. // pending HTTP request will be aborted if the provided context is
  2916. // canceled.
  2917. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGetIamPolicyCall {
  2918. c.ctx_ = ctx
  2919. return c
  2920. }
  2921. // Header returns an http.Header that can be modified by the caller to
  2922. // add HTTP headers to the request.
  2923. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) Header() http.Header {
  2924. if c.header_ == nil {
  2925. c.header_ = make(http.Header)
  2926. }
  2927. return c.header_
  2928. }
  2929. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2930. reqHeaders := make(http.Header)
  2931. for k, v := range c.header_ {
  2932. reqHeaders[k] = v
  2933. }
  2934. reqHeaders.Set("User-Agent", c.s.userAgent())
  2935. if c.ifNoneMatch_ != "" {
  2936. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2937. }
  2938. var body io.Reader = nil
  2939. c.urlParams_.Set("alt", alt)
  2940. c.urlParams_.Set("prettyPrint", "false")
  2941. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  2942. urls += "?" + c.urlParams_.Encode()
  2943. req, err := http.NewRequest("GET", urls, body)
  2944. if err != nil {
  2945. return nil, err
  2946. }
  2947. req.Header = reqHeaders
  2948. googleapi.Expand(req.URL, map[string]string{
  2949. "resource": c.resource,
  2950. })
  2951. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2952. }
  2953. // Do executes the "cloudfunctions.projects.locations.functions.getIamPolicy" call.
  2954. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2955. // code is an error. Response headers are in either
  2956. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2957. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2958. // check whether the returned error was because http.StatusNotModified
  2959. // was returned.
  2960. func (c *ProjectsLocationsFunctionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2961. gensupport.SetOptions(c.urlParams_, opts...)
  2962. res, err := c.doRequest("json")
  2963. if res != nil && res.StatusCode == http.StatusNotModified {
  2964. if res.Body != nil {
  2965. res.Body.Close()
  2966. }
  2967. return nil, &googleapi.Error{
  2968. Code: res.StatusCode,
  2969. Header: res.Header,
  2970. }
  2971. }
  2972. if err != nil {
  2973. return nil, err
  2974. }
  2975. defer googleapi.CloseBody(res)
  2976. if err := googleapi.CheckResponse(res); err != nil {
  2977. return nil, err
  2978. }
  2979. ret := &Policy{
  2980. ServerResponse: googleapi.ServerResponse{
  2981. Header: res.Header,
  2982. HTTPStatusCode: res.StatusCode,
  2983. },
  2984. }
  2985. target := &ret
  2986. if err := gensupport.DecodeResponse(target, res); err != nil {
  2987. return nil, err
  2988. }
  2989. return ret, nil
  2990. // {
  2991. // "description": "Gets the IAM access control policy for a function.\nReturns an empty policy if the function exists and does not have a policy\nset.",
  2992. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:getIamPolicy",
  2993. // "httpMethod": "GET",
  2994. // "id": "cloudfunctions.projects.locations.functions.getIamPolicy",
  2995. // "parameterOrder": [
  2996. // "resource"
  2997. // ],
  2998. // "parameters": {
  2999. // "resource": {
  3000. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3001. // "location": "path",
  3002. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  3003. // "required": true,
  3004. // "type": "string"
  3005. // }
  3006. // },
  3007. // "path": "v1/{+resource}:getIamPolicy",
  3008. // "response": {
  3009. // "$ref": "Policy"
  3010. // },
  3011. // "scopes": [
  3012. // "https://www.googleapis.com/auth/cloud-platform"
  3013. // ]
  3014. // }
  3015. }
  3016. // method id "cloudfunctions.projects.locations.functions.list":
  3017. type ProjectsLocationsFunctionsListCall struct {
  3018. s *Service
  3019. parent string
  3020. urlParams_ gensupport.URLParams
  3021. ifNoneMatch_ string
  3022. ctx_ context.Context
  3023. header_ http.Header
  3024. }
  3025. // List: Returns a list of functions that belong to the requested
  3026. // project.
  3027. func (r *ProjectsLocationsFunctionsService) List(parent string) *ProjectsLocationsFunctionsListCall {
  3028. c := &ProjectsLocationsFunctionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3029. c.parent = parent
  3030. return c
  3031. }
  3032. // PageSize sets the optional parameter "pageSize": Maximum number of
  3033. // functions to return per call.
  3034. func (c *ProjectsLocationsFunctionsListCall) PageSize(pageSize int64) *ProjectsLocationsFunctionsListCall {
  3035. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3036. return c
  3037. }
  3038. // PageToken sets the optional parameter "pageToken": The value returned
  3039. // by the last
  3040. // `ListFunctionsResponse`; indicates that
  3041. // this is a continuation of a prior `ListFunctions` call, and that
  3042. // the
  3043. // system should return the next page of data.
  3044. func (c *ProjectsLocationsFunctionsListCall) PageToken(pageToken string) *ProjectsLocationsFunctionsListCall {
  3045. c.urlParams_.Set("pageToken", pageToken)
  3046. return c
  3047. }
  3048. // Fields allows partial responses to be retrieved. See
  3049. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3050. // for more information.
  3051. func (c *ProjectsLocationsFunctionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsListCall {
  3052. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3053. return c
  3054. }
  3055. // IfNoneMatch sets the optional parameter which makes the operation
  3056. // fail if the object's ETag matches the given value. This is useful for
  3057. // getting updates only after the object has changed since the last
  3058. // request. Use googleapi.IsNotModified to check whether the response
  3059. // error from Do is the result of In-None-Match.
  3060. func (c *ProjectsLocationsFunctionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsListCall {
  3061. c.ifNoneMatch_ = entityTag
  3062. return c
  3063. }
  3064. // Context sets the context to be used in this call's Do method. Any
  3065. // pending HTTP request will be aborted if the provided context is
  3066. // canceled.
  3067. func (c *ProjectsLocationsFunctionsListCall) Context(ctx context.Context) *ProjectsLocationsFunctionsListCall {
  3068. c.ctx_ = ctx
  3069. return c
  3070. }
  3071. // Header returns an http.Header that can be modified by the caller to
  3072. // add HTTP headers to the request.
  3073. func (c *ProjectsLocationsFunctionsListCall) Header() http.Header {
  3074. if c.header_ == nil {
  3075. c.header_ = make(http.Header)
  3076. }
  3077. return c.header_
  3078. }
  3079. func (c *ProjectsLocationsFunctionsListCall) doRequest(alt string) (*http.Response, error) {
  3080. reqHeaders := make(http.Header)
  3081. for k, v := range c.header_ {
  3082. reqHeaders[k] = v
  3083. }
  3084. reqHeaders.Set("User-Agent", c.s.userAgent())
  3085. if c.ifNoneMatch_ != "" {
  3086. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3087. }
  3088. var body io.Reader = nil
  3089. c.urlParams_.Set("alt", alt)
  3090. c.urlParams_.Set("prettyPrint", "false")
  3091. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/functions")
  3092. urls += "?" + c.urlParams_.Encode()
  3093. req, err := http.NewRequest("GET", urls, body)
  3094. if err != nil {
  3095. return nil, err
  3096. }
  3097. req.Header = reqHeaders
  3098. googleapi.Expand(req.URL, map[string]string{
  3099. "parent": c.parent,
  3100. })
  3101. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3102. }
  3103. // Do executes the "cloudfunctions.projects.locations.functions.list" call.
  3104. // Exactly one of *ListFunctionsResponse or error will be non-nil. Any
  3105. // non-2xx status code is an error. Response headers are in either
  3106. // *ListFunctionsResponse.ServerResponse.Header or (if a response was
  3107. // returned at all) in error.(*googleapi.Error).Header. Use
  3108. // googleapi.IsNotModified to check whether the returned error was
  3109. // because http.StatusNotModified was returned.
  3110. func (c *ProjectsLocationsFunctionsListCall) Do(opts ...googleapi.CallOption) (*ListFunctionsResponse, error) {
  3111. gensupport.SetOptions(c.urlParams_, opts...)
  3112. res, err := c.doRequest("json")
  3113. if res != nil && res.StatusCode == http.StatusNotModified {
  3114. if res.Body != nil {
  3115. res.Body.Close()
  3116. }
  3117. return nil, &googleapi.Error{
  3118. Code: res.StatusCode,
  3119. Header: res.Header,
  3120. }
  3121. }
  3122. if err != nil {
  3123. return nil, err
  3124. }
  3125. defer googleapi.CloseBody(res)
  3126. if err := googleapi.CheckResponse(res); err != nil {
  3127. return nil, err
  3128. }
  3129. ret := &ListFunctionsResponse{
  3130. ServerResponse: googleapi.ServerResponse{
  3131. Header: res.Header,
  3132. HTTPStatusCode: res.StatusCode,
  3133. },
  3134. }
  3135. target := &ret
  3136. if err := gensupport.DecodeResponse(target, res); err != nil {
  3137. return nil, err
  3138. }
  3139. return ret, nil
  3140. // {
  3141. // "description": "Returns a list of functions that belong to the requested project.",
  3142. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions",
  3143. // "httpMethod": "GET",
  3144. // "id": "cloudfunctions.projects.locations.functions.list",
  3145. // "parameterOrder": [
  3146. // "parent"
  3147. // ],
  3148. // "parameters": {
  3149. // "pageSize": {
  3150. // "description": "Maximum number of functions to return per call.",
  3151. // "format": "int32",
  3152. // "location": "query",
  3153. // "type": "integer"
  3154. // },
  3155. // "pageToken": {
  3156. // "description": "The value returned by the last\n`ListFunctionsResponse`; indicates that\nthis is a continuation of a prior `ListFunctions` call, and that the\nsystem should return the next page of data.",
  3157. // "location": "query",
  3158. // "type": "string"
  3159. // },
  3160. // "parent": {
  3161. // "description": "The project and location from which the function should be listed,\nspecified in the format `projects/*/locations/*`\nIf you want to list functions in all locations, use \"-\" in place of a\nlocation.",
  3162. // "location": "path",
  3163. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  3164. // "required": true,
  3165. // "type": "string"
  3166. // }
  3167. // },
  3168. // "path": "v1/{+parent}/functions",
  3169. // "response": {
  3170. // "$ref": "ListFunctionsResponse"
  3171. // },
  3172. // "scopes": [
  3173. // "https://www.googleapis.com/auth/cloud-platform"
  3174. // ]
  3175. // }
  3176. }
  3177. // Pages invokes f for each page of results.
  3178. // A non-nil error returned from f will halt the iteration.
  3179. // The provided context supersedes any context provided to the Context method.
  3180. func (c *ProjectsLocationsFunctionsListCall) Pages(ctx context.Context, f func(*ListFunctionsResponse) error) error {
  3181. c.ctx_ = ctx
  3182. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3183. for {
  3184. x, err := c.Do()
  3185. if err != nil {
  3186. return err
  3187. }
  3188. if err := f(x); err != nil {
  3189. return err
  3190. }
  3191. if x.NextPageToken == "" {
  3192. return nil
  3193. }
  3194. c.PageToken(x.NextPageToken)
  3195. }
  3196. }
  3197. // method id "cloudfunctions.projects.locations.functions.patch":
  3198. type ProjectsLocationsFunctionsPatchCall struct {
  3199. s *Service
  3200. name string
  3201. cloudfunction *CloudFunction
  3202. urlParams_ gensupport.URLParams
  3203. ctx_ context.Context
  3204. header_ http.Header
  3205. }
  3206. // Patch: Updates existing function.
  3207. func (r *ProjectsLocationsFunctionsService) Patch(name string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsPatchCall {
  3208. c := &ProjectsLocationsFunctionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3209. c.name = name
  3210. c.cloudfunction = cloudfunction
  3211. return c
  3212. }
  3213. // UpdateMask sets the optional parameter "updateMask": Required list of
  3214. // fields to be updated in this request.
  3215. func (c *ProjectsLocationsFunctionsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsFunctionsPatchCall {
  3216. c.urlParams_.Set("updateMask", updateMask)
  3217. return c
  3218. }
  3219. // Fields allows partial responses to be retrieved. See
  3220. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3221. // for more information.
  3222. func (c *ProjectsLocationsFunctionsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsPatchCall {
  3223. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3224. return c
  3225. }
  3226. // Context sets the context to be used in this call's Do method. Any
  3227. // pending HTTP request will be aborted if the provided context is
  3228. // canceled.
  3229. func (c *ProjectsLocationsFunctionsPatchCall) Context(ctx context.Context) *ProjectsLocationsFunctionsPatchCall {
  3230. c.ctx_ = ctx
  3231. return c
  3232. }
  3233. // Header returns an http.Header that can be modified by the caller to
  3234. // add HTTP headers to the request.
  3235. func (c *ProjectsLocationsFunctionsPatchCall) Header() http.Header {
  3236. if c.header_ == nil {
  3237. c.header_ = make(http.Header)
  3238. }
  3239. return c.header_
  3240. }
  3241. func (c *ProjectsLocationsFunctionsPatchCall) doRequest(alt string) (*http.Response, error) {
  3242. reqHeaders := make(http.Header)
  3243. for k, v := range c.header_ {
  3244. reqHeaders[k] = v
  3245. }
  3246. reqHeaders.Set("User-Agent", c.s.userAgent())
  3247. var body io.Reader = nil
  3248. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction)
  3249. if err != nil {
  3250. return nil, err
  3251. }
  3252. reqHeaders.Set("Content-Type", "application/json")
  3253. c.urlParams_.Set("alt", alt)
  3254. c.urlParams_.Set("prettyPrint", "false")
  3255. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3256. urls += "?" + c.urlParams_.Encode()
  3257. req, err := http.NewRequest("PATCH", urls, body)
  3258. if err != nil {
  3259. return nil, err
  3260. }
  3261. req.Header = reqHeaders
  3262. googleapi.Expand(req.URL, map[string]string{
  3263. "name": c.name,
  3264. })
  3265. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3266. }
  3267. // Do executes the "cloudfunctions.projects.locations.functions.patch" call.
  3268. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3269. // status code is an error. Response headers are in either
  3270. // *Operation.ServerResponse.Header or (if a response was returned at
  3271. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3272. // to check whether the returned error was because
  3273. // http.StatusNotModified was returned.
  3274. func (c *ProjectsLocationsFunctionsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3275. gensupport.SetOptions(c.urlParams_, opts...)
  3276. res, err := c.doRequest("json")
  3277. if res != nil && res.StatusCode == http.StatusNotModified {
  3278. if res.Body != nil {
  3279. res.Body.Close()
  3280. }
  3281. return nil, &googleapi.Error{
  3282. Code: res.StatusCode,
  3283. Header: res.Header,
  3284. }
  3285. }
  3286. if err != nil {
  3287. return nil, err
  3288. }
  3289. defer googleapi.CloseBody(res)
  3290. if err := googleapi.CheckResponse(res); err != nil {
  3291. return nil, err
  3292. }
  3293. ret := &Operation{
  3294. ServerResponse: googleapi.ServerResponse{
  3295. Header: res.Header,
  3296. HTTPStatusCode: res.StatusCode,
  3297. },
  3298. }
  3299. target := &ret
  3300. if err := gensupport.DecodeResponse(target, res); err != nil {
  3301. return nil, err
  3302. }
  3303. return ret, nil
  3304. // {
  3305. // "description": "Updates existing function.",
  3306. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  3307. // "httpMethod": "PATCH",
  3308. // "id": "cloudfunctions.projects.locations.functions.patch",
  3309. // "parameterOrder": [
  3310. // "name"
  3311. // ],
  3312. // "parameters": {
  3313. // "name": {
  3314. // "description": "A user-defined name of the function. Function names must be unique\nglobally and match pattern `projects/*/locations/*/functions/*`",
  3315. // "location": "path",
  3316. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  3317. // "required": true,
  3318. // "type": "string"
  3319. // },
  3320. // "updateMask": {
  3321. // "description": "Required list of fields to be updated in this request.",
  3322. // "format": "google-fieldmask",
  3323. // "location": "query",
  3324. // "type": "string"
  3325. // }
  3326. // },
  3327. // "path": "v1/{+name}",
  3328. // "request": {
  3329. // "$ref": "CloudFunction"
  3330. // },
  3331. // "response": {
  3332. // "$ref": "Operation"
  3333. // },
  3334. // "scopes": [
  3335. // "https://www.googleapis.com/auth/cloud-platform"
  3336. // ]
  3337. // }
  3338. }
  3339. // method id "cloudfunctions.projects.locations.functions.setIamPolicy":
  3340. type ProjectsLocationsFunctionsSetIamPolicyCall struct {
  3341. s *Service
  3342. resource string
  3343. setiampolicyrequest *SetIamPolicyRequest
  3344. urlParams_ gensupport.URLParams
  3345. ctx_ context.Context
  3346. header_ http.Header
  3347. }
  3348. // SetIamPolicy: Sets the IAM access control policy on the specified
  3349. // function.
  3350. // Replaces any existing policy.
  3351. func (r *ProjectsLocationsFunctionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsFunctionsSetIamPolicyCall {
  3352. c := &ProjectsLocationsFunctionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3353. c.resource = resource
  3354. c.setiampolicyrequest = setiampolicyrequest
  3355. return c
  3356. }
  3357. // Fields allows partial responses to be retrieved. See
  3358. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3359. // for more information.
  3360. func (c *ProjectsLocationsFunctionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsSetIamPolicyCall {
  3361. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3362. return c
  3363. }
  3364. // Context sets the context to be used in this call's Do method. Any
  3365. // pending HTTP request will be aborted if the provided context is
  3366. // canceled.
  3367. func (c *ProjectsLocationsFunctionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsFunctionsSetIamPolicyCall {
  3368. c.ctx_ = ctx
  3369. return c
  3370. }
  3371. // Header returns an http.Header that can be modified by the caller to
  3372. // add HTTP headers to the request.
  3373. func (c *ProjectsLocationsFunctionsSetIamPolicyCall) Header() http.Header {
  3374. if c.header_ == nil {
  3375. c.header_ = make(http.Header)
  3376. }
  3377. return c.header_
  3378. }
  3379. func (c *ProjectsLocationsFunctionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3380. reqHeaders := make(http.Header)
  3381. for k, v := range c.header_ {
  3382. reqHeaders[k] = v
  3383. }
  3384. reqHeaders.Set("User-Agent", c.s.userAgent())
  3385. var body io.Reader = nil
  3386. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  3387. if err != nil {
  3388. return nil, err
  3389. }
  3390. reqHeaders.Set("Content-Type", "application/json")
  3391. c.urlParams_.Set("alt", alt)
  3392. c.urlParams_.Set("prettyPrint", "false")
  3393. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  3394. urls += "?" + c.urlParams_.Encode()
  3395. req, err := http.NewRequest("POST", urls, body)
  3396. if err != nil {
  3397. return nil, err
  3398. }
  3399. req.Header = reqHeaders
  3400. googleapi.Expand(req.URL, map[string]string{
  3401. "resource": c.resource,
  3402. })
  3403. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3404. }
  3405. // Do executes the "cloudfunctions.projects.locations.functions.setIamPolicy" call.
  3406. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3407. // code is an error. Response headers are in either
  3408. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3409. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3410. // check whether the returned error was because http.StatusNotModified
  3411. // was returned.
  3412. func (c *ProjectsLocationsFunctionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3413. gensupport.SetOptions(c.urlParams_, opts...)
  3414. res, err := c.doRequest("json")
  3415. if res != nil && res.StatusCode == http.StatusNotModified {
  3416. if res.Body != nil {
  3417. res.Body.Close()
  3418. }
  3419. return nil, &googleapi.Error{
  3420. Code: res.StatusCode,
  3421. Header: res.Header,
  3422. }
  3423. }
  3424. if err != nil {
  3425. return nil, err
  3426. }
  3427. defer googleapi.CloseBody(res)
  3428. if err := googleapi.CheckResponse(res); err != nil {
  3429. return nil, err
  3430. }
  3431. ret := &Policy{
  3432. ServerResponse: googleapi.ServerResponse{
  3433. Header: res.Header,
  3434. HTTPStatusCode: res.StatusCode,
  3435. },
  3436. }
  3437. target := &ret
  3438. if err := gensupport.DecodeResponse(target, res); err != nil {
  3439. return nil, err
  3440. }
  3441. return ret, nil
  3442. // {
  3443. // "description": "Sets the IAM access control policy on the specified function.\nReplaces any existing policy.",
  3444. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:setIamPolicy",
  3445. // "httpMethod": "POST",
  3446. // "id": "cloudfunctions.projects.locations.functions.setIamPolicy",
  3447. // "parameterOrder": [
  3448. // "resource"
  3449. // ],
  3450. // "parameters": {
  3451. // "resource": {
  3452. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  3453. // "location": "path",
  3454. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  3455. // "required": true,
  3456. // "type": "string"
  3457. // }
  3458. // },
  3459. // "path": "v1/{+resource}:setIamPolicy",
  3460. // "request": {
  3461. // "$ref": "SetIamPolicyRequest"
  3462. // },
  3463. // "response": {
  3464. // "$ref": "Policy"
  3465. // },
  3466. // "scopes": [
  3467. // "https://www.googleapis.com/auth/cloud-platform"
  3468. // ]
  3469. // }
  3470. }
  3471. // method id "cloudfunctions.projects.locations.functions.testIamPermissions":
  3472. type ProjectsLocationsFunctionsTestIamPermissionsCall struct {
  3473. s *Service
  3474. resource string
  3475. testiampermissionsrequest *TestIamPermissionsRequest
  3476. urlParams_ gensupport.URLParams
  3477. ctx_ context.Context
  3478. header_ http.Header
  3479. }
  3480. // TestIamPermissions: Tests the specified permissions against the IAM
  3481. // access control policy
  3482. // for a function.
  3483. // If the function does not exist, this will return an empty set
  3484. // of
  3485. // permissions, not a NOT_FOUND error.
  3486. func (r *ProjectsLocationsFunctionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsFunctionsTestIamPermissionsCall {
  3487. c := &ProjectsLocationsFunctionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3488. c.resource = resource
  3489. c.testiampermissionsrequest = testiampermissionsrequest
  3490. return c
  3491. }
  3492. // Fields allows partial responses to be retrieved. See
  3493. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3494. // for more information.
  3495. func (c *ProjectsLocationsFunctionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsTestIamPermissionsCall {
  3496. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3497. return c
  3498. }
  3499. // Context sets the context to be used in this call's Do method. Any
  3500. // pending HTTP request will be aborted if the provided context is
  3501. // canceled.
  3502. func (c *ProjectsLocationsFunctionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsFunctionsTestIamPermissionsCall {
  3503. c.ctx_ = ctx
  3504. return c
  3505. }
  3506. // Header returns an http.Header that can be modified by the caller to
  3507. // add HTTP headers to the request.
  3508. func (c *ProjectsLocationsFunctionsTestIamPermissionsCall) Header() http.Header {
  3509. if c.header_ == nil {
  3510. c.header_ = make(http.Header)
  3511. }
  3512. return c.header_
  3513. }
  3514. func (c *ProjectsLocationsFunctionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  3515. reqHeaders := make(http.Header)
  3516. for k, v := range c.header_ {
  3517. reqHeaders[k] = v
  3518. }
  3519. reqHeaders.Set("User-Agent", c.s.userAgent())
  3520. var body io.Reader = nil
  3521. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  3522. if err != nil {
  3523. return nil, err
  3524. }
  3525. reqHeaders.Set("Content-Type", "application/json")
  3526. c.urlParams_.Set("alt", alt)
  3527. c.urlParams_.Set("prettyPrint", "false")
  3528. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  3529. urls += "?" + c.urlParams_.Encode()
  3530. req, err := http.NewRequest("POST", urls, body)
  3531. if err != nil {
  3532. return nil, err
  3533. }
  3534. req.Header = reqHeaders
  3535. googleapi.Expand(req.URL, map[string]string{
  3536. "resource": c.resource,
  3537. })
  3538. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3539. }
  3540. // Do executes the "cloudfunctions.projects.locations.functions.testIamPermissions" call.
  3541. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  3542. // Any non-2xx status code is an error. Response headers are in either
  3543. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  3544. // was returned at all) in error.(*googleapi.Error).Header. Use
  3545. // googleapi.IsNotModified to check whether the returned error was
  3546. // because http.StatusNotModified was returned.
  3547. func (c *ProjectsLocationsFunctionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  3548. gensupport.SetOptions(c.urlParams_, opts...)
  3549. res, err := c.doRequest("json")
  3550. if res != nil && res.StatusCode == http.StatusNotModified {
  3551. if res.Body != nil {
  3552. res.Body.Close()
  3553. }
  3554. return nil, &googleapi.Error{
  3555. Code: res.StatusCode,
  3556. Header: res.Header,
  3557. }
  3558. }
  3559. if err != nil {
  3560. return nil, err
  3561. }
  3562. defer googleapi.CloseBody(res)
  3563. if err := googleapi.CheckResponse(res); err != nil {
  3564. return nil, err
  3565. }
  3566. ret := &TestIamPermissionsResponse{
  3567. ServerResponse: googleapi.ServerResponse{
  3568. Header: res.Header,
  3569. HTTPStatusCode: res.StatusCode,
  3570. },
  3571. }
  3572. target := &ret
  3573. if err := gensupport.DecodeResponse(target, res); err != nil {
  3574. return nil, err
  3575. }
  3576. return ret, nil
  3577. // {
  3578. // "description": "Tests the specified permissions against the IAM access control policy\nfor a function.\nIf the function does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.",
  3579. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:testIamPermissions",
  3580. // "httpMethod": "POST",
  3581. // "id": "cloudfunctions.projects.locations.functions.testIamPermissions",
  3582. // "parameterOrder": [
  3583. // "resource"
  3584. // ],
  3585. // "parameters": {
  3586. // "resource": {
  3587. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3588. // "location": "path",
  3589. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  3590. // "required": true,
  3591. // "type": "string"
  3592. // }
  3593. // },
  3594. // "path": "v1/{+resource}:testIamPermissions",
  3595. // "request": {
  3596. // "$ref": "TestIamPermissionsRequest"
  3597. // },
  3598. // "response": {
  3599. // "$ref": "TestIamPermissionsResponse"
  3600. // },
  3601. // "scopes": [
  3602. // "https://www.googleapis.com/auth/cloud-platform"
  3603. // ]
  3604. // }
  3605. }