Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

2826 linhas
99 KiB

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