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

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