Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

3004 rindas
105 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/v1beta2"
  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/v1beta2"
  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:v1beta2"
  67. const apiName = "cloudfunctions"
  68. const apiVersion = "v1beta2"
  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. // CallFunctionRequest: Request for the `CallFunction` method.
  155. type CallFunctionRequest struct {
  156. // Data: Input to be passed to the function.
  157. Data string `json:"data,omitempty"`
  158. // ForceSendFields is a list of field names (e.g. "Data") to
  159. // unconditionally include in API requests. By default, fields with
  160. // empty values are omitted from API requests. However, any non-pointer,
  161. // non-interface field appearing in ForceSendFields will be sent to the
  162. // server regardless of whether the field is empty or not. This may be
  163. // used to include empty fields in Patch requests.
  164. ForceSendFields []string `json:"-"`
  165. // NullFields is a list of field names (e.g. "Data") to include in API
  166. // requests with the JSON null value. By default, fields with empty
  167. // values are omitted from API requests. However, any field with an
  168. // empty value appearing in NullFields will be sent to the server as
  169. // null. It is an error if a field in this list has a non-empty value.
  170. // This may be used to include null fields in Patch requests.
  171. NullFields []string `json:"-"`
  172. }
  173. func (s *CallFunctionRequest) MarshalJSON() ([]byte, error) {
  174. type NoMethod CallFunctionRequest
  175. raw := NoMethod(*s)
  176. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  177. }
  178. // CallFunctionResponse: Response of `CallFunction` method.
  179. type CallFunctionResponse struct {
  180. // Error: Either system or user-function generated error. Set if
  181. // execution
  182. // was not successful.
  183. Error string `json:"error,omitempty"`
  184. // ExecutionId: Execution id of function invocation.
  185. ExecutionId string `json:"executionId,omitempty"`
  186. // Result: Result populated for successful execution of synchronous
  187. // function. Will
  188. // not be populated if function does not return a result through
  189. // context.
  190. Result string `json:"result,omitempty"`
  191. // ServerResponse contains the HTTP response code and headers from the
  192. // server.
  193. googleapi.ServerResponse `json:"-"`
  194. // ForceSendFields is a list of field names (e.g. "Error") to
  195. // unconditionally include in API requests. By default, fields with
  196. // empty values are omitted from API requests. However, any non-pointer,
  197. // non-interface field appearing in ForceSendFields will be sent to the
  198. // server regardless of whether the field is empty or not. This may be
  199. // used to include empty fields in Patch requests.
  200. ForceSendFields []string `json:"-"`
  201. // NullFields is a list of field names (e.g. "Error") to include in API
  202. // requests with the JSON null value. By default, fields with empty
  203. // values are omitted from API requests. However, any field with an
  204. // empty value appearing in NullFields will be sent to the server as
  205. // null. It is an error if a field in this list has a non-empty value.
  206. // This may be used to include null fields in Patch requests.
  207. NullFields []string `json:"-"`
  208. }
  209. func (s *CallFunctionResponse) MarshalJSON() ([]byte, error) {
  210. type NoMethod CallFunctionResponse
  211. raw := NoMethod(*s)
  212. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  213. }
  214. // CloudFunction: Describes a Cloud Function that contains user
  215. // computation executed in
  216. // response to an event. It encapsulate function and triggers
  217. // configurations.
  218. type CloudFunction struct {
  219. // AvailableMemoryMb: The amount of memory in MB available for a
  220. // function.
  221. // Defaults to 256MB.
  222. AvailableMemoryMb int64 `json:"availableMemoryMb,omitempty"`
  223. // EntryPoint: The name of the function (as defined in source code) that
  224. // will be
  225. // executed. Defaults to the resource name suffix, if not specified.
  226. // For
  227. // backward compatibility, if function with given name is not found,
  228. // then the
  229. // system will try to use function named "function".
  230. // For Node.js this is name of a function exported by the module
  231. // specified
  232. // in `source_location`.
  233. EntryPoint string `json:"entryPoint,omitempty"`
  234. // EnvironmentVariables: Environment variables that shall be available
  235. // during function execution.
  236. EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
  237. // EventTrigger: A source that fires events in response to a condition
  238. // in another service.
  239. EventTrigger *EventTrigger `json:"eventTrigger,omitempty"`
  240. // HttpsTrigger: An HTTPS endpoint type of source that can be triggered
  241. // via URL.
  242. HttpsTrigger *HTTPSTrigger `json:"httpsTrigger,omitempty"`
  243. // Labels: Labels associated with this Cloud Function.
  244. Labels map[string]string `json:"labels,omitempty"`
  245. // LatestOperation: Output only. Name of the most recent operation
  246. // modifying the function. If
  247. // the function status is `DEPLOYING` or `DELETING`, then it points to
  248. // the
  249. // active operation.
  250. LatestOperation string `json:"latestOperation,omitempty"`
  251. // MaxInstances: The limit on the maximum number of function instances
  252. // that may coexist at a
  253. // given time. This feature is currently in alpha, available only
  254. // for
  255. // whitelisted users.
  256. MaxInstances int64 `json:"maxInstances,omitempty"`
  257. // Name: A user-defined name of the function. Function names must be
  258. // unique
  259. // globally and match pattern `projects/*/locations/*/functions/*`
  260. Name string `json:"name,omitempty"`
  261. // Network: The VPC Network that this cloud function can connect to. It
  262. // can be
  263. // either the fully-qualified URI, or the short name of the network
  264. // resource.
  265. // If the short network name is used, the network must belong to the
  266. // same
  267. // project. Otherwise, it must belong to a project within the
  268. // same
  269. // organization. The format of this field is
  270. // either
  271. // `projects/{project}/global/networks/{network}` or `{network}`,
  272. // where
  273. // {project} is a project id where the network is defined, and {network}
  274. // is
  275. // the short name of the network.
  276. //
  277. // This field is mutually exclusive with `vpc_connector` and will be
  278. // replaced
  279. // by it.
  280. //
  281. // See [the VPC
  282. // documentation](https://cloud.google.com/compute/docs/vpc) for
  283. // more information on connecting Cloud projects.
  284. //
  285. // This feature is currently in alpha, available only for whitelisted
  286. // users.
  287. Network string `json:"network,omitempty"`
  288. // Runtime: The runtime in which the function is going to run. If empty,
  289. // defaults to
  290. // Node.js 6.
  291. Runtime string `json:"runtime,omitempty"`
  292. // ServiceAccount: The email of the function's service account. If
  293. // empty, defaults to
  294. // {project_id}@appspot.gserviceaccount.com.
  295. ServiceAccount string `json:"serviceAccount,omitempty"`
  296. // SourceArchiveUrl: The Google Cloud Storage URL, starting with gs://,
  297. // pointing to the zip
  298. // archive which contains the function.
  299. SourceArchiveUrl string `json:"sourceArchiveUrl,omitempty"`
  300. // SourceRepository: The hosted repository where the function is
  301. // defined.
  302. SourceRepository *SourceRepository `json:"sourceRepository,omitempty"`
  303. // SourceRepositoryUrl: The URL pointing to the hosted repository where
  304. // the function is defined.
  305. // There are supported Cloud Source Repository URLs in the
  306. // following
  307. // formats:
  308. //
  309. // To refer to a specific
  310. // commit:
  311. // `https://source.developers.google.com/projects/*/repos/*/revis
  312. // ions/*/paths/*`
  313. // To refer to a moveable alias
  314. // (branch):
  315. // `https://source.developers.google.com/projects/*/repos/*/mov
  316. // eable-aliases/*/paths/*`
  317. // In particular, to refer to HEAD use `master` moveable alias.
  318. // To refer to a specific fixed alias
  319. // (tag):
  320. // `https://source.developers.google.com/projects/*/repos/*/fixed-
  321. // aliases/*/paths/*`
  322. //
  323. // You may omit `paths/*` if you want to use the main directory.
  324. SourceRepositoryUrl string `json:"sourceRepositoryUrl,omitempty"`
  325. // SourceUploadUrl: The Google Cloud Storage signed URL used for source
  326. // uploading, generated
  327. // by google.cloud.functions.v1beta2.GenerateUploadUrl
  328. SourceUploadUrl string `json:"sourceUploadUrl,omitempty"`
  329. // Status: Output only. Status of the function deployment.
  330. //
  331. // Possible values:
  332. // "STATUS_UNSPECIFIED" - Status not specified.
  333. // "READY" - Successfully deployed.
  334. // "FAILED" - Not deployed correctly - behavior is undefined. The item
  335. // should be updated
  336. // or deleted to move it out of this state.
  337. // "DEPLOYING" - Creation or update in progress.
  338. // "DELETING" - Deletion in progress.
  339. Status string `json:"status,omitempty"`
  340. // Timeout: The function execution timeout. Execution is considered
  341. // failed and
  342. // can be terminated if the function is not completed at the end of
  343. // the
  344. // timeout period. Defaults to 60 seconds.
  345. Timeout string `json:"timeout,omitempty"`
  346. // UpdateTime: Output only. The last update timestamp of a Cloud
  347. // Function.
  348. UpdateTime string `json:"updateTime,omitempty"`
  349. // VersionId: Output only.
  350. // The version identifier of the Cloud Function. Each deployment
  351. // attempt
  352. // results in a new version of a function being created.
  353. VersionId int64 `json:"versionId,omitempty,string"`
  354. // VpcConnector: The VPC Network Connector that this cloud function can
  355. // connect to. It can
  356. // be either the fully-qualified URI, or the short name of the
  357. // network
  358. // connector resource. The format of this field
  359. // is
  360. // `projects/*/locations/*/connectors/*`
  361. //
  362. // This field is mutually exclusive with `network` field and will
  363. // eventually
  364. // replace it.
  365. //
  366. // See [the VPC
  367. // documentation](https://cloud.google.com/compute/docs/vpc) for
  368. // more information on connecting Cloud projects.
  369. //
  370. // This feature is currently in alpha, available only for whitelisted
  371. // users.
  372. VpcConnector string `json:"vpcConnector,omitempty"`
  373. // ServerResponse contains the HTTP response code and headers from the
  374. // server.
  375. googleapi.ServerResponse `json:"-"`
  376. // ForceSendFields is a list of field names (e.g. "AvailableMemoryMb")
  377. // to unconditionally include in API requests. By default, fields with
  378. // empty values are omitted from API requests. However, any non-pointer,
  379. // non-interface field appearing in ForceSendFields will be sent to the
  380. // server regardless of whether the field is empty or not. This may be
  381. // used to include empty fields in Patch requests.
  382. ForceSendFields []string `json:"-"`
  383. // NullFields is a list of field names (e.g. "AvailableMemoryMb") to
  384. // include in API requests with the JSON null value. By default, fields
  385. // with empty values are omitted from API requests. However, any field
  386. // with an empty value appearing in NullFields will be sent to the
  387. // server as null. It is an error if a field in this list has a
  388. // non-empty value. This may be used to include null fields in Patch
  389. // requests.
  390. NullFields []string `json:"-"`
  391. }
  392. func (s *CloudFunction) MarshalJSON() ([]byte, error) {
  393. type NoMethod CloudFunction
  394. raw := NoMethod(*s)
  395. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  396. }
  397. // EventTrigger: Describes EventTrigger, used to request events be sent
  398. // from another
  399. // service.
  400. type EventTrigger struct {
  401. // EventType: `event_type` names contain the service that is sending an
  402. // event and the
  403. // kind of event that was fired. Must be of the
  404. // form
  405. // `providers/*/eventTypes/*` e.g. Directly handle a Message published
  406. // to
  407. // Google Cloud Pub/Sub
  408. // `providers/cloud.pubsub/eventTypes/topic.publish`.
  409. //
  410. // Handle an object changing in Google Cloud
  411. // Storage:
  412. // `providers/cloud.storage/eventTypes/object.change`
  413. //
  414. // Handle a write to the Firebase Realtime
  415. // Database:
  416. // `providers/google.firebase.database/eventTypes/ref.write`
  417. EventType string `json:"eventType,omitempty"`
  418. // FailurePolicy: Specifies policy for failed executions.
  419. FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"`
  420. // Resource: Which instance of the source's service should send events.
  421. // E.g. for Pub/Sub
  422. // this would be a Pub/Sub topic at `projects/*/topics/*`. For Google
  423. // Cloud
  424. // Storage this would be a bucket at `projects/*/buckets/*`. For any
  425. // source
  426. // that only supports one instance per-project, this should be the name
  427. // of the
  428. // project (`projects/*`)
  429. Resource string `json:"resource,omitempty"`
  430. // Service: The hostname of the service that should be observed.
  431. //
  432. // If no string is provided, the default service implementing the API
  433. // will
  434. // be used. For example, `storage.googleapis.com` is the default for
  435. // all
  436. // event types in the `google.storage` namespace.
  437. Service string `json:"service,omitempty"`
  438. // ForceSendFields is a list of field names (e.g. "EventType") to
  439. // unconditionally include in API requests. By default, fields with
  440. // empty values are omitted from API requests. However, any non-pointer,
  441. // non-interface field appearing in ForceSendFields will be sent to the
  442. // server regardless of whether the field is empty or not. This may be
  443. // used to include empty fields in Patch requests.
  444. ForceSendFields []string `json:"-"`
  445. // NullFields is a list of field names (e.g. "EventType") to include in
  446. // API requests with the JSON null value. By default, fields with empty
  447. // values are omitted from API requests. However, any field with an
  448. // empty value appearing in NullFields will be sent to the server as
  449. // null. It is an error if a field in this list has a non-empty value.
  450. // This may be used to include null fields in Patch requests.
  451. NullFields []string `json:"-"`
  452. }
  453. func (s *EventTrigger) MarshalJSON() ([]byte, error) {
  454. type NoMethod EventTrigger
  455. raw := NoMethod(*s)
  456. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  457. }
  458. // FailurePolicy: Describes the policy in case of function's execution
  459. // failure.
  460. // If empty, then defaults to ignoring failures (i.e. not retrying
  461. // them).
  462. type FailurePolicy struct {
  463. // Retry: If specified, then the function will be retried in case of a
  464. // failure.
  465. Retry *Retry `json:"retry,omitempty"`
  466. // ForceSendFields is a list of field names (e.g. "Retry") to
  467. // unconditionally include in API requests. By default, fields with
  468. // empty values are omitted from API requests. However, any non-pointer,
  469. // non-interface field appearing in ForceSendFields will be sent to the
  470. // server regardless of whether the field is empty or not. This may be
  471. // used to include empty fields in Patch requests.
  472. ForceSendFields []string `json:"-"`
  473. // NullFields is a list of field names (e.g. "Retry") to include in API
  474. // requests with the JSON null value. By default, fields with empty
  475. // values are omitted from API requests. However, any field with an
  476. // empty value appearing in NullFields will be sent to the server as
  477. // null. It is an error if a field in this list has a non-empty value.
  478. // This may be used to include null fields in Patch requests.
  479. NullFields []string `json:"-"`
  480. }
  481. func (s *FailurePolicy) MarshalJSON() ([]byte, error) {
  482. type NoMethod FailurePolicy
  483. raw := NoMethod(*s)
  484. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  485. }
  486. // GenerateDownloadUrlRequest: Request of `GenerateDownloadUrl` method.
  487. type GenerateDownloadUrlRequest struct {
  488. // VersionId: The optional version of function.
  489. VersionId uint64 `json:"versionId,omitempty,string"`
  490. // ForceSendFields is a list of field names (e.g. "VersionId") to
  491. // unconditionally include in API requests. By default, fields with
  492. // empty values are omitted from API requests. However, any non-pointer,
  493. // non-interface field appearing in ForceSendFields will be sent to the
  494. // server regardless of whether the field is empty or not. This may be
  495. // used to include empty fields in Patch requests.
  496. ForceSendFields []string `json:"-"`
  497. // NullFields is a list of field names (e.g. "VersionId") to include in
  498. // API requests with the JSON null value. By default, fields with empty
  499. // values are omitted from API requests. However, any field with an
  500. // empty value appearing in NullFields will be sent to the server as
  501. // null. It is an error if a field in this list has a non-empty value.
  502. // This may be used to include null fields in Patch requests.
  503. NullFields []string `json:"-"`
  504. }
  505. func (s *GenerateDownloadUrlRequest) MarshalJSON() ([]byte, error) {
  506. type NoMethod GenerateDownloadUrlRequest
  507. raw := NoMethod(*s)
  508. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  509. }
  510. // GenerateDownloadUrlResponse: Response of `GenerateDownloadUrl`
  511. // method.
  512. type GenerateDownloadUrlResponse struct {
  513. // DownloadUrl: The generated Google Cloud Storage signed URL that
  514. // should be used for
  515. // function source code download.
  516. DownloadUrl string `json:"downloadUrl,omitempty"`
  517. // ServerResponse contains the HTTP response code and headers from the
  518. // server.
  519. googleapi.ServerResponse `json:"-"`
  520. // ForceSendFields is a list of field names (e.g. "DownloadUrl") to
  521. // unconditionally include in API requests. By default, fields with
  522. // empty values are omitted from API requests. However, any non-pointer,
  523. // non-interface field appearing in ForceSendFields will be sent to the
  524. // server regardless of whether the field is empty or not. This may be
  525. // used to include empty fields in Patch requests.
  526. ForceSendFields []string `json:"-"`
  527. // NullFields is a list of field names (e.g. "DownloadUrl") to include
  528. // in API requests with the JSON null value. By default, fields with
  529. // empty values are omitted from API requests. However, any field with
  530. // an empty value appearing in NullFields will be sent to the server as
  531. // null. It is an error if a field in this list has a non-empty value.
  532. // This may be used to include null fields in Patch requests.
  533. NullFields []string `json:"-"`
  534. }
  535. func (s *GenerateDownloadUrlResponse) MarshalJSON() ([]byte, error) {
  536. type NoMethod GenerateDownloadUrlResponse
  537. raw := NoMethod(*s)
  538. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  539. }
  540. // GenerateUploadUrlRequest: Request of `GenerateUploadUrl` method.
  541. type GenerateUploadUrlRequest struct {
  542. }
  543. // GenerateUploadUrlResponse: Response of `GenerateUploadUrl` method.
  544. type GenerateUploadUrlResponse struct {
  545. // UploadUrl: The generated Google Cloud Storage signed URL that should
  546. // be used for a
  547. // function source code upload. The uploaded file should be a zip
  548. // archive
  549. // which contains a function.
  550. UploadUrl string `json:"uploadUrl,omitempty"`
  551. // ServerResponse contains the HTTP response code and headers from the
  552. // server.
  553. googleapi.ServerResponse `json:"-"`
  554. // ForceSendFields is a list of field names (e.g. "UploadUrl") to
  555. // unconditionally include in API requests. By default, fields with
  556. // empty values are omitted from API requests. However, any non-pointer,
  557. // non-interface field appearing in ForceSendFields will be sent to the
  558. // server regardless of whether the field is empty or not. This may be
  559. // used to include empty fields in Patch requests.
  560. ForceSendFields []string `json:"-"`
  561. // NullFields is a list of field names (e.g. "UploadUrl") to include in
  562. // API requests with the JSON null value. By default, fields with empty
  563. // values are omitted from API requests. However, any field with an
  564. // empty value appearing in NullFields will be sent to the server as
  565. // null. It is an error if a field in this list has a non-empty value.
  566. // This may be used to include null fields in Patch requests.
  567. NullFields []string `json:"-"`
  568. }
  569. func (s *GenerateUploadUrlResponse) MarshalJSON() ([]byte, error) {
  570. type NoMethod GenerateUploadUrlResponse
  571. raw := NoMethod(*s)
  572. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  573. }
  574. // HTTPSTrigger: Describes HTTPSTrigger, could be used to connect web
  575. // hooks to function.
  576. type HTTPSTrigger struct {
  577. // Url: Output only. The deployed url for the function.
  578. Url string `json:"url,omitempty"`
  579. // ForceSendFields is a list of field names (e.g. "Url") to
  580. // unconditionally include in API requests. By default, fields with
  581. // empty values are omitted from API requests. However, any non-pointer,
  582. // non-interface field appearing in ForceSendFields will be sent to the
  583. // server regardless of whether the field is empty or not. This may be
  584. // used to include empty fields in Patch requests.
  585. ForceSendFields []string `json:"-"`
  586. // NullFields is a list of field names (e.g. "Url") to include in API
  587. // requests with the JSON null value. By default, fields with empty
  588. // values are omitted from API requests. However, any field with an
  589. // empty value appearing in NullFields will be sent to the server as
  590. // null. It is an error if a field in this list has a non-empty value.
  591. // This may be used to include null fields in Patch requests.
  592. NullFields []string `json:"-"`
  593. }
  594. func (s *HTTPSTrigger) MarshalJSON() ([]byte, error) {
  595. type NoMethod HTTPSTrigger
  596. raw := NoMethod(*s)
  597. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  598. }
  599. // ListFunctionsResponse: Response for the `ListFunctions` method.
  600. type ListFunctionsResponse struct {
  601. // Functions: The functions that match the request.
  602. Functions []*CloudFunction `json:"functions,omitempty"`
  603. // NextPageToken: If not empty, indicates that there may be more
  604. // functions that match
  605. // the request; this value should be passed in a
  606. // new
  607. // google.cloud.functions.v1beta2.ListFunctionsRequest
  608. // to get more functions.
  609. NextPageToken string `json:"nextPageToken,omitempty"`
  610. // ServerResponse contains the HTTP response code and headers from the
  611. // server.
  612. googleapi.ServerResponse `json:"-"`
  613. // ForceSendFields is a list of field names (e.g. "Functions") to
  614. // unconditionally include in API requests. By default, fields with
  615. // empty values are omitted from API requests. However, any non-pointer,
  616. // non-interface field appearing in ForceSendFields will be sent to the
  617. // server regardless of whether the field is empty or not. This may be
  618. // used to include empty fields in Patch requests.
  619. ForceSendFields []string `json:"-"`
  620. // NullFields is a list of field names (e.g. "Functions") to include in
  621. // API requests with the JSON null value. By default, fields with empty
  622. // values are omitted from API requests. However, any field with an
  623. // empty value appearing in NullFields will be sent to the server as
  624. // null. It is an error if a field in this list has a non-empty value.
  625. // This may be used to include null fields in Patch requests.
  626. NullFields []string `json:"-"`
  627. }
  628. func (s *ListFunctionsResponse) MarshalJSON() ([]byte, error) {
  629. type NoMethod ListFunctionsResponse
  630. raw := NoMethod(*s)
  631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  632. }
  633. // ListLocationsResponse: The response message for
  634. // Locations.ListLocations.
  635. type ListLocationsResponse struct {
  636. // Locations: A list of locations that matches the specified filter in
  637. // the request.
  638. Locations []*Location `json:"locations,omitempty"`
  639. // NextPageToken: The standard List next-page token.
  640. NextPageToken string `json:"nextPageToken,omitempty"`
  641. // ServerResponse contains the HTTP response code and headers from the
  642. // server.
  643. googleapi.ServerResponse `json:"-"`
  644. // ForceSendFields is a list of field names (e.g. "Locations") to
  645. // unconditionally include in API requests. By default, fields with
  646. // empty values are omitted from API requests. However, any non-pointer,
  647. // non-interface field appearing in ForceSendFields will be sent to the
  648. // server regardless of whether the field is empty or not. This may be
  649. // used to include empty fields in Patch requests.
  650. ForceSendFields []string `json:"-"`
  651. // NullFields is a list of field names (e.g. "Locations") to include in
  652. // API requests with the JSON null value. By default, fields with empty
  653. // values are omitted from API requests. However, any field with an
  654. // empty value appearing in NullFields will be sent to the server as
  655. // null. It is an error if a field in this list has a non-empty value.
  656. // This may be used to include null fields in Patch requests.
  657. NullFields []string `json:"-"`
  658. }
  659. func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
  660. type NoMethod ListLocationsResponse
  661. raw := NoMethod(*s)
  662. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  663. }
  664. // ListOperationsResponse: The response message for
  665. // Operations.ListOperations.
  666. type ListOperationsResponse struct {
  667. // NextPageToken: The standard List next-page token.
  668. NextPageToken string `json:"nextPageToken,omitempty"`
  669. // Operations: A list of operations that matches the specified filter in
  670. // the request.
  671. Operations []*Operation `json:"operations,omitempty"`
  672. // ServerResponse contains the HTTP response code and headers from the
  673. // server.
  674. googleapi.ServerResponse `json:"-"`
  675. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  676. // unconditionally include in API requests. By default, fields with
  677. // empty values are omitted from API requests. However, any non-pointer,
  678. // non-interface field appearing in ForceSendFields will be sent to the
  679. // server regardless of whether the field is empty or not. This may be
  680. // used to include empty fields in Patch requests.
  681. ForceSendFields []string `json:"-"`
  682. // NullFields is a list of field names (e.g. "NextPageToken") to include
  683. // in API requests with the JSON null value. By default, fields with
  684. // empty values are omitted from API requests. However, any field with
  685. // an empty value appearing in NullFields will be sent to the server as
  686. // null. It is an error if a field in this list has a non-empty value.
  687. // This may be used to include null fields in Patch requests.
  688. NullFields []string `json:"-"`
  689. }
  690. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  691. type NoMethod ListOperationsResponse
  692. raw := NoMethod(*s)
  693. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  694. }
  695. // Location: A resource that represents Google Cloud Platform location.
  696. type Location struct {
  697. // DisplayName: The friendly name for this location, typically a nearby
  698. // city name.
  699. // For example, "Tokyo".
  700. DisplayName string `json:"displayName,omitempty"`
  701. // Labels: Cross-service attributes for the location. For example
  702. //
  703. // {"cloud.googleapis.com/region": "us-east1"}
  704. Labels map[string]string `json:"labels,omitempty"`
  705. // LocationId: The canonical id for this location. For example:
  706. // "us-east1".
  707. LocationId string `json:"locationId,omitempty"`
  708. // Metadata: Service-specific metadata. For example the available
  709. // capacity at the given
  710. // location.
  711. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  712. // Name: Resource name for the location, which may vary between
  713. // implementations.
  714. // For example: "projects/example-project/locations/us-east1"
  715. Name string `json:"name,omitempty"`
  716. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  717. // unconditionally include in API requests. By default, fields with
  718. // empty values are omitted from API requests. However, any non-pointer,
  719. // non-interface field appearing in ForceSendFields will be sent to the
  720. // server regardless of whether the field is empty or not. This may be
  721. // used to include empty fields in Patch requests.
  722. ForceSendFields []string `json:"-"`
  723. // NullFields is a list of field names (e.g. "DisplayName") to include
  724. // in API requests with the JSON null value. By default, fields with
  725. // empty values are omitted from API requests. However, any field with
  726. // an empty value appearing in NullFields will be sent to the server as
  727. // null. It is an error if a field in this list has a non-empty value.
  728. // This may be used to include null fields in Patch requests.
  729. NullFields []string `json:"-"`
  730. }
  731. func (s *Location) MarshalJSON() ([]byte, error) {
  732. type NoMethod Location
  733. raw := NoMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  735. }
  736. // Operation: This resource represents a long-running operation that is
  737. // the result of a
  738. // network API call.
  739. type Operation struct {
  740. // Done: If the value is `false`, it means the operation is still in
  741. // progress.
  742. // If `true`, the operation is completed, and either `error` or
  743. // `response` is
  744. // available.
  745. Done bool `json:"done,omitempty"`
  746. // Error: The error result of the operation in case of failure or
  747. // cancellation.
  748. Error *Status `json:"error,omitempty"`
  749. // Metadata: Service-specific metadata associated with the operation.
  750. // It typically
  751. // contains progress information and common metadata such as create
  752. // time.
  753. // Some services might not provide such metadata. Any method that
  754. // returns a
  755. // long-running operation should document the metadata type, if any.
  756. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  757. // Name: The server-assigned name, which is only unique within the same
  758. // service that
  759. // originally returns it. If you use the default HTTP mapping,
  760. // the
  761. // `name` should have the format of `operations/some/unique/name`.
  762. Name string `json:"name,omitempty"`
  763. // Response: The normal response of the operation in case of success.
  764. // If the original
  765. // method returns no data on success, such as `Delete`, the response
  766. // is
  767. // `google.protobuf.Empty`. If the original method is
  768. // standard
  769. // `Get`/`Create`/`Update`, the response should be the resource. For
  770. // other
  771. // methods, the response should have the type `XxxResponse`, where
  772. // `Xxx`
  773. // is the original method name. For example, if the original method
  774. // name
  775. // is `TakeSnapshot()`, the inferred response type
  776. // is
  777. // `TakeSnapshotResponse`.
  778. Response googleapi.RawMessage `json:"response,omitempty"`
  779. // ServerResponse contains the HTTP response code and headers from the
  780. // server.
  781. googleapi.ServerResponse `json:"-"`
  782. // ForceSendFields is a list of field names (e.g. "Done") to
  783. // unconditionally include in API requests. By default, fields with
  784. // empty values are omitted from API requests. However, any non-pointer,
  785. // non-interface field appearing in ForceSendFields will be sent to the
  786. // server regardless of whether the field is empty or not. This may be
  787. // used to include empty fields in Patch requests.
  788. ForceSendFields []string `json:"-"`
  789. // NullFields is a list of field names (e.g. "Done") to include in API
  790. // requests with the JSON null value. By default, fields with empty
  791. // values are omitted from API requests. However, any field with an
  792. // empty value appearing in NullFields will be sent to the server as
  793. // null. It is an error if a field in this list has a non-empty value.
  794. // This may be used to include null fields in Patch requests.
  795. NullFields []string `json:"-"`
  796. }
  797. func (s *Operation) MarshalJSON() ([]byte, error) {
  798. type NoMethod Operation
  799. raw := NoMethod(*s)
  800. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  801. }
  802. // OperationMetadataV1: Metadata describing an Operation
  803. type OperationMetadataV1 struct {
  804. // Request: The original request that started the operation.
  805. Request googleapi.RawMessage `json:"request,omitempty"`
  806. // Target: Target of the operation - for
  807. // example
  808. // projects/project-1/locations/region-1/functions/function-1
  809. Target string `json:"target,omitempty"`
  810. // Type: Type of operation.
  811. //
  812. // Possible values:
  813. // "OPERATION_UNSPECIFIED" - Unknown operation type.
  814. // "CREATE_FUNCTION" - Triggered by CreateFunction call
  815. // "UPDATE_FUNCTION" - Triggered by UpdateFunction call
  816. // "DELETE_FUNCTION" - Triggered by DeleteFunction call.
  817. Type string `json:"type,omitempty"`
  818. // UpdateTime: The last update timestamp of the operation.
  819. UpdateTime string `json:"updateTime,omitempty"`
  820. // VersionId: Version id of the function created or updated by an API
  821. // call.
  822. // This field is only populated for Create and Update operations.
  823. VersionId int64 `json:"versionId,omitempty,string"`
  824. // ForceSendFields is a list of field names (e.g. "Request") to
  825. // unconditionally include in API requests. By default, fields with
  826. // empty values are omitted from API requests. However, any non-pointer,
  827. // non-interface field appearing in ForceSendFields will be sent to the
  828. // server regardless of whether the field is empty or not. This may be
  829. // used to include empty fields in Patch requests.
  830. ForceSendFields []string `json:"-"`
  831. // NullFields is a list of field names (e.g. "Request") to include in
  832. // API requests with the JSON null value. By default, fields with empty
  833. // values are omitted from API requests. However, any field with an
  834. // empty value appearing in NullFields will be sent to the server as
  835. // null. It is an error if a field in this list has a non-empty value.
  836. // This may be used to include null fields in Patch requests.
  837. NullFields []string `json:"-"`
  838. }
  839. func (s *OperationMetadataV1) MarshalJSON() ([]byte, error) {
  840. type NoMethod OperationMetadataV1
  841. raw := NoMethod(*s)
  842. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  843. }
  844. // OperationMetadataV1Beta2: Metadata describing an Operation
  845. type OperationMetadataV1Beta2 struct {
  846. // Request: The original request that started the operation.
  847. Request googleapi.RawMessage `json:"request,omitempty"`
  848. // Target: Target of the operation - for
  849. // example
  850. // projects/project-1/locations/region-1/functions/function-1
  851. Target string `json:"target,omitempty"`
  852. // Type: Type of operation.
  853. //
  854. // Possible values:
  855. // "OPERATION_UNSPECIFIED" - Unknown operation type.
  856. // "CREATE_FUNCTION" - Triggered by CreateFunction call
  857. // "UPDATE_FUNCTION" - Triggered by UpdateFunction call
  858. // "DELETE_FUNCTION" - Triggered by DeleteFunction call.
  859. Type string `json:"type,omitempty"`
  860. // UpdateTime: The last update timestamp of the operation.
  861. UpdateTime string `json:"updateTime,omitempty"`
  862. // VersionId: Version id of the function created or updated by an API
  863. // call.
  864. // This field is only populated for Create and Update operations.
  865. VersionId int64 `json:"versionId,omitempty,string"`
  866. // ForceSendFields is a list of field names (e.g. "Request") to
  867. // unconditionally include in API requests. By default, fields with
  868. // empty values are omitted from API requests. However, any non-pointer,
  869. // non-interface field appearing in ForceSendFields will be sent to the
  870. // server regardless of whether the field is empty or not. This may be
  871. // used to include empty fields in Patch requests.
  872. ForceSendFields []string `json:"-"`
  873. // NullFields is a list of field names (e.g. "Request") to include in
  874. // API requests with the JSON null value. By default, fields with empty
  875. // values are omitted from API requests. However, any field with an
  876. // empty value appearing in NullFields will be sent to the server as
  877. // null. It is an error if a field in this list has a non-empty value.
  878. // This may be used to include null fields in Patch requests.
  879. NullFields []string `json:"-"`
  880. }
  881. func (s *OperationMetadataV1Beta2) MarshalJSON() ([]byte, error) {
  882. type NoMethod OperationMetadataV1Beta2
  883. raw := NoMethod(*s)
  884. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  885. }
  886. // Retry: Describes the retry policy in case of function's execution
  887. // failure.
  888. // A function execution will be retried on any failure.
  889. // A failed execution will be retried up to 7 days with an exponential
  890. // backoff
  891. // (capped at 10 seconds).
  892. // Retried execution is charged as any other execution.
  893. type Retry struct {
  894. }
  895. // SourceRepository: Describes the location of the function source in a
  896. // remote repository.
  897. type SourceRepository struct {
  898. // Branch: The name of the branch from which the function should be
  899. // fetched.
  900. Branch string `json:"branch,omitempty"`
  901. // DeployedRevision: Output only. The id of the revision that was
  902. // resolved at the moment of
  903. // function creation or update. For example when a user deployed from
  904. // a
  905. // branch, it will be the revision id of the latest change on this
  906. // branch at
  907. // that time. If user deployed from revision then this value will be
  908. // always
  909. // equal to the revision specified by the user.
  910. DeployedRevision string `json:"deployedRevision,omitempty"`
  911. // RepositoryUrl: URL to the hosted repository where the function is
  912. // defined. Only paths in
  913. // https://source.developers.google.com domain are supported. The path
  914. // should
  915. // contain the name of the repository.
  916. RepositoryUrl string `json:"repositoryUrl,omitempty"`
  917. // Revision: The id of the revision that captures the state of the
  918. // repository from
  919. // which the function should be fetched.
  920. Revision string `json:"revision,omitempty"`
  921. // SourcePath: The path within the repository where the function is
  922. // defined. The path
  923. // should point to the directory where Cloud Functions files are
  924. // located. Use
  925. // "/" if the function is defined directly in the root directory of
  926. // a
  927. // repository.
  928. SourcePath string `json:"sourcePath,omitempty"`
  929. // Tag: The name of the tag that captures the state of the repository
  930. // from
  931. // which the function should be fetched.
  932. Tag string `json:"tag,omitempty"`
  933. // ForceSendFields is a list of field names (e.g. "Branch") to
  934. // unconditionally include in API requests. By default, fields with
  935. // empty values are omitted from API requests. However, any non-pointer,
  936. // non-interface field appearing in ForceSendFields will be sent to the
  937. // server regardless of whether the field is empty or not. This may be
  938. // used to include empty fields in Patch requests.
  939. ForceSendFields []string `json:"-"`
  940. // NullFields is a list of field names (e.g. "Branch") to include in API
  941. // requests with the JSON null value. By default, fields with empty
  942. // values are omitted from API requests. However, any field with an
  943. // empty value appearing in NullFields will be sent to the server as
  944. // null. It is an error if a field in this list has a non-empty value.
  945. // This may be used to include null fields in Patch requests.
  946. NullFields []string `json:"-"`
  947. }
  948. func (s *SourceRepository) MarshalJSON() ([]byte, error) {
  949. type NoMethod SourceRepository
  950. raw := NoMethod(*s)
  951. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  952. }
  953. // Status: The `Status` type defines a logical error model that is
  954. // suitable for different
  955. // programming environments, including REST APIs and RPC APIs. It is
  956. // used by
  957. // [gRPC](https://github.com/grpc). The error model is designed to
  958. // be:
  959. //
  960. // - Simple to use and understand for most users
  961. // - Flexible enough to meet unexpected needs
  962. //
  963. // # Overview
  964. //
  965. // The `Status` message contains three pieces of data: error code, error
  966. // message,
  967. // and error details. The error code should be an enum value
  968. // of
  969. // google.rpc.Code, but it may accept additional error codes if needed.
  970. // The
  971. // error message should be a developer-facing English message that
  972. // helps
  973. // developers *understand* and *resolve* the error. If a localized
  974. // user-facing
  975. // error message is needed, put the localized message in the error
  976. // details or
  977. // localize it in the client. The optional error details may contain
  978. // arbitrary
  979. // information about the error. There is a predefined set of error
  980. // detail types
  981. // in the package `google.rpc` that can be used for common error
  982. // conditions.
  983. //
  984. // # Language mapping
  985. //
  986. // The `Status` message is the logical representation of the error
  987. // model, but it
  988. // is not necessarily the actual wire format. When the `Status` message
  989. // is
  990. // exposed in different client libraries and different wire protocols,
  991. // it can be
  992. // mapped differently. For example, it will likely be mapped to some
  993. // exceptions
  994. // in Java, but more likely mapped to some error codes in C.
  995. //
  996. // # Other uses
  997. //
  998. // The error model and the `Status` message can be used in a variety
  999. // of
  1000. // environments, either with or without APIs, to provide a
  1001. // consistent developer experience across different
  1002. // environments.
  1003. //
  1004. // Example uses of this error model include:
  1005. //
  1006. // - Partial errors. If a service needs to return partial errors to the
  1007. // client,
  1008. // it may embed the `Status` in the normal response to indicate the
  1009. // partial
  1010. // errors.
  1011. //
  1012. // - Workflow errors. A typical workflow has multiple steps. Each step
  1013. // may
  1014. // have a `Status` message for error reporting.
  1015. //
  1016. // - Batch operations. If a client uses batch request and batch
  1017. // response, the
  1018. // `Status` message should be used directly inside batch response,
  1019. // one for
  1020. // each error sub-response.
  1021. //
  1022. // - Asynchronous operations. If an API call embeds asynchronous
  1023. // operation
  1024. // results in its response, the status of those operations should
  1025. // be
  1026. // represented directly using the `Status` message.
  1027. //
  1028. // - Logging. If some API errors are stored in logs, the message
  1029. // `Status` could
  1030. // be used directly after any stripping needed for security/privacy
  1031. // reasons.
  1032. type Status struct {
  1033. // Code: The status code, which should be an enum value of
  1034. // google.rpc.Code.
  1035. Code int64 `json:"code,omitempty"`
  1036. // Details: A list of messages that carry the error details. There is a
  1037. // common set of
  1038. // message types for APIs to use.
  1039. Details []googleapi.RawMessage `json:"details,omitempty"`
  1040. // Message: A developer-facing error message, which should be in
  1041. // English. Any
  1042. // user-facing error message should be localized and sent in
  1043. // the
  1044. // google.rpc.Status.details field, or localized by the client.
  1045. Message string `json:"message,omitempty"`
  1046. // ForceSendFields is a list of field names (e.g. "Code") to
  1047. // unconditionally include in API requests. By default, fields with
  1048. // empty values are omitted from API requests. However, any non-pointer,
  1049. // non-interface field appearing in ForceSendFields will be sent to the
  1050. // server regardless of whether the field is empty or not. This may be
  1051. // used to include empty fields in Patch requests.
  1052. ForceSendFields []string `json:"-"`
  1053. // NullFields is a list of field names (e.g. "Code") to include in API
  1054. // requests with the JSON null value. By default, fields with empty
  1055. // values are omitted from API requests. However, any field with an
  1056. // empty value appearing in NullFields will be sent to the server as
  1057. // null. It is an error if a field in this list has a non-empty value.
  1058. // This may be used to include null fields in Patch requests.
  1059. NullFields []string `json:"-"`
  1060. }
  1061. func (s *Status) MarshalJSON() ([]byte, error) {
  1062. type NoMethod Status
  1063. raw := NoMethod(*s)
  1064. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1065. }
  1066. // method id "cloudfunctions.operations.get":
  1067. type OperationsGetCall struct {
  1068. s *Service
  1069. name string
  1070. urlParams_ gensupport.URLParams
  1071. ifNoneMatch_ string
  1072. ctx_ context.Context
  1073. header_ http.Header
  1074. }
  1075. // Get: Gets the latest state of a long-running operation. Clients can
  1076. // use this
  1077. // method to poll the operation result at intervals as recommended by
  1078. // the API
  1079. // service.
  1080. func (r *OperationsService) Get(name string) *OperationsGetCall {
  1081. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1082. c.name = name
  1083. return c
  1084. }
  1085. // Fields allows partial responses to be retrieved. See
  1086. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1087. // for more information.
  1088. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  1089. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1090. return c
  1091. }
  1092. // IfNoneMatch sets the optional parameter which makes the operation
  1093. // fail if the object's ETag matches the given value. This is useful for
  1094. // getting updates only after the object has changed since the last
  1095. // request. Use googleapi.IsNotModified to check whether the response
  1096. // error from Do is the result of In-None-Match.
  1097. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  1098. c.ifNoneMatch_ = entityTag
  1099. return c
  1100. }
  1101. // Context sets the context to be used in this call's Do method. Any
  1102. // pending HTTP request will be aborted if the provided context is
  1103. // canceled.
  1104. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  1105. c.ctx_ = ctx
  1106. return c
  1107. }
  1108. // Header returns an http.Header that can be modified by the caller to
  1109. // add HTTP headers to the request.
  1110. func (c *OperationsGetCall) Header() http.Header {
  1111. if c.header_ == nil {
  1112. c.header_ = make(http.Header)
  1113. }
  1114. return c.header_
  1115. }
  1116. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  1117. reqHeaders := make(http.Header)
  1118. for k, v := range c.header_ {
  1119. reqHeaders[k] = v
  1120. }
  1121. reqHeaders.Set("User-Agent", c.s.userAgent())
  1122. if c.ifNoneMatch_ != "" {
  1123. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1124. }
  1125. var body io.Reader = nil
  1126. c.urlParams_.Set("alt", alt)
  1127. c.urlParams_.Set("prettyPrint", "false")
  1128. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  1129. urls += "?" + c.urlParams_.Encode()
  1130. req, err := http.NewRequest("GET", urls, body)
  1131. if err != nil {
  1132. return nil, err
  1133. }
  1134. req.Header = reqHeaders
  1135. googleapi.Expand(req.URL, map[string]string{
  1136. "name": c.name,
  1137. })
  1138. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1139. }
  1140. // Do executes the "cloudfunctions.operations.get" call.
  1141. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1142. // status code is an error. Response headers are in either
  1143. // *Operation.ServerResponse.Header or (if a response was returned at
  1144. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1145. // to check whether the returned error was because
  1146. // http.StatusNotModified was returned.
  1147. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1148. gensupport.SetOptions(c.urlParams_, opts...)
  1149. res, err := c.doRequest("json")
  1150. if res != nil && res.StatusCode == http.StatusNotModified {
  1151. if res.Body != nil {
  1152. res.Body.Close()
  1153. }
  1154. return nil, &googleapi.Error{
  1155. Code: res.StatusCode,
  1156. Header: res.Header,
  1157. }
  1158. }
  1159. if err != nil {
  1160. return nil, err
  1161. }
  1162. defer googleapi.CloseBody(res)
  1163. if err := googleapi.CheckResponse(res); err != nil {
  1164. return nil, err
  1165. }
  1166. ret := &Operation{
  1167. ServerResponse: googleapi.ServerResponse{
  1168. Header: res.Header,
  1169. HTTPStatusCode: res.StatusCode,
  1170. },
  1171. }
  1172. target := &ret
  1173. if err := gensupport.DecodeResponse(target, res); err != nil {
  1174. return nil, err
  1175. }
  1176. return ret, nil
  1177. // {
  1178. // "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.",
  1179. // "flatPath": "v1beta2/operations/{operationsId}",
  1180. // "httpMethod": "GET",
  1181. // "id": "cloudfunctions.operations.get",
  1182. // "parameterOrder": [
  1183. // "name"
  1184. // ],
  1185. // "parameters": {
  1186. // "name": {
  1187. // "description": "The name of the operation resource.",
  1188. // "location": "path",
  1189. // "pattern": "^operations/[^/]+$",
  1190. // "required": true,
  1191. // "type": "string"
  1192. // }
  1193. // },
  1194. // "path": "v1beta2/{+name}",
  1195. // "response": {
  1196. // "$ref": "Operation"
  1197. // },
  1198. // "scopes": [
  1199. // "https://www.googleapis.com/auth/cloud-platform"
  1200. // ]
  1201. // }
  1202. }
  1203. // method id "cloudfunctions.operations.list":
  1204. type OperationsListCall struct {
  1205. s *Service
  1206. urlParams_ gensupport.URLParams
  1207. ifNoneMatch_ string
  1208. ctx_ context.Context
  1209. header_ http.Header
  1210. }
  1211. // List: Lists operations that match the specified filter in the
  1212. // request. If the
  1213. // server doesn't support this method, it returns
  1214. // `UNIMPLEMENTED`.
  1215. //
  1216. // NOTE: the `name` binding allows API services to override the
  1217. // binding
  1218. // to use different resource name schemes, such as `users/*/operations`.
  1219. // To
  1220. // override the binding, API services can add a binding such
  1221. // as
  1222. // "/v1/{name=users/*}/operations" to their service configuration.
  1223. // For backwards compatibility, the default name includes the
  1224. // operations
  1225. // collection id, however overriding users must ensure the name
  1226. // binding
  1227. // is the parent resource, without the operations collection id.
  1228. func (r *OperationsService) List() *OperationsListCall {
  1229. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1230. return c
  1231. }
  1232. // Filter sets the optional parameter "filter": Required. A filter for
  1233. // matching the requested operations.<br><br> The supported formats of
  1234. // <b>filter</b> are:<br> To query for specific function:
  1235. // <code>project:*,location:*,function:*</code><br> To query for all of
  1236. // the latest operations for a project:
  1237. // <code>project:*,latest:true</code>
  1238. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  1239. c.urlParams_.Set("filter", filter)
  1240. return c
  1241. }
  1242. // Name sets the optional parameter "name": Must not be set.
  1243. func (c *OperationsListCall) Name(name string) *OperationsListCall {
  1244. c.urlParams_.Set("name", name)
  1245. return c
  1246. }
  1247. // PageSize sets the optional parameter "pageSize": The standard list
  1248. // page size.
  1249. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  1250. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1251. return c
  1252. }
  1253. // PageToken sets the optional parameter "pageToken": The standard list
  1254. // page token.
  1255. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  1256. c.urlParams_.Set("pageToken", pageToken)
  1257. return c
  1258. }
  1259. // Fields allows partial responses to be retrieved. See
  1260. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1261. // for more information.
  1262. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  1263. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1264. return c
  1265. }
  1266. // IfNoneMatch sets the optional parameter which makes the operation
  1267. // fail if the object's ETag matches the given value. This is useful for
  1268. // getting updates only after the object has changed since the last
  1269. // request. Use googleapi.IsNotModified to check whether the response
  1270. // error from Do is the result of In-None-Match.
  1271. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  1272. c.ifNoneMatch_ = entityTag
  1273. return c
  1274. }
  1275. // Context sets the context to be used in this call's Do method. Any
  1276. // pending HTTP request will be aborted if the provided context is
  1277. // canceled.
  1278. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  1279. c.ctx_ = ctx
  1280. return c
  1281. }
  1282. // Header returns an http.Header that can be modified by the caller to
  1283. // add HTTP headers to the request.
  1284. func (c *OperationsListCall) Header() http.Header {
  1285. if c.header_ == nil {
  1286. c.header_ = make(http.Header)
  1287. }
  1288. return c.header_
  1289. }
  1290. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  1291. reqHeaders := make(http.Header)
  1292. for k, v := range c.header_ {
  1293. reqHeaders[k] = v
  1294. }
  1295. reqHeaders.Set("User-Agent", c.s.userAgent())
  1296. if c.ifNoneMatch_ != "" {
  1297. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1298. }
  1299. var body io.Reader = nil
  1300. c.urlParams_.Set("alt", alt)
  1301. c.urlParams_.Set("prettyPrint", "false")
  1302. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/operations")
  1303. urls += "?" + c.urlParams_.Encode()
  1304. req, err := http.NewRequest("GET", urls, body)
  1305. if err != nil {
  1306. return nil, err
  1307. }
  1308. req.Header = reqHeaders
  1309. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1310. }
  1311. // Do executes the "cloudfunctions.operations.list" call.
  1312. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  1313. // non-2xx status code is an error. Response headers are in either
  1314. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  1315. // returned at all) in error.(*googleapi.Error).Header. Use
  1316. // googleapi.IsNotModified to check whether the returned error was
  1317. // because http.StatusNotModified was returned.
  1318. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  1319. gensupport.SetOptions(c.urlParams_, opts...)
  1320. res, err := c.doRequest("json")
  1321. if res != nil && res.StatusCode == http.StatusNotModified {
  1322. if res.Body != nil {
  1323. res.Body.Close()
  1324. }
  1325. return nil, &googleapi.Error{
  1326. Code: res.StatusCode,
  1327. Header: res.Header,
  1328. }
  1329. }
  1330. if err != nil {
  1331. return nil, err
  1332. }
  1333. defer googleapi.CloseBody(res)
  1334. if err := googleapi.CheckResponse(res); err != nil {
  1335. return nil, err
  1336. }
  1337. ret := &ListOperationsResponse{
  1338. ServerResponse: googleapi.ServerResponse{
  1339. Header: res.Header,
  1340. HTTPStatusCode: res.StatusCode,
  1341. },
  1342. }
  1343. target := &ret
  1344. if err := gensupport.DecodeResponse(target, res); err != nil {
  1345. return nil, err
  1346. }
  1347. return ret, nil
  1348. // {
  1349. // "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.",
  1350. // "flatPath": "v1beta2/operations",
  1351. // "httpMethod": "GET",
  1352. // "id": "cloudfunctions.operations.list",
  1353. // "parameterOrder": [],
  1354. // "parameters": {
  1355. // "filter": {
  1356. // "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",
  1357. // "location": "query",
  1358. // "type": "string"
  1359. // },
  1360. // "name": {
  1361. // "description": "Must not be set.",
  1362. // "location": "query",
  1363. // "type": "string"
  1364. // },
  1365. // "pageSize": {
  1366. // "description": "The standard list page size.",
  1367. // "format": "int32",
  1368. // "location": "query",
  1369. // "type": "integer"
  1370. // },
  1371. // "pageToken": {
  1372. // "description": "The standard list page token.",
  1373. // "location": "query",
  1374. // "type": "string"
  1375. // }
  1376. // },
  1377. // "path": "v1beta2/operations",
  1378. // "response": {
  1379. // "$ref": "ListOperationsResponse"
  1380. // },
  1381. // "scopes": [
  1382. // "https://www.googleapis.com/auth/cloud-platform"
  1383. // ]
  1384. // }
  1385. }
  1386. // Pages invokes f for each page of results.
  1387. // A non-nil error returned from f will halt the iteration.
  1388. // The provided context supersedes any context provided to the Context method.
  1389. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  1390. c.ctx_ = ctx
  1391. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1392. for {
  1393. x, err := c.Do()
  1394. if err != nil {
  1395. return err
  1396. }
  1397. if err := f(x); err != nil {
  1398. return err
  1399. }
  1400. if x.NextPageToken == "" {
  1401. return nil
  1402. }
  1403. c.PageToken(x.NextPageToken)
  1404. }
  1405. }
  1406. // method id "cloudfunctions.projects.locations.list":
  1407. type ProjectsLocationsListCall struct {
  1408. s *Service
  1409. name string
  1410. urlParams_ gensupport.URLParams
  1411. ifNoneMatch_ string
  1412. ctx_ context.Context
  1413. header_ http.Header
  1414. }
  1415. // List: Lists information about the supported locations for this
  1416. // service.
  1417. func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
  1418. c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1419. c.name = name
  1420. return c
  1421. }
  1422. // Filter sets the optional parameter "filter": The standard list
  1423. // filter.
  1424. func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
  1425. c.urlParams_.Set("filter", filter)
  1426. return c
  1427. }
  1428. // PageSize sets the optional parameter "pageSize": The standard list
  1429. // page size.
  1430. func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
  1431. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1432. return c
  1433. }
  1434. // PageToken sets the optional parameter "pageToken": The standard list
  1435. // page token.
  1436. func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
  1437. c.urlParams_.Set("pageToken", pageToken)
  1438. return c
  1439. }
  1440. // Fields allows partial responses to be retrieved. See
  1441. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1442. // for more information.
  1443. func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
  1444. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1445. return c
  1446. }
  1447. // IfNoneMatch sets the optional parameter which makes the operation
  1448. // fail if the object's ETag matches the given value. This is useful for
  1449. // getting updates only after the object has changed since the last
  1450. // request. Use googleapi.IsNotModified to check whether the response
  1451. // error from Do is the result of In-None-Match.
  1452. func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
  1453. c.ifNoneMatch_ = entityTag
  1454. return c
  1455. }
  1456. // Context sets the context to be used in this call's Do method. Any
  1457. // pending HTTP request will be aborted if the provided context is
  1458. // canceled.
  1459. func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
  1460. c.ctx_ = ctx
  1461. return c
  1462. }
  1463. // Header returns an http.Header that can be modified by the caller to
  1464. // add HTTP headers to the request.
  1465. func (c *ProjectsLocationsListCall) Header() http.Header {
  1466. if c.header_ == nil {
  1467. c.header_ = make(http.Header)
  1468. }
  1469. return c.header_
  1470. }
  1471. func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
  1472. reqHeaders := make(http.Header)
  1473. for k, v := range c.header_ {
  1474. reqHeaders[k] = v
  1475. }
  1476. reqHeaders.Set("User-Agent", c.s.userAgent())
  1477. if c.ifNoneMatch_ != "" {
  1478. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1479. }
  1480. var body io.Reader = nil
  1481. c.urlParams_.Set("alt", alt)
  1482. c.urlParams_.Set("prettyPrint", "false")
  1483. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}/locations")
  1484. urls += "?" + c.urlParams_.Encode()
  1485. req, err := http.NewRequest("GET", urls, body)
  1486. if err != nil {
  1487. return nil, err
  1488. }
  1489. req.Header = reqHeaders
  1490. googleapi.Expand(req.URL, map[string]string{
  1491. "name": c.name,
  1492. })
  1493. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1494. }
  1495. // Do executes the "cloudfunctions.projects.locations.list" call.
  1496. // Exactly one of *ListLocationsResponse or error will be non-nil. Any
  1497. // non-2xx status code is an error. Response headers are in either
  1498. // *ListLocationsResponse.ServerResponse.Header or (if a response was
  1499. // returned at all) in error.(*googleapi.Error).Header. Use
  1500. // googleapi.IsNotModified to check whether the returned error was
  1501. // because http.StatusNotModified was returned.
  1502. func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
  1503. gensupport.SetOptions(c.urlParams_, opts...)
  1504. res, err := c.doRequest("json")
  1505. if res != nil && res.StatusCode == http.StatusNotModified {
  1506. if res.Body != nil {
  1507. res.Body.Close()
  1508. }
  1509. return nil, &googleapi.Error{
  1510. Code: res.StatusCode,
  1511. Header: res.Header,
  1512. }
  1513. }
  1514. if err != nil {
  1515. return nil, err
  1516. }
  1517. defer googleapi.CloseBody(res)
  1518. if err := googleapi.CheckResponse(res); err != nil {
  1519. return nil, err
  1520. }
  1521. ret := &ListLocationsResponse{
  1522. ServerResponse: googleapi.ServerResponse{
  1523. Header: res.Header,
  1524. HTTPStatusCode: res.StatusCode,
  1525. },
  1526. }
  1527. target := &ret
  1528. if err := gensupport.DecodeResponse(target, res); err != nil {
  1529. return nil, err
  1530. }
  1531. return ret, nil
  1532. // {
  1533. // "description": "Lists information about the supported locations for this service.",
  1534. // "flatPath": "v1beta2/projects/{projectsId}/locations",
  1535. // "httpMethod": "GET",
  1536. // "id": "cloudfunctions.projects.locations.list",
  1537. // "parameterOrder": [
  1538. // "name"
  1539. // ],
  1540. // "parameters": {
  1541. // "filter": {
  1542. // "description": "The standard list filter.",
  1543. // "location": "query",
  1544. // "type": "string"
  1545. // },
  1546. // "name": {
  1547. // "description": "The resource that owns the locations collection, if applicable.",
  1548. // "location": "path",
  1549. // "pattern": "^projects/[^/]+$",
  1550. // "required": true,
  1551. // "type": "string"
  1552. // },
  1553. // "pageSize": {
  1554. // "description": "The standard list page size.",
  1555. // "format": "int32",
  1556. // "location": "query",
  1557. // "type": "integer"
  1558. // },
  1559. // "pageToken": {
  1560. // "description": "The standard list page token.",
  1561. // "location": "query",
  1562. // "type": "string"
  1563. // }
  1564. // },
  1565. // "path": "v1beta2/{+name}/locations",
  1566. // "response": {
  1567. // "$ref": "ListLocationsResponse"
  1568. // },
  1569. // "scopes": [
  1570. // "https://www.googleapis.com/auth/cloud-platform"
  1571. // ]
  1572. // }
  1573. }
  1574. // Pages invokes f for each page of results.
  1575. // A non-nil error returned from f will halt the iteration.
  1576. // The provided context supersedes any context provided to the Context method.
  1577. func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
  1578. c.ctx_ = ctx
  1579. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1580. for {
  1581. x, err := c.Do()
  1582. if err != nil {
  1583. return err
  1584. }
  1585. if err := f(x); err != nil {
  1586. return err
  1587. }
  1588. if x.NextPageToken == "" {
  1589. return nil
  1590. }
  1591. c.PageToken(x.NextPageToken)
  1592. }
  1593. }
  1594. // method id "cloudfunctions.projects.locations.functions.call":
  1595. type ProjectsLocationsFunctionsCallCall struct {
  1596. s *Service
  1597. name string
  1598. callfunctionrequest *CallFunctionRequest
  1599. urlParams_ gensupport.URLParams
  1600. ctx_ context.Context
  1601. header_ http.Header
  1602. }
  1603. // Call: Synchronously invokes a deployed Cloud Function. To be used for
  1604. // testing
  1605. // purposes as very limited traffic is allowed. For more information
  1606. // on
  1607. // the actual limits refer to [API
  1608. // Calls](
  1609. // https://cloud.google.com/functions/quotas#rate_limits).
  1610. func (r *ProjectsLocationsFunctionsService) Call(name string, callfunctionrequest *CallFunctionRequest) *ProjectsLocationsFunctionsCallCall {
  1611. c := &ProjectsLocationsFunctionsCallCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1612. c.name = name
  1613. c.callfunctionrequest = callfunctionrequest
  1614. return c
  1615. }
  1616. // Fields allows partial responses to be retrieved. See
  1617. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1618. // for more information.
  1619. func (c *ProjectsLocationsFunctionsCallCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCallCall {
  1620. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1621. return c
  1622. }
  1623. // Context sets the context to be used in this call's Do method. Any
  1624. // pending HTTP request will be aborted if the provided context is
  1625. // canceled.
  1626. func (c *ProjectsLocationsFunctionsCallCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCallCall {
  1627. c.ctx_ = ctx
  1628. return c
  1629. }
  1630. // Header returns an http.Header that can be modified by the caller to
  1631. // add HTTP headers to the request.
  1632. func (c *ProjectsLocationsFunctionsCallCall) Header() http.Header {
  1633. if c.header_ == nil {
  1634. c.header_ = make(http.Header)
  1635. }
  1636. return c.header_
  1637. }
  1638. func (c *ProjectsLocationsFunctionsCallCall) doRequest(alt string) (*http.Response, error) {
  1639. reqHeaders := make(http.Header)
  1640. for k, v := range c.header_ {
  1641. reqHeaders[k] = v
  1642. }
  1643. reqHeaders.Set("User-Agent", c.s.userAgent())
  1644. var body io.Reader = nil
  1645. body, err := googleapi.WithoutDataWrapper.JSONReader(c.callfunctionrequest)
  1646. if err != nil {
  1647. return nil, err
  1648. }
  1649. reqHeaders.Set("Content-Type", "application/json")
  1650. c.urlParams_.Set("alt", alt)
  1651. c.urlParams_.Set("prettyPrint", "false")
  1652. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}:call")
  1653. urls += "?" + c.urlParams_.Encode()
  1654. req, err := http.NewRequest("POST", urls, body)
  1655. if err != nil {
  1656. return nil, err
  1657. }
  1658. req.Header = reqHeaders
  1659. googleapi.Expand(req.URL, map[string]string{
  1660. "name": c.name,
  1661. })
  1662. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1663. }
  1664. // Do executes the "cloudfunctions.projects.locations.functions.call" call.
  1665. // Exactly one of *CallFunctionResponse or error will be non-nil. Any
  1666. // non-2xx status code is an error. Response headers are in either
  1667. // *CallFunctionResponse.ServerResponse.Header or (if a response was
  1668. // returned at all) in error.(*googleapi.Error).Header. Use
  1669. // googleapi.IsNotModified to check whether the returned error was
  1670. // because http.StatusNotModified was returned.
  1671. func (c *ProjectsLocationsFunctionsCallCall) Do(opts ...googleapi.CallOption) (*CallFunctionResponse, error) {
  1672. gensupport.SetOptions(c.urlParams_, opts...)
  1673. res, err := c.doRequest("json")
  1674. if res != nil && res.StatusCode == http.StatusNotModified {
  1675. if res.Body != nil {
  1676. res.Body.Close()
  1677. }
  1678. return nil, &googleapi.Error{
  1679. Code: res.StatusCode,
  1680. Header: res.Header,
  1681. }
  1682. }
  1683. if err != nil {
  1684. return nil, err
  1685. }
  1686. defer googleapi.CloseBody(res)
  1687. if err := googleapi.CheckResponse(res); err != nil {
  1688. return nil, err
  1689. }
  1690. ret := &CallFunctionResponse{
  1691. ServerResponse: googleapi.ServerResponse{
  1692. Header: res.Header,
  1693. HTTPStatusCode: res.StatusCode,
  1694. },
  1695. }
  1696. target := &ret
  1697. if err := gensupport.DecodeResponse(target, res); err != nil {
  1698. return nil, err
  1699. }
  1700. return ret, nil
  1701. // {
  1702. // "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 [API Calls](\nhttps://cloud.google.com/functions/quotas#rate_limits).",
  1703. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:call",
  1704. // "httpMethod": "POST",
  1705. // "id": "cloudfunctions.projects.locations.functions.call",
  1706. // "parameterOrder": [
  1707. // "name"
  1708. // ],
  1709. // "parameters": {
  1710. // "name": {
  1711. // "description": "The name of the function to be called.",
  1712. // "location": "path",
  1713. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  1714. // "required": true,
  1715. // "type": "string"
  1716. // }
  1717. // },
  1718. // "path": "v1beta2/{+name}:call",
  1719. // "request": {
  1720. // "$ref": "CallFunctionRequest"
  1721. // },
  1722. // "response": {
  1723. // "$ref": "CallFunctionResponse"
  1724. // },
  1725. // "scopes": [
  1726. // "https://www.googleapis.com/auth/cloud-platform"
  1727. // ]
  1728. // }
  1729. }
  1730. // method id "cloudfunctions.projects.locations.functions.create":
  1731. type ProjectsLocationsFunctionsCreateCall struct {
  1732. s *Service
  1733. location string
  1734. cloudfunction *CloudFunction
  1735. urlParams_ gensupport.URLParams
  1736. ctx_ context.Context
  1737. header_ http.Header
  1738. }
  1739. // Create: Creates a new function. If a function with the given name
  1740. // already exists in
  1741. // the specified project, the long running operation will
  1742. // return
  1743. // `ALREADY_EXISTS` error.
  1744. func (r *ProjectsLocationsFunctionsService) Create(location string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsCreateCall {
  1745. c := &ProjectsLocationsFunctionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1746. c.location = location
  1747. c.cloudfunction = cloudfunction
  1748. return c
  1749. }
  1750. // Fields allows partial responses to be retrieved. See
  1751. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1752. // for more information.
  1753. func (c *ProjectsLocationsFunctionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCreateCall {
  1754. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1755. return c
  1756. }
  1757. // Context sets the context to be used in this call's Do method. Any
  1758. // pending HTTP request will be aborted if the provided context is
  1759. // canceled.
  1760. func (c *ProjectsLocationsFunctionsCreateCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCreateCall {
  1761. c.ctx_ = ctx
  1762. return c
  1763. }
  1764. // Header returns an http.Header that can be modified by the caller to
  1765. // add HTTP headers to the request.
  1766. func (c *ProjectsLocationsFunctionsCreateCall) Header() http.Header {
  1767. if c.header_ == nil {
  1768. c.header_ = make(http.Header)
  1769. }
  1770. return c.header_
  1771. }
  1772. func (c *ProjectsLocationsFunctionsCreateCall) doRequest(alt string) (*http.Response, error) {
  1773. reqHeaders := make(http.Header)
  1774. for k, v := range c.header_ {
  1775. reqHeaders[k] = v
  1776. }
  1777. reqHeaders.Set("User-Agent", c.s.userAgent())
  1778. var body io.Reader = nil
  1779. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction)
  1780. if err != nil {
  1781. return nil, err
  1782. }
  1783. reqHeaders.Set("Content-Type", "application/json")
  1784. c.urlParams_.Set("alt", alt)
  1785. c.urlParams_.Set("prettyPrint", "false")
  1786. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+location}/functions")
  1787. urls += "?" + c.urlParams_.Encode()
  1788. req, err := http.NewRequest("POST", urls, body)
  1789. if err != nil {
  1790. return nil, err
  1791. }
  1792. req.Header = reqHeaders
  1793. googleapi.Expand(req.URL, map[string]string{
  1794. "location": c.location,
  1795. })
  1796. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1797. }
  1798. // Do executes the "cloudfunctions.projects.locations.functions.create" call.
  1799. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1800. // status code is an error. Response headers are in either
  1801. // *Operation.ServerResponse.Header or (if a response was returned at
  1802. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1803. // to check whether the returned error was because
  1804. // http.StatusNotModified was returned.
  1805. func (c *ProjectsLocationsFunctionsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1806. gensupport.SetOptions(c.urlParams_, opts...)
  1807. res, err := c.doRequest("json")
  1808. if res != nil && res.StatusCode == http.StatusNotModified {
  1809. if res.Body != nil {
  1810. res.Body.Close()
  1811. }
  1812. return nil, &googleapi.Error{
  1813. Code: res.StatusCode,
  1814. Header: res.Header,
  1815. }
  1816. }
  1817. if err != nil {
  1818. return nil, err
  1819. }
  1820. defer googleapi.CloseBody(res)
  1821. if err := googleapi.CheckResponse(res); err != nil {
  1822. return nil, err
  1823. }
  1824. ret := &Operation{
  1825. ServerResponse: googleapi.ServerResponse{
  1826. Header: res.Header,
  1827. HTTPStatusCode: res.StatusCode,
  1828. },
  1829. }
  1830. target := &ret
  1831. if err := gensupport.DecodeResponse(target, res); err != nil {
  1832. return nil, err
  1833. }
  1834. return ret, nil
  1835. // {
  1836. // "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.",
  1837. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions",
  1838. // "httpMethod": "POST",
  1839. // "id": "cloudfunctions.projects.locations.functions.create",
  1840. // "parameterOrder": [
  1841. // "location"
  1842. // ],
  1843. // "parameters": {
  1844. // "location": {
  1845. // "description": "The project and location in which the function should be created, specified\nin the format `projects/*/locations/*`",
  1846. // "location": "path",
  1847. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1848. // "required": true,
  1849. // "type": "string"
  1850. // }
  1851. // },
  1852. // "path": "v1beta2/{+location}/functions",
  1853. // "request": {
  1854. // "$ref": "CloudFunction"
  1855. // },
  1856. // "response": {
  1857. // "$ref": "Operation"
  1858. // },
  1859. // "scopes": [
  1860. // "https://www.googleapis.com/auth/cloud-platform"
  1861. // ]
  1862. // }
  1863. }
  1864. // method id "cloudfunctions.projects.locations.functions.delete":
  1865. type ProjectsLocationsFunctionsDeleteCall struct {
  1866. s *Service
  1867. name string
  1868. urlParams_ gensupport.URLParams
  1869. ctx_ context.Context
  1870. header_ http.Header
  1871. }
  1872. // Delete: Deletes a function with the given name from the specified
  1873. // project. If the
  1874. // given function is used by some trigger, the trigger will be updated
  1875. // to
  1876. // remove this function.
  1877. func (r *ProjectsLocationsFunctionsService) Delete(name string) *ProjectsLocationsFunctionsDeleteCall {
  1878. c := &ProjectsLocationsFunctionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1879. c.name = name
  1880. return c
  1881. }
  1882. // Fields allows partial responses to be retrieved. See
  1883. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1884. // for more information.
  1885. func (c *ProjectsLocationsFunctionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsDeleteCall {
  1886. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1887. return c
  1888. }
  1889. // Context sets the context to be used in this call's Do method. Any
  1890. // pending HTTP request will be aborted if the provided context is
  1891. // canceled.
  1892. func (c *ProjectsLocationsFunctionsDeleteCall) Context(ctx context.Context) *ProjectsLocationsFunctionsDeleteCall {
  1893. c.ctx_ = ctx
  1894. return c
  1895. }
  1896. // Header returns an http.Header that can be modified by the caller to
  1897. // add HTTP headers to the request.
  1898. func (c *ProjectsLocationsFunctionsDeleteCall) Header() http.Header {
  1899. if c.header_ == nil {
  1900. c.header_ = make(http.Header)
  1901. }
  1902. return c.header_
  1903. }
  1904. func (c *ProjectsLocationsFunctionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1905. reqHeaders := make(http.Header)
  1906. for k, v := range c.header_ {
  1907. reqHeaders[k] = v
  1908. }
  1909. reqHeaders.Set("User-Agent", c.s.userAgent())
  1910. var body io.Reader = nil
  1911. c.urlParams_.Set("alt", alt)
  1912. c.urlParams_.Set("prettyPrint", "false")
  1913. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  1914. urls += "?" + c.urlParams_.Encode()
  1915. req, err := http.NewRequest("DELETE", urls, body)
  1916. if err != nil {
  1917. return nil, err
  1918. }
  1919. req.Header = reqHeaders
  1920. googleapi.Expand(req.URL, map[string]string{
  1921. "name": c.name,
  1922. })
  1923. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1924. }
  1925. // Do executes the "cloudfunctions.projects.locations.functions.delete" call.
  1926. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1927. // status code is an error. Response headers are in either
  1928. // *Operation.ServerResponse.Header or (if a response was returned at
  1929. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1930. // to check whether the returned error was because
  1931. // http.StatusNotModified was returned.
  1932. func (c *ProjectsLocationsFunctionsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1933. gensupport.SetOptions(c.urlParams_, opts...)
  1934. res, err := c.doRequest("json")
  1935. if res != nil && res.StatusCode == http.StatusNotModified {
  1936. if res.Body != nil {
  1937. res.Body.Close()
  1938. }
  1939. return nil, &googleapi.Error{
  1940. Code: res.StatusCode,
  1941. Header: res.Header,
  1942. }
  1943. }
  1944. if err != nil {
  1945. return nil, err
  1946. }
  1947. defer googleapi.CloseBody(res)
  1948. if err := googleapi.CheckResponse(res); err != nil {
  1949. return nil, err
  1950. }
  1951. ret := &Operation{
  1952. ServerResponse: googleapi.ServerResponse{
  1953. Header: res.Header,
  1954. HTTPStatusCode: res.StatusCode,
  1955. },
  1956. }
  1957. target := &ret
  1958. if err := gensupport.DecodeResponse(target, res); err != nil {
  1959. return nil, err
  1960. }
  1961. return ret, nil
  1962. // {
  1963. // "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.",
  1964. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  1965. // "httpMethod": "DELETE",
  1966. // "id": "cloudfunctions.projects.locations.functions.delete",
  1967. // "parameterOrder": [
  1968. // "name"
  1969. // ],
  1970. // "parameters": {
  1971. // "name": {
  1972. // "description": "The name of the function which should be deleted.",
  1973. // "location": "path",
  1974. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  1975. // "required": true,
  1976. // "type": "string"
  1977. // }
  1978. // },
  1979. // "path": "v1beta2/{+name}",
  1980. // "response": {
  1981. // "$ref": "Operation"
  1982. // },
  1983. // "scopes": [
  1984. // "https://www.googleapis.com/auth/cloud-platform"
  1985. // ]
  1986. // }
  1987. }
  1988. // method id "cloudfunctions.projects.locations.functions.generateDownloadUrl":
  1989. type ProjectsLocationsFunctionsGenerateDownloadUrlCall struct {
  1990. s *Service
  1991. name string
  1992. generatedownloadurlrequest *GenerateDownloadUrlRequest
  1993. urlParams_ gensupport.URLParams
  1994. ctx_ context.Context
  1995. header_ http.Header
  1996. }
  1997. // GenerateDownloadUrl: Returns a signed URL for downloading deployed
  1998. // function source code.
  1999. // The URL is only valid for a limited period and should be used
  2000. // within
  2001. // minutes after generation.
  2002. // For more information about the signed URL usage
  2003. // see:
  2004. // https://cloud.google.com/storage/docs/access-control/signed-urls
  2005. func (r *ProjectsLocationsFunctionsService) GenerateDownloadUrl(name string, generatedownloadurlrequest *GenerateDownloadUrlRequest) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2006. c := &ProjectsLocationsFunctionsGenerateDownloadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2007. c.name = name
  2008. c.generatedownloadurlrequest = generatedownloadurlrequest
  2009. return c
  2010. }
  2011. // Fields allows partial responses to be retrieved. See
  2012. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2013. // for more information.
  2014. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2015. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2016. return c
  2017. }
  2018. // Context sets the context to be used in this call's Do method. Any
  2019. // pending HTTP request will be aborted if the provided context is
  2020. // canceled.
  2021. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateDownloadUrlCall {
  2022. c.ctx_ = ctx
  2023. return c
  2024. }
  2025. // Header returns an http.Header that can be modified by the caller to
  2026. // add HTTP headers to the request.
  2027. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Header() http.Header {
  2028. if c.header_ == nil {
  2029. c.header_ = make(http.Header)
  2030. }
  2031. return c.header_
  2032. }
  2033. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) doRequest(alt string) (*http.Response, error) {
  2034. reqHeaders := make(http.Header)
  2035. for k, v := range c.header_ {
  2036. reqHeaders[k] = v
  2037. }
  2038. reqHeaders.Set("User-Agent", c.s.userAgent())
  2039. var body io.Reader = nil
  2040. body, err := googleapi.WithoutDataWrapper.JSONReader(c.generatedownloadurlrequest)
  2041. if err != nil {
  2042. return nil, err
  2043. }
  2044. reqHeaders.Set("Content-Type", "application/json")
  2045. c.urlParams_.Set("alt", alt)
  2046. c.urlParams_.Set("prettyPrint", "false")
  2047. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}:generateDownloadUrl")
  2048. urls += "?" + c.urlParams_.Encode()
  2049. req, err := http.NewRequest("POST", urls, body)
  2050. if err != nil {
  2051. return nil, err
  2052. }
  2053. req.Header = reqHeaders
  2054. googleapi.Expand(req.URL, map[string]string{
  2055. "name": c.name,
  2056. })
  2057. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2058. }
  2059. // Do executes the "cloudfunctions.projects.locations.functions.generateDownloadUrl" call.
  2060. // Exactly one of *GenerateDownloadUrlResponse or error will be non-nil.
  2061. // Any non-2xx status code is an error. Response headers are in either
  2062. // *GenerateDownloadUrlResponse.ServerResponse.Header or (if a response
  2063. // was returned at all) in error.(*googleapi.Error).Header. Use
  2064. // googleapi.IsNotModified to check whether the returned error was
  2065. // because http.StatusNotModified was returned.
  2066. func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateDownloadUrlResponse, error) {
  2067. gensupport.SetOptions(c.urlParams_, opts...)
  2068. res, err := c.doRequest("json")
  2069. if res != nil && res.StatusCode == http.StatusNotModified {
  2070. if res.Body != nil {
  2071. res.Body.Close()
  2072. }
  2073. return nil, &googleapi.Error{
  2074. Code: res.StatusCode,
  2075. Header: res.Header,
  2076. }
  2077. }
  2078. if err != nil {
  2079. return nil, err
  2080. }
  2081. defer googleapi.CloseBody(res)
  2082. if err := googleapi.CheckResponse(res); err != nil {
  2083. return nil, err
  2084. }
  2085. ret := &GenerateDownloadUrlResponse{
  2086. ServerResponse: googleapi.ServerResponse{
  2087. Header: res.Header,
  2088. HTTPStatusCode: res.StatusCode,
  2089. },
  2090. }
  2091. target := &ret
  2092. if err := gensupport.DecodeResponse(target, res); err != nil {
  2093. return nil, err
  2094. }
  2095. return ret, nil
  2096. // {
  2097. // "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",
  2098. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:generateDownloadUrl",
  2099. // "httpMethod": "POST",
  2100. // "id": "cloudfunctions.projects.locations.functions.generateDownloadUrl",
  2101. // "parameterOrder": [
  2102. // "name"
  2103. // ],
  2104. // "parameters": {
  2105. // "name": {
  2106. // "description": "The name of function for which source code Google Cloud Storage signed\nURL should be generated.",
  2107. // "location": "path",
  2108. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2109. // "required": true,
  2110. // "type": "string"
  2111. // }
  2112. // },
  2113. // "path": "v1beta2/{+name}:generateDownloadUrl",
  2114. // "request": {
  2115. // "$ref": "GenerateDownloadUrlRequest"
  2116. // },
  2117. // "response": {
  2118. // "$ref": "GenerateDownloadUrlResponse"
  2119. // },
  2120. // "scopes": [
  2121. // "https://www.googleapis.com/auth/cloud-platform"
  2122. // ]
  2123. // }
  2124. }
  2125. // method id "cloudfunctions.projects.locations.functions.generateUploadUrl":
  2126. type ProjectsLocationsFunctionsGenerateUploadUrlCall struct {
  2127. s *Service
  2128. parent string
  2129. generateuploadurlrequest *GenerateUploadUrlRequest
  2130. urlParams_ gensupport.URLParams
  2131. ctx_ context.Context
  2132. header_ http.Header
  2133. }
  2134. // GenerateUploadUrl: Returns a signed URL for uploading a function
  2135. // source code.
  2136. // For more information about the signed URL usage
  2137. // see:
  2138. // https://cloud.google.com/storage/docs/access-control/signed-urls
  2139. //
  2140. // Once the function source code upload is complete, the used signed
  2141. // URL should be provided in CreateFunction or UpdateFunction request
  2142. // as a reference to the function source code.
  2143. //
  2144. // When uploading source code to the generated signed URL, please
  2145. // follow
  2146. // these restrictions:
  2147. //
  2148. // * Source file type should be a zip file.
  2149. // * Source file size should not exceed 100MB limit.
  2150. // * No credentials should be attached - the signed URLs provide access
  2151. // to the
  2152. // target bucket using internal service identity; if credentials were
  2153. // attached, the identity from the credentials would be used, but
  2154. // that
  2155. // identity does not have permissions to upload files to the
  2156. // URL.
  2157. //
  2158. // When making a HTTP PUT request, these two headers need to be
  2159. // specified:
  2160. //
  2161. // * `content-type: application/zip`
  2162. // * `x-goog-content-length-range: 0,104857600`
  2163. //
  2164. // And this header SHOULD NOT be specified:
  2165. //
  2166. // * `Authorization: Bearer YOUR_TOKEN`
  2167. func (r *ProjectsLocationsFunctionsService) GenerateUploadUrl(parent string, generateuploadurlrequest *GenerateUploadUrlRequest) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2168. c := &ProjectsLocationsFunctionsGenerateUploadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2169. c.parent = parent
  2170. c.generateuploadurlrequest = generateuploadurlrequest
  2171. return c
  2172. }
  2173. // Fields allows partial responses to be retrieved. See
  2174. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2175. // for more information.
  2176. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2177. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2178. return c
  2179. }
  2180. // Context sets the context to be used in this call's Do method. Any
  2181. // pending HTTP request will be aborted if the provided context is
  2182. // canceled.
  2183. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateUploadUrlCall {
  2184. c.ctx_ = ctx
  2185. return c
  2186. }
  2187. // Header returns an http.Header that can be modified by the caller to
  2188. // add HTTP headers to the request.
  2189. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Header() http.Header {
  2190. if c.header_ == nil {
  2191. c.header_ = make(http.Header)
  2192. }
  2193. return c.header_
  2194. }
  2195. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) doRequest(alt string) (*http.Response, error) {
  2196. reqHeaders := make(http.Header)
  2197. for k, v := range c.header_ {
  2198. reqHeaders[k] = v
  2199. }
  2200. reqHeaders.Set("User-Agent", c.s.userAgent())
  2201. var body io.Reader = nil
  2202. body, err := googleapi.WithoutDataWrapper.JSONReader(c.generateuploadurlrequest)
  2203. if err != nil {
  2204. return nil, err
  2205. }
  2206. reqHeaders.Set("Content-Type", "application/json")
  2207. c.urlParams_.Set("alt", alt)
  2208. c.urlParams_.Set("prettyPrint", "false")
  2209. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+parent}/functions:generateUploadUrl")
  2210. urls += "?" + c.urlParams_.Encode()
  2211. req, err := http.NewRequest("POST", urls, body)
  2212. if err != nil {
  2213. return nil, err
  2214. }
  2215. req.Header = reqHeaders
  2216. googleapi.Expand(req.URL, map[string]string{
  2217. "parent": c.parent,
  2218. })
  2219. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2220. }
  2221. // Do executes the "cloudfunctions.projects.locations.functions.generateUploadUrl" call.
  2222. // Exactly one of *GenerateUploadUrlResponse or error will be non-nil.
  2223. // Any non-2xx status code is an error. Response headers are in either
  2224. // *GenerateUploadUrlResponse.ServerResponse.Header or (if a response
  2225. // was returned at all) in error.(*googleapi.Error).Header. Use
  2226. // googleapi.IsNotModified to check whether the returned error was
  2227. // because http.StatusNotModified was returned.
  2228. func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateUploadUrlResponse, error) {
  2229. gensupport.SetOptions(c.urlParams_, opts...)
  2230. res, err := c.doRequest("json")
  2231. if res != nil && res.StatusCode == http.StatusNotModified {
  2232. if res.Body != nil {
  2233. res.Body.Close()
  2234. }
  2235. return nil, &googleapi.Error{
  2236. Code: res.StatusCode,
  2237. Header: res.Header,
  2238. }
  2239. }
  2240. if err != nil {
  2241. return nil, err
  2242. }
  2243. defer googleapi.CloseBody(res)
  2244. if err := googleapi.CheckResponse(res); err != nil {
  2245. return nil, err
  2246. }
  2247. ret := &GenerateUploadUrlResponse{
  2248. ServerResponse: googleapi.ServerResponse{
  2249. Header: res.Header,
  2250. HTTPStatusCode: res.StatusCode,
  2251. },
  2252. }
  2253. target := &ret
  2254. if err := gensupport.DecodeResponse(target, res); err != nil {
  2255. return nil, err
  2256. }
  2257. return ret, nil
  2258. // {
  2259. // "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`",
  2260. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions:generateUploadUrl",
  2261. // "httpMethod": "POST",
  2262. // "id": "cloudfunctions.projects.locations.functions.generateUploadUrl",
  2263. // "parameterOrder": [
  2264. // "parent"
  2265. // ],
  2266. // "parameters": {
  2267. // "parent": {
  2268. // "description": "The project and location in which the Google Cloud Storage signed URL\nshould be generated, specified in the format `projects/*/locations/*`.",
  2269. // "location": "path",
  2270. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2271. // "required": true,
  2272. // "type": "string"
  2273. // }
  2274. // },
  2275. // "path": "v1beta2/{+parent}/functions:generateUploadUrl",
  2276. // "request": {
  2277. // "$ref": "GenerateUploadUrlRequest"
  2278. // },
  2279. // "response": {
  2280. // "$ref": "GenerateUploadUrlResponse"
  2281. // },
  2282. // "scopes": [
  2283. // "https://www.googleapis.com/auth/cloud-platform"
  2284. // ]
  2285. // }
  2286. }
  2287. // method id "cloudfunctions.projects.locations.functions.get":
  2288. type ProjectsLocationsFunctionsGetCall struct {
  2289. s *Service
  2290. name string
  2291. urlParams_ gensupport.URLParams
  2292. ifNoneMatch_ string
  2293. ctx_ context.Context
  2294. header_ http.Header
  2295. }
  2296. // Get: Returns a function with the given name from the requested
  2297. // project.
  2298. func (r *ProjectsLocationsFunctionsService) Get(name string) *ProjectsLocationsFunctionsGetCall {
  2299. c := &ProjectsLocationsFunctionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2300. c.name = name
  2301. return c
  2302. }
  2303. // Fields allows partial responses to be retrieved. See
  2304. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2305. // for more information.
  2306. func (c *ProjectsLocationsFunctionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGetCall {
  2307. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2308. return c
  2309. }
  2310. // IfNoneMatch sets the optional parameter which makes the operation
  2311. // fail if the object's ETag matches the given value. This is useful for
  2312. // getting updates only after the object has changed since the last
  2313. // request. Use googleapi.IsNotModified to check whether the response
  2314. // error from Do is the result of In-None-Match.
  2315. func (c *ProjectsLocationsFunctionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetCall {
  2316. c.ifNoneMatch_ = entityTag
  2317. return c
  2318. }
  2319. // Context sets the context to be used in this call's Do method. Any
  2320. // pending HTTP request will be aborted if the provided context is
  2321. // canceled.
  2322. func (c *ProjectsLocationsFunctionsGetCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGetCall {
  2323. c.ctx_ = ctx
  2324. return c
  2325. }
  2326. // Header returns an http.Header that can be modified by the caller to
  2327. // add HTTP headers to the request.
  2328. func (c *ProjectsLocationsFunctionsGetCall) Header() http.Header {
  2329. if c.header_ == nil {
  2330. c.header_ = make(http.Header)
  2331. }
  2332. return c.header_
  2333. }
  2334. func (c *ProjectsLocationsFunctionsGetCall) doRequest(alt string) (*http.Response, error) {
  2335. reqHeaders := make(http.Header)
  2336. for k, v := range c.header_ {
  2337. reqHeaders[k] = v
  2338. }
  2339. reqHeaders.Set("User-Agent", c.s.userAgent())
  2340. if c.ifNoneMatch_ != "" {
  2341. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2342. }
  2343. var body io.Reader = nil
  2344. c.urlParams_.Set("alt", alt)
  2345. c.urlParams_.Set("prettyPrint", "false")
  2346. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  2347. urls += "?" + c.urlParams_.Encode()
  2348. req, err := http.NewRequest("GET", urls, body)
  2349. if err != nil {
  2350. return nil, err
  2351. }
  2352. req.Header = reqHeaders
  2353. googleapi.Expand(req.URL, map[string]string{
  2354. "name": c.name,
  2355. })
  2356. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2357. }
  2358. // Do executes the "cloudfunctions.projects.locations.functions.get" call.
  2359. // Exactly one of *CloudFunction or error will be non-nil. Any non-2xx
  2360. // status code is an error. Response headers are in either
  2361. // *CloudFunction.ServerResponse.Header or (if a response was returned
  2362. // at all) in error.(*googleapi.Error).Header. Use
  2363. // googleapi.IsNotModified to check whether the returned error was
  2364. // because http.StatusNotModified was returned.
  2365. func (c *ProjectsLocationsFunctionsGetCall) Do(opts ...googleapi.CallOption) (*CloudFunction, error) {
  2366. gensupport.SetOptions(c.urlParams_, opts...)
  2367. res, err := c.doRequest("json")
  2368. if res != nil && res.StatusCode == http.StatusNotModified {
  2369. if res.Body != nil {
  2370. res.Body.Close()
  2371. }
  2372. return nil, &googleapi.Error{
  2373. Code: res.StatusCode,
  2374. Header: res.Header,
  2375. }
  2376. }
  2377. if err != nil {
  2378. return nil, err
  2379. }
  2380. defer googleapi.CloseBody(res)
  2381. if err := googleapi.CheckResponse(res); err != nil {
  2382. return nil, err
  2383. }
  2384. ret := &CloudFunction{
  2385. ServerResponse: googleapi.ServerResponse{
  2386. Header: res.Header,
  2387. HTTPStatusCode: res.StatusCode,
  2388. },
  2389. }
  2390. target := &ret
  2391. if err := gensupport.DecodeResponse(target, res); err != nil {
  2392. return nil, err
  2393. }
  2394. return ret, nil
  2395. // {
  2396. // "description": "Returns a function with the given name from the requested project.",
  2397. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  2398. // "httpMethod": "GET",
  2399. // "id": "cloudfunctions.projects.locations.functions.get",
  2400. // "parameterOrder": [
  2401. // "name"
  2402. // ],
  2403. // "parameters": {
  2404. // "name": {
  2405. // "description": "The name of the function which details should be obtained.",
  2406. // "location": "path",
  2407. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2408. // "required": true,
  2409. // "type": "string"
  2410. // }
  2411. // },
  2412. // "path": "v1beta2/{+name}",
  2413. // "response": {
  2414. // "$ref": "CloudFunction"
  2415. // },
  2416. // "scopes": [
  2417. // "https://www.googleapis.com/auth/cloud-platform"
  2418. // ]
  2419. // }
  2420. }
  2421. // method id "cloudfunctions.projects.locations.functions.list":
  2422. type ProjectsLocationsFunctionsListCall struct {
  2423. s *Service
  2424. location string
  2425. urlParams_ gensupport.URLParams
  2426. ifNoneMatch_ string
  2427. ctx_ context.Context
  2428. header_ http.Header
  2429. }
  2430. // List: Returns a list of functions that belong to the requested
  2431. // project.
  2432. func (r *ProjectsLocationsFunctionsService) List(location string) *ProjectsLocationsFunctionsListCall {
  2433. c := &ProjectsLocationsFunctionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2434. c.location = location
  2435. return c
  2436. }
  2437. // PageSize sets the optional parameter "pageSize": Maximum number of
  2438. // functions to return per call.
  2439. func (c *ProjectsLocationsFunctionsListCall) PageSize(pageSize int64) *ProjectsLocationsFunctionsListCall {
  2440. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2441. return c
  2442. }
  2443. // PageToken sets the optional parameter "pageToken": The value returned
  2444. // by the last
  2445. // `ListFunctionsResponse`; indicates that
  2446. // this is a continuation of a prior `ListFunctions` call, and that
  2447. // the
  2448. // system should return the next page of data.
  2449. func (c *ProjectsLocationsFunctionsListCall) PageToken(pageToken string) *ProjectsLocationsFunctionsListCall {
  2450. c.urlParams_.Set("pageToken", pageToken)
  2451. return c
  2452. }
  2453. // Fields allows partial responses to be retrieved. See
  2454. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2455. // for more information.
  2456. func (c *ProjectsLocationsFunctionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsListCall {
  2457. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2458. return c
  2459. }
  2460. // IfNoneMatch sets the optional parameter which makes the operation
  2461. // fail if the object's ETag matches the given value. This is useful for
  2462. // getting updates only after the object has changed since the last
  2463. // request. Use googleapi.IsNotModified to check whether the response
  2464. // error from Do is the result of In-None-Match.
  2465. func (c *ProjectsLocationsFunctionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsListCall {
  2466. c.ifNoneMatch_ = entityTag
  2467. return c
  2468. }
  2469. // Context sets the context to be used in this call's Do method. Any
  2470. // pending HTTP request will be aborted if the provided context is
  2471. // canceled.
  2472. func (c *ProjectsLocationsFunctionsListCall) Context(ctx context.Context) *ProjectsLocationsFunctionsListCall {
  2473. c.ctx_ = ctx
  2474. return c
  2475. }
  2476. // Header returns an http.Header that can be modified by the caller to
  2477. // add HTTP headers to the request.
  2478. func (c *ProjectsLocationsFunctionsListCall) Header() http.Header {
  2479. if c.header_ == nil {
  2480. c.header_ = make(http.Header)
  2481. }
  2482. return c.header_
  2483. }
  2484. func (c *ProjectsLocationsFunctionsListCall) doRequest(alt string) (*http.Response, error) {
  2485. reqHeaders := make(http.Header)
  2486. for k, v := range c.header_ {
  2487. reqHeaders[k] = v
  2488. }
  2489. reqHeaders.Set("User-Agent", c.s.userAgent())
  2490. if c.ifNoneMatch_ != "" {
  2491. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2492. }
  2493. var body io.Reader = nil
  2494. c.urlParams_.Set("alt", alt)
  2495. c.urlParams_.Set("prettyPrint", "false")
  2496. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+location}/functions")
  2497. urls += "?" + c.urlParams_.Encode()
  2498. req, err := http.NewRequest("GET", urls, body)
  2499. if err != nil {
  2500. return nil, err
  2501. }
  2502. req.Header = reqHeaders
  2503. googleapi.Expand(req.URL, map[string]string{
  2504. "location": c.location,
  2505. })
  2506. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2507. }
  2508. // Do executes the "cloudfunctions.projects.locations.functions.list" call.
  2509. // Exactly one of *ListFunctionsResponse or error will be non-nil. Any
  2510. // non-2xx status code is an error. Response headers are in either
  2511. // *ListFunctionsResponse.ServerResponse.Header or (if a response was
  2512. // returned at all) in error.(*googleapi.Error).Header. Use
  2513. // googleapi.IsNotModified to check whether the returned error was
  2514. // because http.StatusNotModified was returned.
  2515. func (c *ProjectsLocationsFunctionsListCall) Do(opts ...googleapi.CallOption) (*ListFunctionsResponse, error) {
  2516. gensupport.SetOptions(c.urlParams_, opts...)
  2517. res, err := c.doRequest("json")
  2518. if res != nil && res.StatusCode == http.StatusNotModified {
  2519. if res.Body != nil {
  2520. res.Body.Close()
  2521. }
  2522. return nil, &googleapi.Error{
  2523. Code: res.StatusCode,
  2524. Header: res.Header,
  2525. }
  2526. }
  2527. if err != nil {
  2528. return nil, err
  2529. }
  2530. defer googleapi.CloseBody(res)
  2531. if err := googleapi.CheckResponse(res); err != nil {
  2532. return nil, err
  2533. }
  2534. ret := &ListFunctionsResponse{
  2535. ServerResponse: googleapi.ServerResponse{
  2536. Header: res.Header,
  2537. HTTPStatusCode: res.StatusCode,
  2538. },
  2539. }
  2540. target := &ret
  2541. if err := gensupport.DecodeResponse(target, res); err != nil {
  2542. return nil, err
  2543. }
  2544. return ret, nil
  2545. // {
  2546. // "description": "Returns a list of functions that belong to the requested project.",
  2547. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions",
  2548. // "httpMethod": "GET",
  2549. // "id": "cloudfunctions.projects.locations.functions.list",
  2550. // "parameterOrder": [
  2551. // "location"
  2552. // ],
  2553. // "parameters": {
  2554. // "location": {
  2555. // "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.",
  2556. // "location": "path",
  2557. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2558. // "required": true,
  2559. // "type": "string"
  2560. // },
  2561. // "pageSize": {
  2562. // "description": "Maximum number of functions to return per call.",
  2563. // "format": "int32",
  2564. // "location": "query",
  2565. // "type": "integer"
  2566. // },
  2567. // "pageToken": {
  2568. // "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.",
  2569. // "location": "query",
  2570. // "type": "string"
  2571. // }
  2572. // },
  2573. // "path": "v1beta2/{+location}/functions",
  2574. // "response": {
  2575. // "$ref": "ListFunctionsResponse"
  2576. // },
  2577. // "scopes": [
  2578. // "https://www.googleapis.com/auth/cloud-platform"
  2579. // ]
  2580. // }
  2581. }
  2582. // Pages invokes f for each page of results.
  2583. // A non-nil error returned from f will halt the iteration.
  2584. // The provided context supersedes any context provided to the Context method.
  2585. func (c *ProjectsLocationsFunctionsListCall) Pages(ctx context.Context, f func(*ListFunctionsResponse) error) error {
  2586. c.ctx_ = ctx
  2587. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2588. for {
  2589. x, err := c.Do()
  2590. if err != nil {
  2591. return err
  2592. }
  2593. if err := f(x); err != nil {
  2594. return err
  2595. }
  2596. if x.NextPageToken == "" {
  2597. return nil
  2598. }
  2599. c.PageToken(x.NextPageToken)
  2600. }
  2601. }
  2602. // method id "cloudfunctions.projects.locations.functions.update":
  2603. type ProjectsLocationsFunctionsUpdateCall struct {
  2604. s *Service
  2605. name string
  2606. cloudfunction *CloudFunction
  2607. urlParams_ gensupport.URLParams
  2608. ctx_ context.Context
  2609. header_ http.Header
  2610. }
  2611. // Update: Updates existing function.
  2612. func (r *ProjectsLocationsFunctionsService) Update(name string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsUpdateCall {
  2613. c := &ProjectsLocationsFunctionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2614. c.name = name
  2615. c.cloudfunction = cloudfunction
  2616. return c
  2617. }
  2618. // Fields allows partial responses to be retrieved. See
  2619. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2620. // for more information.
  2621. func (c *ProjectsLocationsFunctionsUpdateCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsUpdateCall {
  2622. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2623. return c
  2624. }
  2625. // Context sets the context to be used in this call's Do method. Any
  2626. // pending HTTP request will be aborted if the provided context is
  2627. // canceled.
  2628. func (c *ProjectsLocationsFunctionsUpdateCall) Context(ctx context.Context) *ProjectsLocationsFunctionsUpdateCall {
  2629. c.ctx_ = ctx
  2630. return c
  2631. }
  2632. // Header returns an http.Header that can be modified by the caller to
  2633. // add HTTP headers to the request.
  2634. func (c *ProjectsLocationsFunctionsUpdateCall) Header() http.Header {
  2635. if c.header_ == nil {
  2636. c.header_ = make(http.Header)
  2637. }
  2638. return c.header_
  2639. }
  2640. func (c *ProjectsLocationsFunctionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2641. reqHeaders := make(http.Header)
  2642. for k, v := range c.header_ {
  2643. reqHeaders[k] = v
  2644. }
  2645. reqHeaders.Set("User-Agent", c.s.userAgent())
  2646. var body io.Reader = nil
  2647. body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction)
  2648. if err != nil {
  2649. return nil, err
  2650. }
  2651. reqHeaders.Set("Content-Type", "application/json")
  2652. c.urlParams_.Set("alt", alt)
  2653. c.urlParams_.Set("prettyPrint", "false")
  2654. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
  2655. urls += "?" + c.urlParams_.Encode()
  2656. req, err := http.NewRequest("PUT", urls, body)
  2657. if err != nil {
  2658. return nil, err
  2659. }
  2660. req.Header = reqHeaders
  2661. googleapi.Expand(req.URL, map[string]string{
  2662. "name": c.name,
  2663. })
  2664. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2665. }
  2666. // Do executes the "cloudfunctions.projects.locations.functions.update" call.
  2667. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2668. // status code is an error. Response headers are in either
  2669. // *Operation.ServerResponse.Header or (if a response was returned at
  2670. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2671. // to check whether the returned error was because
  2672. // http.StatusNotModified was returned.
  2673. func (c *ProjectsLocationsFunctionsUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2674. gensupport.SetOptions(c.urlParams_, opts...)
  2675. res, err := c.doRequest("json")
  2676. if res != nil && res.StatusCode == http.StatusNotModified {
  2677. if res.Body != nil {
  2678. res.Body.Close()
  2679. }
  2680. return nil, &googleapi.Error{
  2681. Code: res.StatusCode,
  2682. Header: res.Header,
  2683. }
  2684. }
  2685. if err != nil {
  2686. return nil, err
  2687. }
  2688. defer googleapi.CloseBody(res)
  2689. if err := googleapi.CheckResponse(res); err != nil {
  2690. return nil, err
  2691. }
  2692. ret := &Operation{
  2693. ServerResponse: googleapi.ServerResponse{
  2694. Header: res.Header,
  2695. HTTPStatusCode: res.StatusCode,
  2696. },
  2697. }
  2698. target := &ret
  2699. if err := gensupport.DecodeResponse(target, res); err != nil {
  2700. return nil, err
  2701. }
  2702. return ret, nil
  2703. // {
  2704. // "description": "Updates existing function.",
  2705. // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}",
  2706. // "httpMethod": "PUT",
  2707. // "id": "cloudfunctions.projects.locations.functions.update",
  2708. // "parameterOrder": [
  2709. // "name"
  2710. // ],
  2711. // "parameters": {
  2712. // "name": {
  2713. // "description": "The name of the function to be updated.",
  2714. // "location": "path",
  2715. // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$",
  2716. // "required": true,
  2717. // "type": "string"
  2718. // }
  2719. // },
  2720. // "path": "v1beta2/{+name}",
  2721. // "request": {
  2722. // "$ref": "CloudFunction"
  2723. // },
  2724. // "response": {
  2725. // "$ref": "Operation"
  2726. // },
  2727. // "scopes": [
  2728. // "https://www.googleapis.com/auth/cloud-platform"
  2729. // ]
  2730. // }
  2731. }