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.
 
 
 

2929 lines
102 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package firebaserules provides access to the Firebase Rules API.
  6. //
  7. // For product documentation, see: https://firebase.google.com/docs/storage/security
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/firebaserules/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // firebaserulesService, err := firebaserules.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // firebaserulesService, err := firebaserules.NewService(ctx, option.WithScopes(firebaserules.FirebaseReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // firebaserulesService, err := firebaserules.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // firebaserulesService, err := firebaserules.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package firebaserules // import "google.golang.org/api/firebaserules/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "firebaserules:v1"
  71. const apiName = "firebaserules"
  72. const apiVersion = "v1"
  73. const basePath = "https://firebaserules.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // View and administer all your Firebase data and settings
  79. FirebaseScope = "https://www.googleapis.com/auth/firebase"
  80. // View all your Firebase data and settings
  81. FirebaseReadonlyScope = "https://www.googleapis.com/auth/firebase.readonly"
  82. )
  83. // NewService creates a new Service.
  84. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  85. scopesOption := option.WithScopes(
  86. "https://www.googleapis.com/auth/cloud-platform",
  87. "https://www.googleapis.com/auth/firebase",
  88. "https://www.googleapis.com/auth/firebase.readonly",
  89. )
  90. // NOTE: prepend, so we don't override user-specified scopes.
  91. opts = append([]option.ClientOption{scopesOption}, opts...)
  92. client, endpoint, err := htransport.NewClient(ctx, opts...)
  93. if err != nil {
  94. return nil, err
  95. }
  96. s, err := New(client)
  97. if err != nil {
  98. return nil, err
  99. }
  100. if endpoint != "" {
  101. s.BasePath = endpoint
  102. }
  103. return s, nil
  104. }
  105. // New creates a new Service. It uses the provided http.Client for requests.
  106. //
  107. // Deprecated: please use NewService instead.
  108. // To provide a custom HTTP client, use option.WithHTTPClient.
  109. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  110. func New(client *http.Client) (*Service, error) {
  111. if client == nil {
  112. return nil, errors.New("client is nil")
  113. }
  114. s := &Service{client: client, BasePath: basePath}
  115. s.Projects = NewProjectsService(s)
  116. return s, nil
  117. }
  118. type Service struct {
  119. client *http.Client
  120. BasePath string // API endpoint base URL
  121. UserAgent string // optional additional User-Agent fragment
  122. Projects *ProjectsService
  123. }
  124. func (s *Service) userAgent() string {
  125. if s.UserAgent == "" {
  126. return googleapi.UserAgent
  127. }
  128. return googleapi.UserAgent + " " + s.UserAgent
  129. }
  130. func NewProjectsService(s *Service) *ProjectsService {
  131. rs := &ProjectsService{s: s}
  132. rs.Releases = NewProjectsReleasesService(s)
  133. rs.Rulesets = NewProjectsRulesetsService(s)
  134. return rs
  135. }
  136. type ProjectsService struct {
  137. s *Service
  138. Releases *ProjectsReleasesService
  139. Rulesets *ProjectsRulesetsService
  140. }
  141. func NewProjectsReleasesService(s *Service) *ProjectsReleasesService {
  142. rs := &ProjectsReleasesService{s: s}
  143. return rs
  144. }
  145. type ProjectsReleasesService struct {
  146. s *Service
  147. }
  148. func NewProjectsRulesetsService(s *Service) *ProjectsRulesetsService {
  149. rs := &ProjectsRulesetsService{s: s}
  150. return rs
  151. }
  152. type ProjectsRulesetsService struct {
  153. s *Service
  154. }
  155. // Arg: Arg matchers for the mock function.
  156. type Arg struct {
  157. // AnyValue: Argument matches any value provided.
  158. AnyValue *Empty `json:"anyValue,omitempty"`
  159. // ExactValue: Argument exactly matches value provided.
  160. ExactValue interface{} `json:"exactValue,omitempty"`
  161. // ForceSendFields is a list of field names (e.g. "AnyValue") to
  162. // unconditionally include in API requests. By default, fields with
  163. // empty values are omitted from API requests. However, any non-pointer,
  164. // non-interface field appearing in ForceSendFields will be sent to the
  165. // server regardless of whether the field is empty or not. This may be
  166. // used to include empty fields in Patch requests.
  167. ForceSendFields []string `json:"-"`
  168. // NullFields is a list of field names (e.g. "AnyValue") to include in
  169. // API requests with the JSON null value. By default, fields with empty
  170. // values are omitted from API requests. However, any field with an
  171. // empty value appearing in NullFields will be sent to the server as
  172. // null. It is an error if a field in this list has a non-empty value.
  173. // This may be used to include null fields in Patch requests.
  174. NullFields []string `json:"-"`
  175. }
  176. func (s *Arg) MarshalJSON() ([]byte, error) {
  177. type NoMethod Arg
  178. raw := NoMethod(*s)
  179. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  180. }
  181. // Empty: A generic empty message that you can re-use to avoid defining
  182. // duplicated
  183. // empty messages in your APIs. A typical example is to use it as the
  184. // request
  185. // or the response type of an API method. For instance:
  186. //
  187. // service Foo {
  188. // rpc Bar(google.protobuf.Empty) returns
  189. // (google.protobuf.Empty);
  190. // }
  191. //
  192. // The JSON representation for `Empty` is empty JSON object `{}`.
  193. type Empty struct {
  194. // ServerResponse contains the HTTP response code and headers from the
  195. // server.
  196. googleapi.ServerResponse `json:"-"`
  197. }
  198. // File: `File` containing source content.
  199. type File struct {
  200. // Content: Textual Content.
  201. Content string `json:"content,omitempty"`
  202. // Fingerprint: Fingerprint (e.g. github sha) associated with the
  203. // `File`.
  204. Fingerprint string `json:"fingerprint,omitempty"`
  205. // Name: File name.
  206. Name string `json:"name,omitempty"`
  207. // ForceSendFields is a list of field names (e.g. "Content") to
  208. // unconditionally include in API requests. By default, fields with
  209. // empty values are omitted from API requests. However, any non-pointer,
  210. // non-interface field appearing in ForceSendFields will be sent to the
  211. // server regardless of whether the field is empty or not. This may be
  212. // used to include empty fields in Patch requests.
  213. ForceSendFields []string `json:"-"`
  214. // NullFields is a list of field names (e.g. "Content") to include in
  215. // API requests with the JSON null value. By default, fields with empty
  216. // values are omitted from API requests. However, any field with an
  217. // empty value appearing in NullFields will be sent to the server as
  218. // null. It is an error if a field in this list has a non-empty value.
  219. // This may be used to include null fields in Patch requests.
  220. NullFields []string `json:"-"`
  221. }
  222. func (s *File) MarshalJSON() ([]byte, error) {
  223. type NoMethod File
  224. raw := NoMethod(*s)
  225. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  226. }
  227. // FunctionCall: Represents a service-defined function call that was
  228. // invoked during test
  229. // execution.
  230. type FunctionCall struct {
  231. // Args: The arguments that were provided to the function.
  232. Args []interface{} `json:"args,omitempty"`
  233. // Function: Name of the function invoked.
  234. Function string `json:"function,omitempty"`
  235. // ForceSendFields is a list of field names (e.g. "Args") to
  236. // unconditionally include in API requests. By default, fields with
  237. // empty values are omitted from API requests. However, any non-pointer,
  238. // non-interface field appearing in ForceSendFields will be sent to the
  239. // server regardless of whether the field is empty or not. This may be
  240. // used to include empty fields in Patch requests.
  241. ForceSendFields []string `json:"-"`
  242. // NullFields is a list of field names (e.g. "Args") to include in API
  243. // requests with the JSON null value. By default, fields with empty
  244. // values are omitted from API requests. However, any field with an
  245. // empty value appearing in NullFields will be sent to the server as
  246. // null. It is an error if a field in this list has a non-empty value.
  247. // This may be used to include null fields in Patch requests.
  248. NullFields []string `json:"-"`
  249. }
  250. func (s *FunctionCall) MarshalJSON() ([]byte, error) {
  251. type NoMethod FunctionCall
  252. raw := NoMethod(*s)
  253. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  254. }
  255. // FunctionMock: Mock function definition.
  256. //
  257. // Mocks must refer to a function declared by the target service. The
  258. // type of
  259. // the function args and result will be inferred at test time. If either
  260. // the
  261. // arg or result values are not compatible with function type
  262. // declaration, the
  263. // request will be considered invalid.
  264. //
  265. // More than one `FunctionMock` may be provided for a given function
  266. // name so
  267. // long as the `Arg` matchers are distinct. There may be only one
  268. // function
  269. // for a given overload where all `Arg` values are `Arg.any_value`.
  270. type FunctionMock struct {
  271. // Args: The list of `Arg` values to match. The order in which the
  272. // arguments are
  273. // provided is the order in which they must appear in the
  274. // function
  275. // invocation.
  276. Args []*Arg `json:"args,omitempty"`
  277. // Function: The name of the function.
  278. //
  279. // The function name must match one provided by a service declaration.
  280. Function string `json:"function,omitempty"`
  281. // Result: The mock result of the function call.
  282. Result *Result `json:"result,omitempty"`
  283. // ForceSendFields is a list of field names (e.g. "Args") to
  284. // unconditionally include in API requests. By default, fields with
  285. // empty values are omitted from API requests. However, any non-pointer,
  286. // non-interface field appearing in ForceSendFields will be sent to the
  287. // server regardless of whether the field is empty or not. This may be
  288. // used to include empty fields in Patch requests.
  289. ForceSendFields []string `json:"-"`
  290. // NullFields is a list of field names (e.g. "Args") to include in API
  291. // requests with the JSON null value. By default, fields with empty
  292. // values are omitted from API requests. However, any field with an
  293. // empty value appearing in NullFields will be sent to the server as
  294. // null. It is an error if a field in this list has a non-empty value.
  295. // This may be used to include null fields in Patch requests.
  296. NullFields []string `json:"-"`
  297. }
  298. func (s *FunctionMock) MarshalJSON() ([]byte, error) {
  299. type NoMethod FunctionMock
  300. raw := NoMethod(*s)
  301. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  302. }
  303. // GetReleaseExecutableResponse: The response for
  304. // FirebaseRulesService.GetReleaseExecutable
  305. type GetReleaseExecutableResponse struct {
  306. // Executable: Executable view of the `Ruleset` referenced by the
  307. // `Release`.
  308. Executable string `json:"executable,omitempty"`
  309. // ExecutableVersion: The Rules runtime version of the executable.
  310. //
  311. // Possible values:
  312. // "RELEASE_EXECUTABLE_VERSION_UNSPECIFIED" - Executable format
  313. // unspecified.
  314. // Defaults to FIREBASE_RULES_EXECUTABLE_V1
  315. // "FIREBASE_RULES_EXECUTABLE_V1" - Firebase Rules syntax 'rules2'
  316. // executable versions:
  317. // Custom AST for use with Java clients.
  318. // "FIREBASE_RULES_EXECUTABLE_V2" - CEL-based executable for use with
  319. // C++ clients.
  320. ExecutableVersion string `json:"executableVersion,omitempty"`
  321. // Language: `Language` used to generate the executable bytes.
  322. //
  323. // Possible values:
  324. // "LANGUAGE_UNSPECIFIED" - Language unspecified. Defaults to
  325. // FIREBASE_RULES.
  326. // "FIREBASE_RULES" - Firebase Rules language.
  327. // "EVENT_FLOW_TRIGGERS" - Event Flow triggers.
  328. Language string `json:"language,omitempty"`
  329. // RulesetName: `Ruleset` name associated with the `Release` executable.
  330. RulesetName string `json:"rulesetName,omitempty"`
  331. // SyncTime: Optional, indicates the freshness of the result. The
  332. // response is
  333. // guaranteed to be the latest within an interval up to the
  334. // sync_time (inclusive).
  335. SyncTime string `json:"syncTime,omitempty"`
  336. // UpdateTime: Timestamp for the most recent `Release.update_time`.
  337. UpdateTime string `json:"updateTime,omitempty"`
  338. // ServerResponse contains the HTTP response code and headers from the
  339. // server.
  340. googleapi.ServerResponse `json:"-"`
  341. // ForceSendFields is a list of field names (e.g. "Executable") to
  342. // unconditionally include in API requests. By default, fields with
  343. // empty values are omitted from API requests. However, any non-pointer,
  344. // non-interface field appearing in ForceSendFields will be sent to the
  345. // server regardless of whether the field is empty or not. This may be
  346. // used to include empty fields in Patch requests.
  347. ForceSendFields []string `json:"-"`
  348. // NullFields is a list of field names (e.g. "Executable") to include in
  349. // API requests with the JSON null value. By default, fields with empty
  350. // values are omitted from API requests. However, any field with an
  351. // empty value appearing in NullFields will be sent to the server as
  352. // null. It is an error if a field in this list has a non-empty value.
  353. // This may be used to include null fields in Patch requests.
  354. NullFields []string `json:"-"`
  355. }
  356. func (s *GetReleaseExecutableResponse) MarshalJSON() ([]byte, error) {
  357. type NoMethod GetReleaseExecutableResponse
  358. raw := NoMethod(*s)
  359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  360. }
  361. // Issue: Issues include warnings, errors, and deprecation notices.
  362. type Issue struct {
  363. // Description: Short error description.
  364. Description string `json:"description,omitempty"`
  365. // Severity: The severity of the issue.
  366. //
  367. // Possible values:
  368. // "SEVERITY_UNSPECIFIED" - An unspecified severity.
  369. // "DEPRECATION" - Deprecation issue for statements and method that
  370. // may no longer be
  371. // supported or maintained.
  372. // "WARNING" - Warnings such as: unused variables.
  373. // "ERROR" - Errors such as: unmatched curly braces or variable
  374. // redefinition.
  375. Severity string `json:"severity,omitempty"`
  376. // SourcePosition: Position of the issue in the `Source`.
  377. SourcePosition *SourcePosition `json:"sourcePosition,omitempty"`
  378. // ForceSendFields is a list of field names (e.g. "Description") to
  379. // unconditionally include in API requests. By default, fields with
  380. // empty values are omitted from API requests. However, any non-pointer,
  381. // non-interface field appearing in ForceSendFields will be sent to the
  382. // server regardless of whether the field is empty or not. This may be
  383. // used to include empty fields in Patch requests.
  384. ForceSendFields []string `json:"-"`
  385. // NullFields is a list of field names (e.g. "Description") to include
  386. // in API requests with the JSON null value. By default, fields with
  387. // empty values are omitted from API requests. However, any field with
  388. // an empty value appearing in NullFields will be sent to the server as
  389. // null. It is an error if a field in this list has a non-empty value.
  390. // This may be used to include null fields in Patch requests.
  391. NullFields []string `json:"-"`
  392. }
  393. func (s *Issue) MarshalJSON() ([]byte, error) {
  394. type NoMethod Issue
  395. raw := NoMethod(*s)
  396. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  397. }
  398. // ListReleasesResponse: The response for
  399. // FirebaseRulesService.ListReleases.
  400. type ListReleasesResponse struct {
  401. // NextPageToken: The pagination token to retrieve the next page of
  402. // results. If the value is
  403. // empty, no further results remain.
  404. NextPageToken string `json:"nextPageToken,omitempty"`
  405. // Releases: List of `Release` instances.
  406. Releases []*Release `json:"releases,omitempty"`
  407. // ServerResponse contains the HTTP response code and headers from the
  408. // server.
  409. googleapi.ServerResponse `json:"-"`
  410. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  411. // unconditionally include in API requests. By default, fields with
  412. // empty values are omitted from API requests. However, any non-pointer,
  413. // non-interface field appearing in ForceSendFields will be sent to the
  414. // server regardless of whether the field is empty or not. This may be
  415. // used to include empty fields in Patch requests.
  416. ForceSendFields []string `json:"-"`
  417. // NullFields is a list of field names (e.g. "NextPageToken") to include
  418. // in API requests with the JSON null value. By default, fields with
  419. // empty values are omitted from API requests. However, any field with
  420. // an empty value appearing in NullFields will be sent to the server as
  421. // null. It is an error if a field in this list has a non-empty value.
  422. // This may be used to include null fields in Patch requests.
  423. NullFields []string `json:"-"`
  424. }
  425. func (s *ListReleasesResponse) MarshalJSON() ([]byte, error) {
  426. type NoMethod ListReleasesResponse
  427. raw := NoMethod(*s)
  428. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  429. }
  430. // ListRulesetsResponse: The response for
  431. // FirebaseRulesService.ListRulesets.
  432. type ListRulesetsResponse struct {
  433. // NextPageToken: The pagination token to retrieve the next page of
  434. // results. If the value is
  435. // empty, no further results remain.
  436. NextPageToken string `json:"nextPageToken,omitempty"`
  437. // Rulesets: List of `Ruleset` instances.
  438. Rulesets []*Ruleset `json:"rulesets,omitempty"`
  439. // ServerResponse contains the HTTP response code and headers from the
  440. // server.
  441. googleapi.ServerResponse `json:"-"`
  442. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  443. // unconditionally include in API requests. By default, fields with
  444. // empty values are omitted from API requests. However, any non-pointer,
  445. // non-interface field appearing in ForceSendFields will be sent to the
  446. // server regardless of whether the field is empty or not. This may be
  447. // used to include empty fields in Patch requests.
  448. ForceSendFields []string `json:"-"`
  449. // NullFields is a list of field names (e.g. "NextPageToken") to include
  450. // in API requests with the JSON null value. By default, fields with
  451. // empty values are omitted from API requests. However, any field with
  452. // an empty value appearing in NullFields will be sent to the server as
  453. // null. It is an error if a field in this list has a non-empty value.
  454. // This may be used to include null fields in Patch requests.
  455. NullFields []string `json:"-"`
  456. }
  457. func (s *ListRulesetsResponse) MarshalJSON() ([]byte, error) {
  458. type NoMethod ListRulesetsResponse
  459. raw := NoMethod(*s)
  460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  461. }
  462. // Release: `Release` is a named reference to a `Ruleset`. Once a
  463. // `Release` refers to a
  464. // `Ruleset`, rules-enabled services will be able to enforce the
  465. // `Ruleset`.
  466. type Release struct {
  467. // CreateTime: Time the release was created.
  468. // Output only.
  469. CreateTime string `json:"createTime,omitempty"`
  470. // Name: Resource name for the `Release`.
  471. //
  472. // `Release` names may be structured `app1/prod/v2` or flat
  473. // `app1_prod_v2`
  474. // which affords developers a great deal of flexibility in mapping the
  475. // name
  476. // to the style that best fits their existing development practices.
  477. // For
  478. // example, a name could refer to an environment, an app, a version, or
  479. // some
  480. // combination of three.
  481. //
  482. // In the table below, for the project name `projects/foo`, the
  483. // following
  484. // relative release paths show how flat and structured names might be
  485. // chosen
  486. // to match a desired development / deployment strategy.
  487. //
  488. // Use Case | Flat Name | Structured
  489. // Name
  490. // -------------|---------------------|----------------
  491. // Environments
  492. // | releases/qa | releases/qa
  493. // Apps | releases/app1_qa | releases/app1/qa
  494. // Versions | releases/app1_v2_qa | releases/app1/v2/qa
  495. //
  496. // The delimiter between the release name path elements can be almost
  497. // anything
  498. // and it should work equally well with the release name list filter,
  499. // but in
  500. // many ways the structured paths provide a clearer picture of
  501. // the
  502. // relationship between `Release` instances.
  503. //
  504. // Format: `projects/{project_id}/releases/{release_id}`
  505. Name string `json:"name,omitempty"`
  506. // RulesetName: Name of the `Ruleset` referred to by this `Release`. The
  507. // `Ruleset` must
  508. // exist the `Release` to be created.
  509. RulesetName string `json:"rulesetName,omitempty"`
  510. // UpdateTime: Time the release was updated.
  511. // Output only.
  512. UpdateTime string `json:"updateTime,omitempty"`
  513. // ServerResponse contains the HTTP response code and headers from the
  514. // server.
  515. googleapi.ServerResponse `json:"-"`
  516. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  517. // unconditionally include in API requests. By default, fields with
  518. // empty values are omitted from API requests. However, any non-pointer,
  519. // non-interface field appearing in ForceSendFields will be sent to the
  520. // server regardless of whether the field is empty or not. This may be
  521. // used to include empty fields in Patch requests.
  522. ForceSendFields []string `json:"-"`
  523. // NullFields is a list of field names (e.g. "CreateTime") to include in
  524. // API requests with the JSON null value. By default, fields with empty
  525. // values are omitted from API requests. However, any field with an
  526. // empty value appearing in NullFields will be sent to the server as
  527. // null. It is an error if a field in this list has a non-empty value.
  528. // This may be used to include null fields in Patch requests.
  529. NullFields []string `json:"-"`
  530. }
  531. func (s *Release) MarshalJSON() ([]byte, error) {
  532. type NoMethod Release
  533. raw := NoMethod(*s)
  534. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  535. }
  536. // Result: Possible result values from the function mock invocation.
  537. type Result struct {
  538. // Undefined: The result is undefined, meaning the result could not be
  539. // computed.
  540. Undefined *Empty `json:"undefined,omitempty"`
  541. // Value: The result is an actual value. The type of the value must
  542. // match that
  543. // of the type declared by the service.
  544. Value interface{} `json:"value,omitempty"`
  545. // ForceSendFields is a list of field names (e.g. "Undefined") to
  546. // unconditionally include in API requests. By default, fields with
  547. // empty values are omitted from API requests. However, any non-pointer,
  548. // non-interface field appearing in ForceSendFields will be sent to the
  549. // server regardless of whether the field is empty or not. This may be
  550. // used to include empty fields in Patch requests.
  551. ForceSendFields []string `json:"-"`
  552. // NullFields is a list of field names (e.g. "Undefined") to include in
  553. // API requests with the JSON null value. By default, fields with empty
  554. // values are omitted from API requests. However, any field with an
  555. // empty value appearing in NullFields will be sent to the server as
  556. // null. It is an error if a field in this list has a non-empty value.
  557. // This may be used to include null fields in Patch requests.
  558. NullFields []string `json:"-"`
  559. }
  560. func (s *Result) MarshalJSON() ([]byte, error) {
  561. type NoMethod Result
  562. raw := NoMethod(*s)
  563. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  564. }
  565. // Ruleset: `Ruleset` is an immutable copy of `Source` with a globally
  566. // unique identifier
  567. // and a creation time.
  568. type Ruleset struct {
  569. // CreateTime: Time the `Ruleset` was created.
  570. // Output only.
  571. CreateTime string `json:"createTime,omitempty"`
  572. // Name: Name of the `Ruleset`. The ruleset_id is auto generated by the
  573. // service.
  574. // Format: `projects/{project_id}/rulesets/{ruleset_id}`
  575. // Output only.
  576. Name string `json:"name,omitempty"`
  577. // Source: `Source` for the `Ruleset`.
  578. Source *Source `json:"source,omitempty"`
  579. // ServerResponse contains the HTTP response code and headers from the
  580. // server.
  581. googleapi.ServerResponse `json:"-"`
  582. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  583. // unconditionally include in API requests. By default, fields with
  584. // empty values are omitted from API requests. However, any non-pointer,
  585. // non-interface field appearing in ForceSendFields will be sent to the
  586. // server regardless of whether the field is empty or not. This may be
  587. // used to include empty fields in Patch requests.
  588. ForceSendFields []string `json:"-"`
  589. // NullFields is a list of field names (e.g. "CreateTime") to include in
  590. // API requests with the JSON null value. By default, fields with empty
  591. // values are omitted from API requests. However, any field with an
  592. // empty value appearing in NullFields will be sent to the server as
  593. // null. It is an error if a field in this list has a non-empty value.
  594. // This may be used to include null fields in Patch requests.
  595. NullFields []string `json:"-"`
  596. }
  597. func (s *Ruleset) MarshalJSON() ([]byte, error) {
  598. type NoMethod Ruleset
  599. raw := NoMethod(*s)
  600. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  601. }
  602. // Source: `Source` is one or more `File` messages comprising a logical
  603. // set of rules.
  604. type Source struct {
  605. // Files: `File` set constituting the `Source` bundle.
  606. Files []*File `json:"files,omitempty"`
  607. // ForceSendFields is a list of field names (e.g. "Files") to
  608. // unconditionally include in API requests. By default, fields with
  609. // empty values are omitted from API requests. However, any non-pointer,
  610. // non-interface field appearing in ForceSendFields will be sent to the
  611. // server regardless of whether the field is empty or not. This may be
  612. // used to include empty fields in Patch requests.
  613. ForceSendFields []string `json:"-"`
  614. // NullFields is a list of field names (e.g. "Files") to include in API
  615. // requests with the JSON null value. By default, fields with empty
  616. // values are omitted from API requests. However, any field with an
  617. // empty value appearing in NullFields will be sent to the server as
  618. // null. It is an error if a field in this list has a non-empty value.
  619. // This may be used to include null fields in Patch requests.
  620. NullFields []string `json:"-"`
  621. }
  622. func (s *Source) MarshalJSON() ([]byte, error) {
  623. type NoMethod Source
  624. raw := NoMethod(*s)
  625. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  626. }
  627. // SourcePosition: Position in the `Source` content including its line,
  628. // column number, and an
  629. // index of the `File` in the `Source` message. Used for debug purposes.
  630. type SourcePosition struct {
  631. // Column: First column on the source line associated with the source
  632. // fragment.
  633. Column int64 `json:"column,omitempty"`
  634. // FileName: Name of the `File`.
  635. FileName string `json:"fileName,omitempty"`
  636. // Line: Line number of the source fragment. 1-based.
  637. Line int64 `json:"line,omitempty"`
  638. // ForceSendFields is a list of field names (e.g. "Column") to
  639. // unconditionally include in API requests. By default, fields with
  640. // empty values are omitted from API requests. However, any non-pointer,
  641. // non-interface field appearing in ForceSendFields will be sent to the
  642. // server regardless of whether the field is empty or not. This may be
  643. // used to include empty fields in Patch requests.
  644. ForceSendFields []string `json:"-"`
  645. // NullFields is a list of field names (e.g. "Column") to include in API
  646. // requests with the JSON null value. By default, fields with empty
  647. // values are omitted from API requests. However, any field with an
  648. // empty value appearing in NullFields will be sent to the server as
  649. // null. It is an error if a field in this list has a non-empty value.
  650. // This may be used to include null fields in Patch requests.
  651. NullFields []string `json:"-"`
  652. }
  653. func (s *SourcePosition) MarshalJSON() ([]byte, error) {
  654. type NoMethod SourcePosition
  655. raw := NoMethod(*s)
  656. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  657. }
  658. // TestCase: `TestCase` messages provide the request context and an
  659. // expectation as to
  660. // whether the given context will be allowed or denied. Test cases may
  661. // specify
  662. // the `request`, `resource`, and `function_mocks` to mock a function
  663. // call to
  664. // a service-provided function.
  665. //
  666. // The `request` object represents context present at request-time.
  667. //
  668. // The `resource` is the value of the target resource as it appears
  669. // in
  670. // persistent storage before the request is executed.
  671. type TestCase struct {
  672. // Expectation: Test expectation.
  673. //
  674. // Possible values:
  675. // "EXPECTATION_UNSPECIFIED" - Unspecified expectation.
  676. // "ALLOW" - Expect an allowed result.
  677. // "DENY" - Expect a denied result.
  678. Expectation string `json:"expectation,omitempty"`
  679. // FunctionMocks: Optional function mocks for service-defined functions.
  680. // If not set, any
  681. // service defined function is expected to return an error, which may or
  682. // may
  683. // not influence the test outcome.
  684. FunctionMocks []*FunctionMock `json:"functionMocks,omitempty"`
  685. // Request: Request context.
  686. //
  687. // The exact format of the request context is service-dependent. See
  688. // the
  689. // appropriate service documentation for information about the
  690. // supported
  691. // fields and types on the request. Minimally, all services support
  692. // the
  693. // following fields and types:
  694. //
  695. // Request field | Type
  696. // ---------------|-----------------
  697. // auth.uid | `string`
  698. // auth.token | `map<string, string>`
  699. // headers | `map<string, string>`
  700. // method | `string`
  701. // params | `map<string, string>`
  702. // path | `string`
  703. // time | `google.protobuf.Timestamp`
  704. //
  705. // If the request value is not well-formed for the service, the request
  706. // will
  707. // be rejected as an invalid argument.
  708. Request interface{} `json:"request,omitempty"`
  709. // Resource: Optional resource value as it appears in persistent storage
  710. // before the
  711. // request is fulfilled.
  712. //
  713. // The resource type depends on the `request.path` value.
  714. Resource interface{} `json:"resource,omitempty"`
  715. // ForceSendFields is a list of field names (e.g. "Expectation") to
  716. // unconditionally include in API requests. By default, fields with
  717. // empty values are omitted from API requests. However, any non-pointer,
  718. // non-interface field appearing in ForceSendFields will be sent to the
  719. // server regardless of whether the field is empty or not. This may be
  720. // used to include empty fields in Patch requests.
  721. ForceSendFields []string `json:"-"`
  722. // NullFields is a list of field names (e.g. "Expectation") to include
  723. // in API requests with the JSON null value. By default, fields with
  724. // empty values are omitted from API requests. However, any field with
  725. // an empty value appearing in NullFields will be sent to the server as
  726. // null. It is an error if a field in this list has a non-empty value.
  727. // This may be used to include null fields in Patch requests.
  728. NullFields []string `json:"-"`
  729. }
  730. func (s *TestCase) MarshalJSON() ([]byte, error) {
  731. type NoMethod TestCase
  732. raw := NoMethod(*s)
  733. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  734. }
  735. // TestResult: Test result message containing the state of the test as
  736. // well as a
  737. // description and source position for test failures.
  738. type TestResult struct {
  739. // DebugMessages: Debug messages related to test execution issues
  740. // encountered during
  741. // evaluation.
  742. //
  743. // Debug messages may be related to too many or too few invocations
  744. // of
  745. // function mocks or to runtime errors that occur during
  746. // evaluation.
  747. //
  748. // For example: ```Unable to read variable [name: "resource"]```
  749. DebugMessages []string `json:"debugMessages,omitempty"`
  750. // ErrorPosition: Position in the `Source` or `Ruleset` where the
  751. // principle runtime error
  752. // occurs.
  753. //
  754. // Evaluation of an expression may result in an error. Rules are deny
  755. // by
  756. // default, so a `DENY` expectation when an error is generated is
  757. // valid.
  758. // When there is a `DENY` with an error, the `SourcePosition` is
  759. // returned.
  760. //
  761. // E.g. `error_position { line: 19 column: 37 }`
  762. ErrorPosition *SourcePosition `json:"errorPosition,omitempty"`
  763. // FunctionCalls: The set of function calls made to service-defined
  764. // methods.
  765. //
  766. // Function calls are included in the order in which they are
  767. // encountered
  768. // during evaluation, are provided for both mocked and unmocked
  769. // functions,
  770. // and included on the response regardless of the test `state`.
  771. FunctionCalls []*FunctionCall `json:"functionCalls,omitempty"`
  772. // State: State of the test.
  773. //
  774. // Possible values:
  775. // "STATE_UNSPECIFIED" - Test state is not set.
  776. // "SUCCESS" - Test is a success.
  777. // "FAILURE" - Test is a failure.
  778. State string `json:"state,omitempty"`
  779. // VisitedExpressions: The set of visited expressions for a given test.
  780. // This returns positions
  781. // and evaluation results of all visited expressions.
  782. VisitedExpressions []*VisitedExpression `json:"visitedExpressions,omitempty"`
  783. // ForceSendFields is a list of field names (e.g. "DebugMessages") to
  784. // unconditionally include in API requests. By default, fields with
  785. // empty values are omitted from API requests. However, any non-pointer,
  786. // non-interface field appearing in ForceSendFields will be sent to the
  787. // server regardless of whether the field is empty or not. This may be
  788. // used to include empty fields in Patch requests.
  789. ForceSendFields []string `json:"-"`
  790. // NullFields is a list of field names (e.g. "DebugMessages") to include
  791. // in API requests with the JSON null value. By default, fields with
  792. // empty values are omitted from API requests. However, any field with
  793. // an empty value appearing in NullFields will be sent to the server as
  794. // null. It is an error if a field in this list has a non-empty value.
  795. // This may be used to include null fields in Patch requests.
  796. NullFields []string `json:"-"`
  797. }
  798. func (s *TestResult) MarshalJSON() ([]byte, error) {
  799. type NoMethod TestResult
  800. raw := NoMethod(*s)
  801. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  802. }
  803. // TestRulesetRequest: The request for FirebaseRulesService.TestRuleset.
  804. type TestRulesetRequest struct {
  805. // Source: Optional `Source` to be checked for correctness.
  806. //
  807. // This field must not be set when the resource name refers to a
  808. // `Ruleset`.
  809. Source *Source `json:"source,omitempty"`
  810. // TestSuite: Inline `TestSuite` to run.
  811. TestSuite *TestSuite `json:"testSuite,omitempty"`
  812. // ForceSendFields is a list of field names (e.g. "Source") to
  813. // unconditionally include in API requests. By default, fields with
  814. // empty values are omitted from API requests. However, any non-pointer,
  815. // non-interface field appearing in ForceSendFields will be sent to the
  816. // server regardless of whether the field is empty or not. This may be
  817. // used to include empty fields in Patch requests.
  818. ForceSendFields []string `json:"-"`
  819. // NullFields is a list of field names (e.g. "Source") to include in API
  820. // requests with the JSON null value. By default, fields with empty
  821. // values are omitted from API requests. However, any field with an
  822. // empty value appearing in NullFields will be sent to the server as
  823. // null. It is an error if a field in this list has a non-empty value.
  824. // This may be used to include null fields in Patch requests.
  825. NullFields []string `json:"-"`
  826. }
  827. func (s *TestRulesetRequest) MarshalJSON() ([]byte, error) {
  828. type NoMethod TestRulesetRequest
  829. raw := NoMethod(*s)
  830. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  831. }
  832. // TestRulesetResponse: The response for
  833. // FirebaseRulesService.TestRuleset.
  834. type TestRulesetResponse struct {
  835. // Issues: Syntactic and semantic `Source` issues of varying severity.
  836. // Issues of
  837. // `ERROR` severity will prevent tests from executing.
  838. Issues []*Issue `json:"issues,omitempty"`
  839. // TestResults: The set of test results given the test cases in the
  840. // `TestSuite`.
  841. // The results will appear in the same order as the test cases appear in
  842. // the
  843. // `TestSuite`.
  844. TestResults []*TestResult `json:"testResults,omitempty"`
  845. // ServerResponse contains the HTTP response code and headers from the
  846. // server.
  847. googleapi.ServerResponse `json:"-"`
  848. // ForceSendFields is a list of field names (e.g. "Issues") to
  849. // unconditionally include in API requests. By default, fields with
  850. // empty values are omitted from API requests. However, any non-pointer,
  851. // non-interface field appearing in ForceSendFields will be sent to the
  852. // server regardless of whether the field is empty or not. This may be
  853. // used to include empty fields in Patch requests.
  854. ForceSendFields []string `json:"-"`
  855. // NullFields is a list of field names (e.g. "Issues") to include in API
  856. // requests with the JSON null value. By default, fields with empty
  857. // values are omitted from API requests. However, any field with an
  858. // empty value appearing in NullFields will be sent to the server as
  859. // null. It is an error if a field in this list has a non-empty value.
  860. // This may be used to include null fields in Patch requests.
  861. NullFields []string `json:"-"`
  862. }
  863. func (s *TestRulesetResponse) MarshalJSON() ([]byte, error) {
  864. type NoMethod TestRulesetResponse
  865. raw := NoMethod(*s)
  866. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  867. }
  868. // TestSuite: `TestSuite` is a collection of `TestCase` instances that
  869. // validate the logical
  870. // correctness of a `Ruleset`. The `TestSuite` may be referenced in-line
  871. // within
  872. // a `TestRuleset` invocation or as part of a `Release` object as a
  873. // pre-release
  874. // check.
  875. type TestSuite struct {
  876. // TestCases: Collection of test cases associated with the `TestSuite`.
  877. TestCases []*TestCase `json:"testCases,omitempty"`
  878. // ForceSendFields is a list of field names (e.g. "TestCases") to
  879. // unconditionally include in API requests. By default, fields with
  880. // empty values are omitted from API requests. However, any non-pointer,
  881. // non-interface field appearing in ForceSendFields will be sent to the
  882. // server regardless of whether the field is empty or not. This may be
  883. // used to include empty fields in Patch requests.
  884. ForceSendFields []string `json:"-"`
  885. // NullFields is a list of field names (e.g. "TestCases") to include in
  886. // API requests with the JSON null value. By default, fields with empty
  887. // values are omitted from API requests. However, any field with an
  888. // empty value appearing in NullFields will be sent to the server as
  889. // null. It is an error if a field in this list has a non-empty value.
  890. // This may be used to include null fields in Patch requests.
  891. NullFields []string `json:"-"`
  892. }
  893. func (s *TestSuite) MarshalJSON() ([]byte, error) {
  894. type NoMethod TestSuite
  895. raw := NoMethod(*s)
  896. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  897. }
  898. // UpdateReleaseRequest: The request for
  899. // FirebaseRulesService.UpdateReleasePatch.
  900. type UpdateReleaseRequest struct {
  901. // Release: `Release` to update.
  902. Release *Release `json:"release,omitempty"`
  903. // UpdateMask: Specifies which fields to update.
  904. UpdateMask string `json:"updateMask,omitempty"`
  905. // ForceSendFields is a list of field names (e.g. "Release") to
  906. // unconditionally include in API requests. By default, fields with
  907. // empty values are omitted from API requests. However, any non-pointer,
  908. // non-interface field appearing in ForceSendFields will be sent to the
  909. // server regardless of whether the field is empty or not. This may be
  910. // used to include empty fields in Patch requests.
  911. ForceSendFields []string `json:"-"`
  912. // NullFields is a list of field names (e.g. "Release") to include in
  913. // API requests with the JSON null value. By default, fields with empty
  914. // values are omitted from API requests. However, any field with an
  915. // empty value appearing in NullFields will be sent to the server as
  916. // null. It is an error if a field in this list has a non-empty value.
  917. // This may be used to include null fields in Patch requests.
  918. NullFields []string `json:"-"`
  919. }
  920. func (s *UpdateReleaseRequest) MarshalJSON() ([]byte, error) {
  921. type NoMethod UpdateReleaseRequest
  922. raw := NoMethod(*s)
  923. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  924. }
  925. // VisitedExpression: Store the position and access outcome for an
  926. // expression visited in rules.
  927. type VisitedExpression struct {
  928. // SourcePosition: Position in the `Source` or `Ruleset` where an
  929. // expression was visited.
  930. SourcePosition *SourcePosition `json:"sourcePosition,omitempty"`
  931. // Value: The evaluated value for the visited expression, e.g.
  932. // true/false
  933. Value interface{} `json:"value,omitempty"`
  934. // ForceSendFields is a list of field names (e.g. "SourcePosition") to
  935. // unconditionally include in API requests. By default, fields with
  936. // empty values are omitted from API requests. However, any non-pointer,
  937. // non-interface field appearing in ForceSendFields will be sent to the
  938. // server regardless of whether the field is empty or not. This may be
  939. // used to include empty fields in Patch requests.
  940. ForceSendFields []string `json:"-"`
  941. // NullFields is a list of field names (e.g. "SourcePosition") to
  942. // include in API requests with the JSON null value. By default, fields
  943. // with empty values are omitted from API requests. However, any field
  944. // with an empty value appearing in NullFields will be sent to the
  945. // server as null. It is an error if a field in this list has a
  946. // non-empty value. This may be used to include null fields in Patch
  947. // requests.
  948. NullFields []string `json:"-"`
  949. }
  950. func (s *VisitedExpression) MarshalJSON() ([]byte, error) {
  951. type NoMethod VisitedExpression
  952. raw := NoMethod(*s)
  953. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  954. }
  955. // method id "firebaserules.projects.test":
  956. type ProjectsTestCall struct {
  957. s *Service
  958. name string
  959. testrulesetrequest *TestRulesetRequest
  960. urlParams_ gensupport.URLParams
  961. ctx_ context.Context
  962. header_ http.Header
  963. }
  964. // Test: Test `Source` for syntactic and semantic correctness. Issues
  965. // present, if
  966. // any, will be returned to the caller with a description, severity,
  967. // and
  968. // source location.
  969. //
  970. // The test method may be executed with `Source` or a `Ruleset`
  971. // name.
  972. // Passing `Source` is useful for unit testing new rules. Passing a
  973. // `Ruleset`
  974. // name is useful for regression testing an existing rule.
  975. //
  976. // The following is an example of `Source` that permits users to upload
  977. // images
  978. // to a bucket bearing their user id and matching the correct
  979. // metadata:
  980. //
  981. // _*Example*_
  982. //
  983. // // Users are allowed to subscribe and unsubscribe to the blog.
  984. // service firebase.storage {
  985. // match /users/{userId}/images/{imageName} {
  986. // allow write: if userId == request.auth.uid
  987. // && (imageName.matches('*.png$')
  988. // || imageName.matches('*.jpg$'))
  989. // && resource.mimeType.matches('^image/')
  990. // }
  991. // }
  992. func (r *ProjectsService) Test(name string, testrulesetrequest *TestRulesetRequest) *ProjectsTestCall {
  993. c := &ProjectsTestCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  994. c.name = name
  995. c.testrulesetrequest = testrulesetrequest
  996. return c
  997. }
  998. // Fields allows partial responses to be retrieved. See
  999. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1000. // for more information.
  1001. func (c *ProjectsTestCall) Fields(s ...googleapi.Field) *ProjectsTestCall {
  1002. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1003. return c
  1004. }
  1005. // Context sets the context to be used in this call's Do method. Any
  1006. // pending HTTP request will be aborted if the provided context is
  1007. // canceled.
  1008. func (c *ProjectsTestCall) Context(ctx context.Context) *ProjectsTestCall {
  1009. c.ctx_ = ctx
  1010. return c
  1011. }
  1012. // Header returns an http.Header that can be modified by the caller to
  1013. // add HTTP headers to the request.
  1014. func (c *ProjectsTestCall) Header() http.Header {
  1015. if c.header_ == nil {
  1016. c.header_ = make(http.Header)
  1017. }
  1018. return c.header_
  1019. }
  1020. func (c *ProjectsTestCall) doRequest(alt string) (*http.Response, error) {
  1021. reqHeaders := make(http.Header)
  1022. for k, v := range c.header_ {
  1023. reqHeaders[k] = v
  1024. }
  1025. reqHeaders.Set("User-Agent", c.s.userAgent())
  1026. var body io.Reader = nil
  1027. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testrulesetrequest)
  1028. if err != nil {
  1029. return nil, err
  1030. }
  1031. reqHeaders.Set("Content-Type", "application/json")
  1032. c.urlParams_.Set("alt", alt)
  1033. c.urlParams_.Set("prettyPrint", "false")
  1034. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:test")
  1035. urls += "?" + c.urlParams_.Encode()
  1036. req, err := http.NewRequest("POST", urls, body)
  1037. if err != nil {
  1038. return nil, err
  1039. }
  1040. req.Header = reqHeaders
  1041. googleapi.Expand(req.URL, map[string]string{
  1042. "name": c.name,
  1043. })
  1044. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1045. }
  1046. // Do executes the "firebaserules.projects.test" call.
  1047. // Exactly one of *TestRulesetResponse or error will be non-nil. Any
  1048. // non-2xx status code is an error. Response headers are in either
  1049. // *TestRulesetResponse.ServerResponse.Header or (if a response was
  1050. // returned at all) in error.(*googleapi.Error).Header. Use
  1051. // googleapi.IsNotModified to check whether the returned error was
  1052. // because http.StatusNotModified was returned.
  1053. func (c *ProjectsTestCall) Do(opts ...googleapi.CallOption) (*TestRulesetResponse, error) {
  1054. gensupport.SetOptions(c.urlParams_, opts...)
  1055. res, err := c.doRequest("json")
  1056. if res != nil && res.StatusCode == http.StatusNotModified {
  1057. if res.Body != nil {
  1058. res.Body.Close()
  1059. }
  1060. return nil, &googleapi.Error{
  1061. Code: res.StatusCode,
  1062. Header: res.Header,
  1063. }
  1064. }
  1065. if err != nil {
  1066. return nil, err
  1067. }
  1068. defer googleapi.CloseBody(res)
  1069. if err := googleapi.CheckResponse(res); err != nil {
  1070. return nil, err
  1071. }
  1072. ret := &TestRulesetResponse{
  1073. ServerResponse: googleapi.ServerResponse{
  1074. Header: res.Header,
  1075. HTTPStatusCode: res.StatusCode,
  1076. },
  1077. }
  1078. target := &ret
  1079. if err := gensupport.DecodeResponse(target, res); err != nil {
  1080. return nil, err
  1081. }
  1082. return ret, nil
  1083. // {
  1084. // "description": "Test `Source` for syntactic and semantic correctness. Issues present, if\nany, will be returned to the caller with a description, severity, and\nsource location.\n\nThe test method may be executed with `Source` or a `Ruleset` name.\nPassing `Source` is useful for unit testing new rules. Passing a `Ruleset`\nname is useful for regression testing an existing rule.\n\nThe following is an example of `Source` that permits users to upload images\nto a bucket bearing their user id and matching the correct metadata:\n\n_*Example*_\n\n // Users are allowed to subscribe and unsubscribe to the blog.\n service firebase.storage {\n match /users/{userId}/images/{imageName} {\n allow write: if userId == request.auth.uid\n \u0026\u0026 (imageName.matches('*.png$')\n || imageName.matches('*.jpg$'))\n \u0026\u0026 resource.mimeType.matches('^image/')\n }\n }",
  1085. // "flatPath": "v1/projects/{projectsId}:test",
  1086. // "httpMethod": "POST",
  1087. // "id": "firebaserules.projects.test",
  1088. // "parameterOrder": [
  1089. // "name"
  1090. // ],
  1091. // "parameters": {
  1092. // "name": {
  1093. // "description": "Tests may either provide `source` or a `Ruleset` resource name.\n\nFor tests against `source`, the resource name must refer to the project:\nFormat: `projects/{project_id}`\n\nFor tests against a `Ruleset`, this must be the `Ruleset` resource name:\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`",
  1094. // "location": "path",
  1095. // "pattern": "^projects/.+$",
  1096. // "required": true,
  1097. // "type": "string"
  1098. // }
  1099. // },
  1100. // "path": "v1/{+name}:test",
  1101. // "request": {
  1102. // "$ref": "TestRulesetRequest"
  1103. // },
  1104. // "response": {
  1105. // "$ref": "TestRulesetResponse"
  1106. // },
  1107. // "scopes": [
  1108. // "https://www.googleapis.com/auth/cloud-platform",
  1109. // "https://www.googleapis.com/auth/firebase",
  1110. // "https://www.googleapis.com/auth/firebase.readonly"
  1111. // ]
  1112. // }
  1113. }
  1114. // method id "firebaserules.projects.releases.create":
  1115. type ProjectsReleasesCreateCall struct {
  1116. s *Service
  1117. name string
  1118. release *Release
  1119. urlParams_ gensupport.URLParams
  1120. ctx_ context.Context
  1121. header_ http.Header
  1122. }
  1123. // Create: Create a `Release`.
  1124. //
  1125. // Release names should reflect the developer's deployment practices.
  1126. // For
  1127. // example, the release name may include the environment name,
  1128. // application
  1129. // name, application version, or any other name meaningful to the
  1130. // developer.
  1131. // Once a `Release` refers to a `Ruleset`, the rules can be enforced
  1132. // by
  1133. // Firebase Rules-enabled services.
  1134. //
  1135. // More than one `Release` may be 'live' concurrently. Consider the
  1136. // following
  1137. // three `Release` names for `projects/foo` and the `Ruleset` to which
  1138. // they
  1139. // refer.
  1140. //
  1141. // Release Name | Ruleset
  1142. // Name
  1143. // --------------------------------|-------------
  1144. // projects/foo/relea
  1145. // ses/prod |
  1146. // projects/foo/rulesets/uuid123
  1147. // projects/foo/releases/prod/beta |
  1148. // projects/foo/rulesets/uuid123
  1149. // projects/foo/releases/prod/v23 | projects/foo/rulesets/uuid456
  1150. //
  1151. // The table reflects the `Ruleset` rollout in progress. The `prod`
  1152. // and
  1153. // `prod/beta` releases refer to the same `Ruleset`. However,
  1154. // `prod/v23`
  1155. // refers to a new `Ruleset`. The `Ruleset` reference for a `Release`
  1156. // may be
  1157. // updated using the UpdateRelease method.
  1158. func (r *ProjectsReleasesService) Create(name string, release *Release) *ProjectsReleasesCreateCall {
  1159. c := &ProjectsReleasesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1160. c.name = name
  1161. c.release = release
  1162. return c
  1163. }
  1164. // Fields allows partial responses to be retrieved. See
  1165. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1166. // for more information.
  1167. func (c *ProjectsReleasesCreateCall) Fields(s ...googleapi.Field) *ProjectsReleasesCreateCall {
  1168. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1169. return c
  1170. }
  1171. // Context sets the context to be used in this call's Do method. Any
  1172. // pending HTTP request will be aborted if the provided context is
  1173. // canceled.
  1174. func (c *ProjectsReleasesCreateCall) Context(ctx context.Context) *ProjectsReleasesCreateCall {
  1175. c.ctx_ = ctx
  1176. return c
  1177. }
  1178. // Header returns an http.Header that can be modified by the caller to
  1179. // add HTTP headers to the request.
  1180. func (c *ProjectsReleasesCreateCall) Header() http.Header {
  1181. if c.header_ == nil {
  1182. c.header_ = make(http.Header)
  1183. }
  1184. return c.header_
  1185. }
  1186. func (c *ProjectsReleasesCreateCall) doRequest(alt string) (*http.Response, error) {
  1187. reqHeaders := make(http.Header)
  1188. for k, v := range c.header_ {
  1189. reqHeaders[k] = v
  1190. }
  1191. reqHeaders.Set("User-Agent", c.s.userAgent())
  1192. var body io.Reader = nil
  1193. body, err := googleapi.WithoutDataWrapper.JSONReader(c.release)
  1194. if err != nil {
  1195. return nil, err
  1196. }
  1197. reqHeaders.Set("Content-Type", "application/json")
  1198. c.urlParams_.Set("alt", alt)
  1199. c.urlParams_.Set("prettyPrint", "false")
  1200. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/releases")
  1201. urls += "?" + c.urlParams_.Encode()
  1202. req, err := http.NewRequest("POST", urls, body)
  1203. if err != nil {
  1204. return nil, err
  1205. }
  1206. req.Header = reqHeaders
  1207. googleapi.Expand(req.URL, map[string]string{
  1208. "name": c.name,
  1209. })
  1210. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1211. }
  1212. // Do executes the "firebaserules.projects.releases.create" call.
  1213. // Exactly one of *Release or error will be non-nil. Any non-2xx status
  1214. // code is an error. Response headers are in either
  1215. // *Release.ServerResponse.Header or (if a response was returned at all)
  1216. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1217. // check whether the returned error was because http.StatusNotModified
  1218. // was returned.
  1219. func (c *ProjectsReleasesCreateCall) Do(opts ...googleapi.CallOption) (*Release, error) {
  1220. gensupport.SetOptions(c.urlParams_, opts...)
  1221. res, err := c.doRequest("json")
  1222. if res != nil && res.StatusCode == http.StatusNotModified {
  1223. if res.Body != nil {
  1224. res.Body.Close()
  1225. }
  1226. return nil, &googleapi.Error{
  1227. Code: res.StatusCode,
  1228. Header: res.Header,
  1229. }
  1230. }
  1231. if err != nil {
  1232. return nil, err
  1233. }
  1234. defer googleapi.CloseBody(res)
  1235. if err := googleapi.CheckResponse(res); err != nil {
  1236. return nil, err
  1237. }
  1238. ret := &Release{
  1239. ServerResponse: googleapi.ServerResponse{
  1240. Header: res.Header,
  1241. HTTPStatusCode: res.StatusCode,
  1242. },
  1243. }
  1244. target := &ret
  1245. if err := gensupport.DecodeResponse(target, res); err != nil {
  1246. return nil, err
  1247. }
  1248. return ret, nil
  1249. // {
  1250. // "description": "Create a `Release`.\n\nRelease names should reflect the developer's deployment practices. For\nexample, the release name may include the environment name, application\nname, application version, or any other name meaningful to the developer.\nOnce a `Release` refers to a `Ruleset`, the rules can be enforced by\nFirebase Rules-enabled services.\n\nMore than one `Release` may be 'live' concurrently. Consider the following\nthree `Release` names for `projects/foo` and the `Ruleset` to which they\nrefer.\n\nRelease Name | Ruleset Name\n--------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/uuid123\nprojects/foo/releases/prod/beta | projects/foo/rulesets/uuid123\nprojects/foo/releases/prod/v23 | projects/foo/rulesets/uuid456\n\nThe table reflects the `Ruleset` rollout in progress. The `prod` and\n`prod/beta` releases refer to the same `Ruleset`. However, `prod/v23`\nrefers to a new `Ruleset`. The `Ruleset` reference for a `Release` may be\nupdated using the UpdateRelease method.",
  1251. // "flatPath": "v1/projects/{projectsId}/releases",
  1252. // "httpMethod": "POST",
  1253. // "id": "firebaserules.projects.releases.create",
  1254. // "parameterOrder": [
  1255. // "name"
  1256. // ],
  1257. // "parameters": {
  1258. // "name": {
  1259. // "description": "Resource name for the project which owns this `Release`.\n\nFormat: `projects/{project_id}`",
  1260. // "location": "path",
  1261. // "pattern": "^projects/[^/]+$",
  1262. // "required": true,
  1263. // "type": "string"
  1264. // }
  1265. // },
  1266. // "path": "v1/{+name}/releases",
  1267. // "request": {
  1268. // "$ref": "Release"
  1269. // },
  1270. // "response": {
  1271. // "$ref": "Release"
  1272. // },
  1273. // "scopes": [
  1274. // "https://www.googleapis.com/auth/cloud-platform",
  1275. // "https://www.googleapis.com/auth/firebase"
  1276. // ]
  1277. // }
  1278. }
  1279. // method id "firebaserules.projects.releases.delete":
  1280. type ProjectsReleasesDeleteCall struct {
  1281. s *Service
  1282. name string
  1283. urlParams_ gensupport.URLParams
  1284. ctx_ context.Context
  1285. header_ http.Header
  1286. }
  1287. // Delete: Delete a `Release` by resource name.
  1288. func (r *ProjectsReleasesService) Delete(name string) *ProjectsReleasesDeleteCall {
  1289. c := &ProjectsReleasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1290. c.name = name
  1291. return c
  1292. }
  1293. // Fields allows partial responses to be retrieved. See
  1294. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1295. // for more information.
  1296. func (c *ProjectsReleasesDeleteCall) Fields(s ...googleapi.Field) *ProjectsReleasesDeleteCall {
  1297. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1298. return c
  1299. }
  1300. // Context sets the context to be used in this call's Do method. Any
  1301. // pending HTTP request will be aborted if the provided context is
  1302. // canceled.
  1303. func (c *ProjectsReleasesDeleteCall) Context(ctx context.Context) *ProjectsReleasesDeleteCall {
  1304. c.ctx_ = ctx
  1305. return c
  1306. }
  1307. // Header returns an http.Header that can be modified by the caller to
  1308. // add HTTP headers to the request.
  1309. func (c *ProjectsReleasesDeleteCall) Header() http.Header {
  1310. if c.header_ == nil {
  1311. c.header_ = make(http.Header)
  1312. }
  1313. return c.header_
  1314. }
  1315. func (c *ProjectsReleasesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1316. reqHeaders := make(http.Header)
  1317. for k, v := range c.header_ {
  1318. reqHeaders[k] = v
  1319. }
  1320. reqHeaders.Set("User-Agent", c.s.userAgent())
  1321. var body io.Reader = nil
  1322. c.urlParams_.Set("alt", alt)
  1323. c.urlParams_.Set("prettyPrint", "false")
  1324. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1325. urls += "?" + c.urlParams_.Encode()
  1326. req, err := http.NewRequest("DELETE", urls, body)
  1327. if err != nil {
  1328. return nil, err
  1329. }
  1330. req.Header = reqHeaders
  1331. googleapi.Expand(req.URL, map[string]string{
  1332. "name": c.name,
  1333. })
  1334. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1335. }
  1336. // Do executes the "firebaserules.projects.releases.delete" call.
  1337. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1338. // code is an error. Response headers are in either
  1339. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1340. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1341. // check whether the returned error was because http.StatusNotModified
  1342. // was returned.
  1343. func (c *ProjectsReleasesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1344. gensupport.SetOptions(c.urlParams_, opts...)
  1345. res, err := c.doRequest("json")
  1346. if res != nil && res.StatusCode == http.StatusNotModified {
  1347. if res.Body != nil {
  1348. res.Body.Close()
  1349. }
  1350. return nil, &googleapi.Error{
  1351. Code: res.StatusCode,
  1352. Header: res.Header,
  1353. }
  1354. }
  1355. if err != nil {
  1356. return nil, err
  1357. }
  1358. defer googleapi.CloseBody(res)
  1359. if err := googleapi.CheckResponse(res); err != nil {
  1360. return nil, err
  1361. }
  1362. ret := &Empty{
  1363. ServerResponse: googleapi.ServerResponse{
  1364. Header: res.Header,
  1365. HTTPStatusCode: res.StatusCode,
  1366. },
  1367. }
  1368. target := &ret
  1369. if err := gensupport.DecodeResponse(target, res); err != nil {
  1370. return nil, err
  1371. }
  1372. return ret, nil
  1373. // {
  1374. // "description": "Delete a `Release` by resource name.",
  1375. // "flatPath": "v1/projects/{projectsId}/releases/{releasesId}",
  1376. // "httpMethod": "DELETE",
  1377. // "id": "firebaserules.projects.releases.delete",
  1378. // "parameterOrder": [
  1379. // "name"
  1380. // ],
  1381. // "parameters": {
  1382. // "name": {
  1383. // "description": "Resource name for the `Release` to delete.\n\nFormat: `projects/{project_id}/releases/{release_id}`",
  1384. // "location": "path",
  1385. // "pattern": "^projects/[^/]+/releases/.+$",
  1386. // "required": true,
  1387. // "type": "string"
  1388. // }
  1389. // },
  1390. // "path": "v1/{+name}",
  1391. // "response": {
  1392. // "$ref": "Empty"
  1393. // },
  1394. // "scopes": [
  1395. // "https://www.googleapis.com/auth/cloud-platform",
  1396. // "https://www.googleapis.com/auth/firebase"
  1397. // ]
  1398. // }
  1399. }
  1400. // method id "firebaserules.projects.releases.get":
  1401. type ProjectsReleasesGetCall struct {
  1402. s *Service
  1403. name string
  1404. urlParams_ gensupport.URLParams
  1405. ifNoneMatch_ string
  1406. ctx_ context.Context
  1407. header_ http.Header
  1408. }
  1409. // Get: Get a `Release` by name.
  1410. func (r *ProjectsReleasesService) Get(name string) *ProjectsReleasesGetCall {
  1411. c := &ProjectsReleasesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1412. c.name = name
  1413. return c
  1414. }
  1415. // Fields allows partial responses to be retrieved. See
  1416. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1417. // for more information.
  1418. func (c *ProjectsReleasesGetCall) Fields(s ...googleapi.Field) *ProjectsReleasesGetCall {
  1419. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1420. return c
  1421. }
  1422. // IfNoneMatch sets the optional parameter which makes the operation
  1423. // fail if the object's ETag matches the given value. This is useful for
  1424. // getting updates only after the object has changed since the last
  1425. // request. Use googleapi.IsNotModified to check whether the response
  1426. // error from Do is the result of In-None-Match.
  1427. func (c *ProjectsReleasesGetCall) IfNoneMatch(entityTag string) *ProjectsReleasesGetCall {
  1428. c.ifNoneMatch_ = entityTag
  1429. return c
  1430. }
  1431. // Context sets the context to be used in this call's Do method. Any
  1432. // pending HTTP request will be aborted if the provided context is
  1433. // canceled.
  1434. func (c *ProjectsReleasesGetCall) Context(ctx context.Context) *ProjectsReleasesGetCall {
  1435. c.ctx_ = ctx
  1436. return c
  1437. }
  1438. // Header returns an http.Header that can be modified by the caller to
  1439. // add HTTP headers to the request.
  1440. func (c *ProjectsReleasesGetCall) Header() http.Header {
  1441. if c.header_ == nil {
  1442. c.header_ = make(http.Header)
  1443. }
  1444. return c.header_
  1445. }
  1446. func (c *ProjectsReleasesGetCall) doRequest(alt string) (*http.Response, error) {
  1447. reqHeaders := make(http.Header)
  1448. for k, v := range c.header_ {
  1449. reqHeaders[k] = v
  1450. }
  1451. reqHeaders.Set("User-Agent", c.s.userAgent())
  1452. if c.ifNoneMatch_ != "" {
  1453. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1454. }
  1455. var body io.Reader = nil
  1456. c.urlParams_.Set("alt", alt)
  1457. c.urlParams_.Set("prettyPrint", "false")
  1458. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1459. urls += "?" + c.urlParams_.Encode()
  1460. req, err := http.NewRequest("GET", urls, body)
  1461. if err != nil {
  1462. return nil, err
  1463. }
  1464. req.Header = reqHeaders
  1465. googleapi.Expand(req.URL, map[string]string{
  1466. "name": c.name,
  1467. })
  1468. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1469. }
  1470. // Do executes the "firebaserules.projects.releases.get" call.
  1471. // Exactly one of *Release or error will be non-nil. Any non-2xx status
  1472. // code is an error. Response headers are in either
  1473. // *Release.ServerResponse.Header or (if a response was returned at all)
  1474. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1475. // check whether the returned error was because http.StatusNotModified
  1476. // was returned.
  1477. func (c *ProjectsReleasesGetCall) Do(opts ...googleapi.CallOption) (*Release, error) {
  1478. gensupport.SetOptions(c.urlParams_, opts...)
  1479. res, err := c.doRequest("json")
  1480. if res != nil && res.StatusCode == http.StatusNotModified {
  1481. if res.Body != nil {
  1482. res.Body.Close()
  1483. }
  1484. return nil, &googleapi.Error{
  1485. Code: res.StatusCode,
  1486. Header: res.Header,
  1487. }
  1488. }
  1489. if err != nil {
  1490. return nil, err
  1491. }
  1492. defer googleapi.CloseBody(res)
  1493. if err := googleapi.CheckResponse(res); err != nil {
  1494. return nil, err
  1495. }
  1496. ret := &Release{
  1497. ServerResponse: googleapi.ServerResponse{
  1498. Header: res.Header,
  1499. HTTPStatusCode: res.StatusCode,
  1500. },
  1501. }
  1502. target := &ret
  1503. if err := gensupport.DecodeResponse(target, res); err != nil {
  1504. return nil, err
  1505. }
  1506. return ret, nil
  1507. // {
  1508. // "description": "Get a `Release` by name.",
  1509. // "flatPath": "v1/projects/{projectsId}/releases/{releasesId}",
  1510. // "httpMethod": "GET",
  1511. // "id": "firebaserules.projects.releases.get",
  1512. // "parameterOrder": [
  1513. // "name"
  1514. // ],
  1515. // "parameters": {
  1516. // "name": {
  1517. // "description": "Resource name of the `Release`.\n\nFormat: `projects/{project_id}/releases/{release_id}`",
  1518. // "location": "path",
  1519. // "pattern": "^projects/[^/]+/releases/.+$",
  1520. // "required": true,
  1521. // "type": "string"
  1522. // }
  1523. // },
  1524. // "path": "v1/{+name}",
  1525. // "response": {
  1526. // "$ref": "Release"
  1527. // },
  1528. // "scopes": [
  1529. // "https://www.googleapis.com/auth/cloud-platform",
  1530. // "https://www.googleapis.com/auth/firebase",
  1531. // "https://www.googleapis.com/auth/firebase.readonly"
  1532. // ]
  1533. // }
  1534. }
  1535. // method id "firebaserules.projects.releases.getExecutable":
  1536. type ProjectsReleasesGetExecutableCall struct {
  1537. s *Service
  1538. name string
  1539. urlParams_ gensupport.URLParams
  1540. ifNoneMatch_ string
  1541. ctx_ context.Context
  1542. header_ http.Header
  1543. }
  1544. // GetExecutable: Get the `Release` executable to use when enforcing
  1545. // rules.
  1546. func (r *ProjectsReleasesService) GetExecutable(name string) *ProjectsReleasesGetExecutableCall {
  1547. c := &ProjectsReleasesGetExecutableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1548. c.name = name
  1549. return c
  1550. }
  1551. // ExecutableVersion sets the optional parameter "executableVersion":
  1552. // The requested runtime executable version.
  1553. // Defaults to FIREBASE_RULES_EXECUTABLE_V1.
  1554. //
  1555. // Possible values:
  1556. // "RELEASE_EXECUTABLE_VERSION_UNSPECIFIED"
  1557. // "FIREBASE_RULES_EXECUTABLE_V1"
  1558. // "FIREBASE_RULES_EXECUTABLE_V2"
  1559. func (c *ProjectsReleasesGetExecutableCall) ExecutableVersion(executableVersion string) *ProjectsReleasesGetExecutableCall {
  1560. c.urlParams_.Set("executableVersion", executableVersion)
  1561. return c
  1562. }
  1563. // Fields allows partial responses to be retrieved. See
  1564. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1565. // for more information.
  1566. func (c *ProjectsReleasesGetExecutableCall) Fields(s ...googleapi.Field) *ProjectsReleasesGetExecutableCall {
  1567. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1568. return c
  1569. }
  1570. // IfNoneMatch sets the optional parameter which makes the operation
  1571. // fail if the object's ETag matches the given value. This is useful for
  1572. // getting updates only after the object has changed since the last
  1573. // request. Use googleapi.IsNotModified to check whether the response
  1574. // error from Do is the result of In-None-Match.
  1575. func (c *ProjectsReleasesGetExecutableCall) IfNoneMatch(entityTag string) *ProjectsReleasesGetExecutableCall {
  1576. c.ifNoneMatch_ = entityTag
  1577. return c
  1578. }
  1579. // Context sets the context to be used in this call's Do method. Any
  1580. // pending HTTP request will be aborted if the provided context is
  1581. // canceled.
  1582. func (c *ProjectsReleasesGetExecutableCall) Context(ctx context.Context) *ProjectsReleasesGetExecutableCall {
  1583. c.ctx_ = ctx
  1584. return c
  1585. }
  1586. // Header returns an http.Header that can be modified by the caller to
  1587. // add HTTP headers to the request.
  1588. func (c *ProjectsReleasesGetExecutableCall) Header() http.Header {
  1589. if c.header_ == nil {
  1590. c.header_ = make(http.Header)
  1591. }
  1592. return c.header_
  1593. }
  1594. func (c *ProjectsReleasesGetExecutableCall) doRequest(alt string) (*http.Response, error) {
  1595. reqHeaders := make(http.Header)
  1596. for k, v := range c.header_ {
  1597. reqHeaders[k] = v
  1598. }
  1599. reqHeaders.Set("User-Agent", c.s.userAgent())
  1600. if c.ifNoneMatch_ != "" {
  1601. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1602. }
  1603. var body io.Reader = nil
  1604. c.urlParams_.Set("alt", alt)
  1605. c.urlParams_.Set("prettyPrint", "false")
  1606. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:getExecutable")
  1607. urls += "?" + c.urlParams_.Encode()
  1608. req, err := http.NewRequest("GET", urls, body)
  1609. if err != nil {
  1610. return nil, err
  1611. }
  1612. req.Header = reqHeaders
  1613. googleapi.Expand(req.URL, map[string]string{
  1614. "name": c.name,
  1615. })
  1616. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1617. }
  1618. // Do executes the "firebaserules.projects.releases.getExecutable" call.
  1619. // Exactly one of *GetReleaseExecutableResponse or error will be
  1620. // non-nil. Any non-2xx status code is an error. Response headers are in
  1621. // either *GetReleaseExecutableResponse.ServerResponse.Header or (if a
  1622. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1623. // googleapi.IsNotModified to check whether the returned error was
  1624. // because http.StatusNotModified was returned.
  1625. func (c *ProjectsReleasesGetExecutableCall) Do(opts ...googleapi.CallOption) (*GetReleaseExecutableResponse, error) {
  1626. gensupport.SetOptions(c.urlParams_, opts...)
  1627. res, err := c.doRequest("json")
  1628. if res != nil && res.StatusCode == http.StatusNotModified {
  1629. if res.Body != nil {
  1630. res.Body.Close()
  1631. }
  1632. return nil, &googleapi.Error{
  1633. Code: res.StatusCode,
  1634. Header: res.Header,
  1635. }
  1636. }
  1637. if err != nil {
  1638. return nil, err
  1639. }
  1640. defer googleapi.CloseBody(res)
  1641. if err := googleapi.CheckResponse(res); err != nil {
  1642. return nil, err
  1643. }
  1644. ret := &GetReleaseExecutableResponse{
  1645. ServerResponse: googleapi.ServerResponse{
  1646. Header: res.Header,
  1647. HTTPStatusCode: res.StatusCode,
  1648. },
  1649. }
  1650. target := &ret
  1651. if err := gensupport.DecodeResponse(target, res); err != nil {
  1652. return nil, err
  1653. }
  1654. return ret, nil
  1655. // {
  1656. // "description": "Get the `Release` executable to use when enforcing rules.",
  1657. // "flatPath": "v1/projects/{projectsId}/releases/{releasesId}:getExecutable",
  1658. // "httpMethod": "GET",
  1659. // "id": "firebaserules.projects.releases.getExecutable",
  1660. // "parameterOrder": [
  1661. // "name"
  1662. // ],
  1663. // "parameters": {
  1664. // "executableVersion": {
  1665. // "description": "The requested runtime executable version.\nDefaults to FIREBASE_RULES_EXECUTABLE_V1.",
  1666. // "enum": [
  1667. // "RELEASE_EXECUTABLE_VERSION_UNSPECIFIED",
  1668. // "FIREBASE_RULES_EXECUTABLE_V1",
  1669. // "FIREBASE_RULES_EXECUTABLE_V2"
  1670. // ],
  1671. // "location": "query",
  1672. // "type": "string"
  1673. // },
  1674. // "name": {
  1675. // "description": "Resource name of the `Release`.\n\nFormat: `projects/{project_id}/releases/{release_id}`",
  1676. // "location": "path",
  1677. // "pattern": "^projects/[^/]+/releases/.+$",
  1678. // "required": true,
  1679. // "type": "string"
  1680. // }
  1681. // },
  1682. // "path": "v1/{+name}:getExecutable",
  1683. // "response": {
  1684. // "$ref": "GetReleaseExecutableResponse"
  1685. // },
  1686. // "scopes": [
  1687. // "https://www.googleapis.com/auth/cloud-platform",
  1688. // "https://www.googleapis.com/auth/firebase",
  1689. // "https://www.googleapis.com/auth/firebase.readonly"
  1690. // ]
  1691. // }
  1692. }
  1693. // method id "firebaserules.projects.releases.list":
  1694. type ProjectsReleasesListCall struct {
  1695. s *Service
  1696. name string
  1697. urlParams_ gensupport.URLParams
  1698. ifNoneMatch_ string
  1699. ctx_ context.Context
  1700. header_ http.Header
  1701. }
  1702. // List: List the `Release` values for a project. This list may
  1703. // optionally be
  1704. // filtered by `Release` name, `Ruleset` name, `TestSuite` name, or
  1705. // any
  1706. // combination thereof.
  1707. func (r *ProjectsReleasesService) List(name string) *ProjectsReleasesListCall {
  1708. c := &ProjectsReleasesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1709. c.name = name
  1710. return c
  1711. }
  1712. // Filter sets the optional parameter "filter": `Release` filter. The
  1713. // list method supports filters with restrictions on the
  1714. // `Release.name`, `Release.ruleset_name`, and
  1715. // `Release.test_suite_name`.
  1716. //
  1717. // Example 1: A filter of 'name=prod*' might return `Release`s with
  1718. // names
  1719. // within 'projects/foo' prefixed with 'prod':
  1720. //
  1721. // Name | Ruleset
  1722. // Name
  1723. // ------------------------------|-------------
  1724. // projects/foo/release
  1725. // s/prod |
  1726. // projects/foo/rulesets/uuid1234
  1727. // projects/foo/releases/prod/v1 |
  1728. // projects/foo/rulesets/uuid1234
  1729. // projects/foo/releases/prod/v2 |
  1730. // projects/foo/rulesets/uuid8888
  1731. //
  1732. // Example 2: A filter of `name=prod* ruleset_name=uuid1234` would
  1733. // return only
  1734. // `Release` instances for 'projects/foo' with names prefixed with
  1735. // 'prod'
  1736. // referring to the same `Ruleset` name of 'uuid1234':
  1737. //
  1738. // Name | Ruleset
  1739. // Name
  1740. // ------------------------------|-------------
  1741. // projects/foo/release
  1742. // s/prod | projects/foo/rulesets/1234
  1743. // projects/foo/releases/prod/v1 | projects/foo/rulesets/1234
  1744. //
  1745. // In the examples, the filter parameters refer to the search filters
  1746. // are
  1747. // relative to the project. Fully qualified prefixed may also be used.
  1748. // e.g.
  1749. // `test_suite_name=projects/foo/testsuites/uuid1`
  1750. func (c *ProjectsReleasesListCall) Filter(filter string) *ProjectsReleasesListCall {
  1751. c.urlParams_.Set("filter", filter)
  1752. return c
  1753. }
  1754. // PageSize sets the optional parameter "pageSize": Page size to load.
  1755. // Maximum of 100. Defaults to 10.
  1756. // Note: `page_size` is just a hint and the service may choose to load
  1757. // fewer
  1758. // than `page_size` results due to the size of the output. To traverse
  1759. // all of
  1760. // the releases, the caller should iterate until the `page_token` on
  1761. // the
  1762. // response is empty.
  1763. func (c *ProjectsReleasesListCall) PageSize(pageSize int64) *ProjectsReleasesListCall {
  1764. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1765. return c
  1766. }
  1767. // PageToken sets the optional parameter "pageToken": Next page token
  1768. // for the next batch of `Release` instances.
  1769. func (c *ProjectsReleasesListCall) PageToken(pageToken string) *ProjectsReleasesListCall {
  1770. c.urlParams_.Set("pageToken", pageToken)
  1771. return c
  1772. }
  1773. // Fields allows partial responses to be retrieved. See
  1774. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1775. // for more information.
  1776. func (c *ProjectsReleasesListCall) Fields(s ...googleapi.Field) *ProjectsReleasesListCall {
  1777. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1778. return c
  1779. }
  1780. // IfNoneMatch sets the optional parameter which makes the operation
  1781. // fail if the object's ETag matches the given value. This is useful for
  1782. // getting updates only after the object has changed since the last
  1783. // request. Use googleapi.IsNotModified to check whether the response
  1784. // error from Do is the result of In-None-Match.
  1785. func (c *ProjectsReleasesListCall) IfNoneMatch(entityTag string) *ProjectsReleasesListCall {
  1786. c.ifNoneMatch_ = entityTag
  1787. return c
  1788. }
  1789. // Context sets the context to be used in this call's Do method. Any
  1790. // pending HTTP request will be aborted if the provided context is
  1791. // canceled.
  1792. func (c *ProjectsReleasesListCall) Context(ctx context.Context) *ProjectsReleasesListCall {
  1793. c.ctx_ = ctx
  1794. return c
  1795. }
  1796. // Header returns an http.Header that can be modified by the caller to
  1797. // add HTTP headers to the request.
  1798. func (c *ProjectsReleasesListCall) Header() http.Header {
  1799. if c.header_ == nil {
  1800. c.header_ = make(http.Header)
  1801. }
  1802. return c.header_
  1803. }
  1804. func (c *ProjectsReleasesListCall) doRequest(alt string) (*http.Response, error) {
  1805. reqHeaders := make(http.Header)
  1806. for k, v := range c.header_ {
  1807. reqHeaders[k] = v
  1808. }
  1809. reqHeaders.Set("User-Agent", c.s.userAgent())
  1810. if c.ifNoneMatch_ != "" {
  1811. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1812. }
  1813. var body io.Reader = nil
  1814. c.urlParams_.Set("alt", alt)
  1815. c.urlParams_.Set("prettyPrint", "false")
  1816. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/releases")
  1817. urls += "?" + c.urlParams_.Encode()
  1818. req, err := http.NewRequest("GET", urls, body)
  1819. if err != nil {
  1820. return nil, err
  1821. }
  1822. req.Header = reqHeaders
  1823. googleapi.Expand(req.URL, map[string]string{
  1824. "name": c.name,
  1825. })
  1826. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1827. }
  1828. // Do executes the "firebaserules.projects.releases.list" call.
  1829. // Exactly one of *ListReleasesResponse or error will be non-nil. Any
  1830. // non-2xx status code is an error. Response headers are in either
  1831. // *ListReleasesResponse.ServerResponse.Header or (if a response was
  1832. // returned at all) in error.(*googleapi.Error).Header. Use
  1833. // googleapi.IsNotModified to check whether the returned error was
  1834. // because http.StatusNotModified was returned.
  1835. func (c *ProjectsReleasesListCall) Do(opts ...googleapi.CallOption) (*ListReleasesResponse, error) {
  1836. gensupport.SetOptions(c.urlParams_, opts...)
  1837. res, err := c.doRequest("json")
  1838. if res != nil && res.StatusCode == http.StatusNotModified {
  1839. if res.Body != nil {
  1840. res.Body.Close()
  1841. }
  1842. return nil, &googleapi.Error{
  1843. Code: res.StatusCode,
  1844. Header: res.Header,
  1845. }
  1846. }
  1847. if err != nil {
  1848. return nil, err
  1849. }
  1850. defer googleapi.CloseBody(res)
  1851. if err := googleapi.CheckResponse(res); err != nil {
  1852. return nil, err
  1853. }
  1854. ret := &ListReleasesResponse{
  1855. ServerResponse: googleapi.ServerResponse{
  1856. Header: res.Header,
  1857. HTTPStatusCode: res.StatusCode,
  1858. },
  1859. }
  1860. target := &ret
  1861. if err := gensupport.DecodeResponse(target, res); err != nil {
  1862. return nil, err
  1863. }
  1864. return ret, nil
  1865. // {
  1866. // "description": "List the `Release` values for a project. This list may optionally be\nfiltered by `Release` name, `Ruleset` name, `TestSuite` name, or any\ncombination thereof.",
  1867. // "flatPath": "v1/projects/{projectsId}/releases",
  1868. // "httpMethod": "GET",
  1869. // "id": "firebaserules.projects.releases.list",
  1870. // "parameterOrder": [
  1871. // "name"
  1872. // ],
  1873. // "parameters": {
  1874. // "filter": {
  1875. // "description": "`Release` filter. The list method supports filters with restrictions on the\n`Release.name`, `Release.ruleset_name`, and `Release.test_suite_name`.\n\nExample 1: A filter of 'name=prod*' might return `Release`s with names\nwithin 'projects/foo' prefixed with 'prod':\n\nName | Ruleset Name\n------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/uuid1234\nprojects/foo/releases/prod/v1 | projects/foo/rulesets/uuid1234\nprojects/foo/releases/prod/v2 | projects/foo/rulesets/uuid8888\n\nExample 2: A filter of `name=prod* ruleset_name=uuid1234` would return only\n`Release` instances for 'projects/foo' with names prefixed with 'prod'\nreferring to the same `Ruleset` name of 'uuid1234':\n\nName | Ruleset Name\n------------------------------|-------------\nprojects/foo/releases/prod | projects/foo/rulesets/1234\nprojects/foo/releases/prod/v1 | projects/foo/rulesets/1234\n\nIn the examples, the filter parameters refer to the search filters are\nrelative to the project. Fully qualified prefixed may also be used. e.g.\n`test_suite_name=projects/foo/testsuites/uuid1`",
  1876. // "location": "query",
  1877. // "type": "string"
  1878. // },
  1879. // "name": {
  1880. // "description": "Resource name for the project.\n\nFormat: `projects/{project_id}`",
  1881. // "location": "path",
  1882. // "pattern": "^projects/[^/]+$",
  1883. // "required": true,
  1884. // "type": "string"
  1885. // },
  1886. // "pageSize": {
  1887. // "description": "Page size to load. Maximum of 100. Defaults to 10.\nNote: `page_size` is just a hint and the service may choose to load fewer\nthan `page_size` results due to the size of the output. To traverse all of\nthe releases, the caller should iterate until the `page_token` on the\nresponse is empty.",
  1888. // "format": "int32",
  1889. // "location": "query",
  1890. // "type": "integer"
  1891. // },
  1892. // "pageToken": {
  1893. // "description": "Next page token for the next batch of `Release` instances.",
  1894. // "location": "query",
  1895. // "type": "string"
  1896. // }
  1897. // },
  1898. // "path": "v1/{+name}/releases",
  1899. // "response": {
  1900. // "$ref": "ListReleasesResponse"
  1901. // },
  1902. // "scopes": [
  1903. // "https://www.googleapis.com/auth/cloud-platform",
  1904. // "https://www.googleapis.com/auth/firebase",
  1905. // "https://www.googleapis.com/auth/firebase.readonly"
  1906. // ]
  1907. // }
  1908. }
  1909. // Pages invokes f for each page of results.
  1910. // A non-nil error returned from f will halt the iteration.
  1911. // The provided context supersedes any context provided to the Context method.
  1912. func (c *ProjectsReleasesListCall) Pages(ctx context.Context, f func(*ListReleasesResponse) error) error {
  1913. c.ctx_ = ctx
  1914. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1915. for {
  1916. x, err := c.Do()
  1917. if err != nil {
  1918. return err
  1919. }
  1920. if err := f(x); err != nil {
  1921. return err
  1922. }
  1923. if x.NextPageToken == "" {
  1924. return nil
  1925. }
  1926. c.PageToken(x.NextPageToken)
  1927. }
  1928. }
  1929. // method id "firebaserules.projects.releases.patch":
  1930. type ProjectsReleasesPatchCall struct {
  1931. s *Service
  1932. name string
  1933. updatereleaserequest *UpdateReleaseRequest
  1934. urlParams_ gensupport.URLParams
  1935. ctx_ context.Context
  1936. header_ http.Header
  1937. }
  1938. // Patch: Update a `Release` via PATCH.
  1939. //
  1940. // Only updates to the `ruleset_name` and `test_suite_name` fields will
  1941. // be
  1942. // honored. `Release` rename is not supported. To create a `Release` use
  1943. // the
  1944. // CreateRelease method.
  1945. func (r *ProjectsReleasesService) Patch(name string, updatereleaserequest *UpdateReleaseRequest) *ProjectsReleasesPatchCall {
  1946. c := &ProjectsReleasesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1947. c.name = name
  1948. c.updatereleaserequest = updatereleaserequest
  1949. return c
  1950. }
  1951. // Fields allows partial responses to be retrieved. See
  1952. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1953. // for more information.
  1954. func (c *ProjectsReleasesPatchCall) Fields(s ...googleapi.Field) *ProjectsReleasesPatchCall {
  1955. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1956. return c
  1957. }
  1958. // Context sets the context to be used in this call's Do method. Any
  1959. // pending HTTP request will be aborted if the provided context is
  1960. // canceled.
  1961. func (c *ProjectsReleasesPatchCall) Context(ctx context.Context) *ProjectsReleasesPatchCall {
  1962. c.ctx_ = ctx
  1963. return c
  1964. }
  1965. // Header returns an http.Header that can be modified by the caller to
  1966. // add HTTP headers to the request.
  1967. func (c *ProjectsReleasesPatchCall) Header() http.Header {
  1968. if c.header_ == nil {
  1969. c.header_ = make(http.Header)
  1970. }
  1971. return c.header_
  1972. }
  1973. func (c *ProjectsReleasesPatchCall) doRequest(alt string) (*http.Response, error) {
  1974. reqHeaders := make(http.Header)
  1975. for k, v := range c.header_ {
  1976. reqHeaders[k] = v
  1977. }
  1978. reqHeaders.Set("User-Agent", c.s.userAgent())
  1979. var body io.Reader = nil
  1980. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatereleaserequest)
  1981. if err != nil {
  1982. return nil, err
  1983. }
  1984. reqHeaders.Set("Content-Type", "application/json")
  1985. c.urlParams_.Set("alt", alt)
  1986. c.urlParams_.Set("prettyPrint", "false")
  1987. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1988. urls += "?" + c.urlParams_.Encode()
  1989. req, err := http.NewRequest("PATCH", urls, body)
  1990. if err != nil {
  1991. return nil, err
  1992. }
  1993. req.Header = reqHeaders
  1994. googleapi.Expand(req.URL, map[string]string{
  1995. "name": c.name,
  1996. })
  1997. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1998. }
  1999. // Do executes the "firebaserules.projects.releases.patch" call.
  2000. // Exactly one of *Release or error will be non-nil. Any non-2xx status
  2001. // code is an error. Response headers are in either
  2002. // *Release.ServerResponse.Header or (if a response was returned at all)
  2003. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2004. // check whether the returned error was because http.StatusNotModified
  2005. // was returned.
  2006. func (c *ProjectsReleasesPatchCall) Do(opts ...googleapi.CallOption) (*Release, error) {
  2007. gensupport.SetOptions(c.urlParams_, opts...)
  2008. res, err := c.doRequest("json")
  2009. if res != nil && res.StatusCode == http.StatusNotModified {
  2010. if res.Body != nil {
  2011. res.Body.Close()
  2012. }
  2013. return nil, &googleapi.Error{
  2014. Code: res.StatusCode,
  2015. Header: res.Header,
  2016. }
  2017. }
  2018. if err != nil {
  2019. return nil, err
  2020. }
  2021. defer googleapi.CloseBody(res)
  2022. if err := googleapi.CheckResponse(res); err != nil {
  2023. return nil, err
  2024. }
  2025. ret := &Release{
  2026. ServerResponse: googleapi.ServerResponse{
  2027. Header: res.Header,
  2028. HTTPStatusCode: res.StatusCode,
  2029. },
  2030. }
  2031. target := &ret
  2032. if err := gensupport.DecodeResponse(target, res); err != nil {
  2033. return nil, err
  2034. }
  2035. return ret, nil
  2036. // {
  2037. // "description": "Update a `Release` via PATCH.\n\nOnly updates to the `ruleset_name` and `test_suite_name` fields will be\nhonored. `Release` rename is not supported. To create a `Release` use the\nCreateRelease method.",
  2038. // "flatPath": "v1/projects/{projectsId}/releases/{releasesId}",
  2039. // "httpMethod": "PATCH",
  2040. // "id": "firebaserules.projects.releases.patch",
  2041. // "parameterOrder": [
  2042. // "name"
  2043. // ],
  2044. // "parameters": {
  2045. // "name": {
  2046. // "description": "Resource name for the project which owns this `Release`.\n\nFormat: `projects/{project_id}`",
  2047. // "location": "path",
  2048. // "pattern": "^projects/[^/]+/releases/.+$",
  2049. // "required": true,
  2050. // "type": "string"
  2051. // }
  2052. // },
  2053. // "path": "v1/{+name}",
  2054. // "request": {
  2055. // "$ref": "UpdateReleaseRequest"
  2056. // },
  2057. // "response": {
  2058. // "$ref": "Release"
  2059. // },
  2060. // "scopes": [
  2061. // "https://www.googleapis.com/auth/cloud-platform",
  2062. // "https://www.googleapis.com/auth/firebase"
  2063. // ]
  2064. // }
  2065. }
  2066. // method id "firebaserules.projects.rulesets.create":
  2067. type ProjectsRulesetsCreateCall struct {
  2068. s *Service
  2069. name string
  2070. ruleset *Ruleset
  2071. urlParams_ gensupport.URLParams
  2072. ctx_ context.Context
  2073. header_ http.Header
  2074. }
  2075. // Create: Create a `Ruleset` from `Source`.
  2076. //
  2077. // The `Ruleset` is given a unique generated name which is returned to
  2078. // the
  2079. // caller. `Source` containing syntactic or semantics errors will result
  2080. // in an
  2081. // error response indicating the first error encountered. For a detailed
  2082. // view
  2083. // of `Source` issues, use TestRuleset.
  2084. func (r *ProjectsRulesetsService) Create(name string, ruleset *Ruleset) *ProjectsRulesetsCreateCall {
  2085. c := &ProjectsRulesetsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2086. c.name = name
  2087. c.ruleset = ruleset
  2088. return c
  2089. }
  2090. // Fields allows partial responses to be retrieved. See
  2091. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2092. // for more information.
  2093. func (c *ProjectsRulesetsCreateCall) Fields(s ...googleapi.Field) *ProjectsRulesetsCreateCall {
  2094. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2095. return c
  2096. }
  2097. // Context sets the context to be used in this call's Do method. Any
  2098. // pending HTTP request will be aborted if the provided context is
  2099. // canceled.
  2100. func (c *ProjectsRulesetsCreateCall) Context(ctx context.Context) *ProjectsRulesetsCreateCall {
  2101. c.ctx_ = ctx
  2102. return c
  2103. }
  2104. // Header returns an http.Header that can be modified by the caller to
  2105. // add HTTP headers to the request.
  2106. func (c *ProjectsRulesetsCreateCall) Header() http.Header {
  2107. if c.header_ == nil {
  2108. c.header_ = make(http.Header)
  2109. }
  2110. return c.header_
  2111. }
  2112. func (c *ProjectsRulesetsCreateCall) doRequest(alt string) (*http.Response, error) {
  2113. reqHeaders := make(http.Header)
  2114. for k, v := range c.header_ {
  2115. reqHeaders[k] = v
  2116. }
  2117. reqHeaders.Set("User-Agent", c.s.userAgent())
  2118. var body io.Reader = nil
  2119. body, err := googleapi.WithoutDataWrapper.JSONReader(c.ruleset)
  2120. if err != nil {
  2121. return nil, err
  2122. }
  2123. reqHeaders.Set("Content-Type", "application/json")
  2124. c.urlParams_.Set("alt", alt)
  2125. c.urlParams_.Set("prettyPrint", "false")
  2126. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/rulesets")
  2127. urls += "?" + c.urlParams_.Encode()
  2128. req, err := http.NewRequest("POST", urls, body)
  2129. if err != nil {
  2130. return nil, err
  2131. }
  2132. req.Header = reqHeaders
  2133. googleapi.Expand(req.URL, map[string]string{
  2134. "name": c.name,
  2135. })
  2136. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2137. }
  2138. // Do executes the "firebaserules.projects.rulesets.create" call.
  2139. // Exactly one of *Ruleset or error will be non-nil. Any non-2xx status
  2140. // code is an error. Response headers are in either
  2141. // *Ruleset.ServerResponse.Header or (if a response was returned at all)
  2142. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2143. // check whether the returned error was because http.StatusNotModified
  2144. // was returned.
  2145. func (c *ProjectsRulesetsCreateCall) Do(opts ...googleapi.CallOption) (*Ruleset, error) {
  2146. gensupport.SetOptions(c.urlParams_, opts...)
  2147. res, err := c.doRequest("json")
  2148. if res != nil && res.StatusCode == http.StatusNotModified {
  2149. if res.Body != nil {
  2150. res.Body.Close()
  2151. }
  2152. return nil, &googleapi.Error{
  2153. Code: res.StatusCode,
  2154. Header: res.Header,
  2155. }
  2156. }
  2157. if err != nil {
  2158. return nil, err
  2159. }
  2160. defer googleapi.CloseBody(res)
  2161. if err := googleapi.CheckResponse(res); err != nil {
  2162. return nil, err
  2163. }
  2164. ret := &Ruleset{
  2165. ServerResponse: googleapi.ServerResponse{
  2166. Header: res.Header,
  2167. HTTPStatusCode: res.StatusCode,
  2168. },
  2169. }
  2170. target := &ret
  2171. if err := gensupport.DecodeResponse(target, res); err != nil {
  2172. return nil, err
  2173. }
  2174. return ret, nil
  2175. // {
  2176. // "description": "Create a `Ruleset` from `Source`.\n\nThe `Ruleset` is given a unique generated name which is returned to the\ncaller. `Source` containing syntactic or semantics errors will result in an\nerror response indicating the first error encountered. For a detailed view\nof `Source` issues, use TestRuleset.",
  2177. // "flatPath": "v1/projects/{projectsId}/rulesets",
  2178. // "httpMethod": "POST",
  2179. // "id": "firebaserules.projects.rulesets.create",
  2180. // "parameterOrder": [
  2181. // "name"
  2182. // ],
  2183. // "parameters": {
  2184. // "name": {
  2185. // "description": "Resource name for Project which owns this `Ruleset`.\n\nFormat: `projects/{project_id}`",
  2186. // "location": "path",
  2187. // "pattern": "^projects/[^/]+$",
  2188. // "required": true,
  2189. // "type": "string"
  2190. // }
  2191. // },
  2192. // "path": "v1/{+name}/rulesets",
  2193. // "request": {
  2194. // "$ref": "Ruleset"
  2195. // },
  2196. // "response": {
  2197. // "$ref": "Ruleset"
  2198. // },
  2199. // "scopes": [
  2200. // "https://www.googleapis.com/auth/cloud-platform",
  2201. // "https://www.googleapis.com/auth/firebase"
  2202. // ]
  2203. // }
  2204. }
  2205. // method id "firebaserules.projects.rulesets.delete":
  2206. type ProjectsRulesetsDeleteCall struct {
  2207. s *Service
  2208. name string
  2209. urlParams_ gensupport.URLParams
  2210. ctx_ context.Context
  2211. header_ http.Header
  2212. }
  2213. // Delete: Delete a `Ruleset` by resource name.
  2214. //
  2215. // If the `Ruleset` is referenced by a `Release` the operation will
  2216. // fail.
  2217. func (r *ProjectsRulesetsService) Delete(name string) *ProjectsRulesetsDeleteCall {
  2218. c := &ProjectsRulesetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2219. c.name = name
  2220. return c
  2221. }
  2222. // Fields allows partial responses to be retrieved. See
  2223. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2224. // for more information.
  2225. func (c *ProjectsRulesetsDeleteCall) Fields(s ...googleapi.Field) *ProjectsRulesetsDeleteCall {
  2226. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2227. return c
  2228. }
  2229. // Context sets the context to be used in this call's Do method. Any
  2230. // pending HTTP request will be aborted if the provided context is
  2231. // canceled.
  2232. func (c *ProjectsRulesetsDeleteCall) Context(ctx context.Context) *ProjectsRulesetsDeleteCall {
  2233. c.ctx_ = ctx
  2234. return c
  2235. }
  2236. // Header returns an http.Header that can be modified by the caller to
  2237. // add HTTP headers to the request.
  2238. func (c *ProjectsRulesetsDeleteCall) Header() http.Header {
  2239. if c.header_ == nil {
  2240. c.header_ = make(http.Header)
  2241. }
  2242. return c.header_
  2243. }
  2244. func (c *ProjectsRulesetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2245. reqHeaders := make(http.Header)
  2246. for k, v := range c.header_ {
  2247. reqHeaders[k] = v
  2248. }
  2249. reqHeaders.Set("User-Agent", c.s.userAgent())
  2250. var body io.Reader = nil
  2251. c.urlParams_.Set("alt", alt)
  2252. c.urlParams_.Set("prettyPrint", "false")
  2253. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2254. urls += "?" + c.urlParams_.Encode()
  2255. req, err := http.NewRequest("DELETE", urls, body)
  2256. if err != nil {
  2257. return nil, err
  2258. }
  2259. req.Header = reqHeaders
  2260. googleapi.Expand(req.URL, map[string]string{
  2261. "name": c.name,
  2262. })
  2263. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2264. }
  2265. // Do executes the "firebaserules.projects.rulesets.delete" call.
  2266. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2267. // code is an error. Response headers are in either
  2268. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2269. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2270. // check whether the returned error was because http.StatusNotModified
  2271. // was returned.
  2272. func (c *ProjectsRulesetsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2273. gensupport.SetOptions(c.urlParams_, opts...)
  2274. res, err := c.doRequest("json")
  2275. if res != nil && res.StatusCode == http.StatusNotModified {
  2276. if res.Body != nil {
  2277. res.Body.Close()
  2278. }
  2279. return nil, &googleapi.Error{
  2280. Code: res.StatusCode,
  2281. Header: res.Header,
  2282. }
  2283. }
  2284. if err != nil {
  2285. return nil, err
  2286. }
  2287. defer googleapi.CloseBody(res)
  2288. if err := googleapi.CheckResponse(res); err != nil {
  2289. return nil, err
  2290. }
  2291. ret := &Empty{
  2292. ServerResponse: googleapi.ServerResponse{
  2293. Header: res.Header,
  2294. HTTPStatusCode: res.StatusCode,
  2295. },
  2296. }
  2297. target := &ret
  2298. if err := gensupport.DecodeResponse(target, res); err != nil {
  2299. return nil, err
  2300. }
  2301. return ret, nil
  2302. // {
  2303. // "description": "Delete a `Ruleset` by resource name.\n\nIf the `Ruleset` is referenced by a `Release` the operation will fail.",
  2304. // "flatPath": "v1/projects/{projectsId}/rulesets/{rulesetsId}",
  2305. // "httpMethod": "DELETE",
  2306. // "id": "firebaserules.projects.rulesets.delete",
  2307. // "parameterOrder": [
  2308. // "name"
  2309. // ],
  2310. // "parameters": {
  2311. // "name": {
  2312. // "description": "Resource name for the ruleset to delete.\n\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`",
  2313. // "location": "path",
  2314. // "pattern": "^projects/[^/]+/rulesets/[^/]+$",
  2315. // "required": true,
  2316. // "type": "string"
  2317. // }
  2318. // },
  2319. // "path": "v1/{+name}",
  2320. // "response": {
  2321. // "$ref": "Empty"
  2322. // },
  2323. // "scopes": [
  2324. // "https://www.googleapis.com/auth/cloud-platform",
  2325. // "https://www.googleapis.com/auth/firebase"
  2326. // ]
  2327. // }
  2328. }
  2329. // method id "firebaserules.projects.rulesets.get":
  2330. type ProjectsRulesetsGetCall struct {
  2331. s *Service
  2332. name string
  2333. urlParams_ gensupport.URLParams
  2334. ifNoneMatch_ string
  2335. ctx_ context.Context
  2336. header_ http.Header
  2337. }
  2338. // Get: Get a `Ruleset` by name including the full `Source` contents.
  2339. func (r *ProjectsRulesetsService) Get(name string) *ProjectsRulesetsGetCall {
  2340. c := &ProjectsRulesetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2341. c.name = name
  2342. return c
  2343. }
  2344. // Fields allows partial responses to be retrieved. See
  2345. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2346. // for more information.
  2347. func (c *ProjectsRulesetsGetCall) Fields(s ...googleapi.Field) *ProjectsRulesetsGetCall {
  2348. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2349. return c
  2350. }
  2351. // IfNoneMatch sets the optional parameter which makes the operation
  2352. // fail if the object's ETag matches the given value. This is useful for
  2353. // getting updates only after the object has changed since the last
  2354. // request. Use googleapi.IsNotModified to check whether the response
  2355. // error from Do is the result of In-None-Match.
  2356. func (c *ProjectsRulesetsGetCall) IfNoneMatch(entityTag string) *ProjectsRulesetsGetCall {
  2357. c.ifNoneMatch_ = entityTag
  2358. return c
  2359. }
  2360. // Context sets the context to be used in this call's Do method. Any
  2361. // pending HTTP request will be aborted if the provided context is
  2362. // canceled.
  2363. func (c *ProjectsRulesetsGetCall) Context(ctx context.Context) *ProjectsRulesetsGetCall {
  2364. c.ctx_ = ctx
  2365. return c
  2366. }
  2367. // Header returns an http.Header that can be modified by the caller to
  2368. // add HTTP headers to the request.
  2369. func (c *ProjectsRulesetsGetCall) Header() http.Header {
  2370. if c.header_ == nil {
  2371. c.header_ = make(http.Header)
  2372. }
  2373. return c.header_
  2374. }
  2375. func (c *ProjectsRulesetsGetCall) doRequest(alt string) (*http.Response, error) {
  2376. reqHeaders := make(http.Header)
  2377. for k, v := range c.header_ {
  2378. reqHeaders[k] = v
  2379. }
  2380. reqHeaders.Set("User-Agent", c.s.userAgent())
  2381. if c.ifNoneMatch_ != "" {
  2382. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2383. }
  2384. var body io.Reader = nil
  2385. c.urlParams_.Set("alt", alt)
  2386. c.urlParams_.Set("prettyPrint", "false")
  2387. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2388. urls += "?" + c.urlParams_.Encode()
  2389. req, err := http.NewRequest("GET", urls, body)
  2390. if err != nil {
  2391. return nil, err
  2392. }
  2393. req.Header = reqHeaders
  2394. googleapi.Expand(req.URL, map[string]string{
  2395. "name": c.name,
  2396. })
  2397. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2398. }
  2399. // Do executes the "firebaserules.projects.rulesets.get" call.
  2400. // Exactly one of *Ruleset or error will be non-nil. Any non-2xx status
  2401. // code is an error. Response headers are in either
  2402. // *Ruleset.ServerResponse.Header or (if a response was returned at all)
  2403. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2404. // check whether the returned error was because http.StatusNotModified
  2405. // was returned.
  2406. func (c *ProjectsRulesetsGetCall) Do(opts ...googleapi.CallOption) (*Ruleset, error) {
  2407. gensupport.SetOptions(c.urlParams_, opts...)
  2408. res, err := c.doRequest("json")
  2409. if res != nil && res.StatusCode == http.StatusNotModified {
  2410. if res.Body != nil {
  2411. res.Body.Close()
  2412. }
  2413. return nil, &googleapi.Error{
  2414. Code: res.StatusCode,
  2415. Header: res.Header,
  2416. }
  2417. }
  2418. if err != nil {
  2419. return nil, err
  2420. }
  2421. defer googleapi.CloseBody(res)
  2422. if err := googleapi.CheckResponse(res); err != nil {
  2423. return nil, err
  2424. }
  2425. ret := &Ruleset{
  2426. ServerResponse: googleapi.ServerResponse{
  2427. Header: res.Header,
  2428. HTTPStatusCode: res.StatusCode,
  2429. },
  2430. }
  2431. target := &ret
  2432. if err := gensupport.DecodeResponse(target, res); err != nil {
  2433. return nil, err
  2434. }
  2435. return ret, nil
  2436. // {
  2437. // "description": "Get a `Ruleset` by name including the full `Source` contents.",
  2438. // "flatPath": "v1/projects/{projectsId}/rulesets/{rulesetsId}",
  2439. // "httpMethod": "GET",
  2440. // "id": "firebaserules.projects.rulesets.get",
  2441. // "parameterOrder": [
  2442. // "name"
  2443. // ],
  2444. // "parameters": {
  2445. // "name": {
  2446. // "description": "Resource name for the ruleset to get.\n\nFormat: `projects/{project_id}/rulesets/{ruleset_id}`",
  2447. // "location": "path",
  2448. // "pattern": "^projects/[^/]+/rulesets/[^/]+$",
  2449. // "required": true,
  2450. // "type": "string"
  2451. // }
  2452. // },
  2453. // "path": "v1/{+name}",
  2454. // "response": {
  2455. // "$ref": "Ruleset"
  2456. // },
  2457. // "scopes": [
  2458. // "https://www.googleapis.com/auth/cloud-platform",
  2459. // "https://www.googleapis.com/auth/firebase",
  2460. // "https://www.googleapis.com/auth/firebase.readonly"
  2461. // ]
  2462. // }
  2463. }
  2464. // method id "firebaserules.projects.rulesets.list":
  2465. type ProjectsRulesetsListCall struct {
  2466. s *Service
  2467. name string
  2468. urlParams_ gensupport.URLParams
  2469. ifNoneMatch_ string
  2470. ctx_ context.Context
  2471. header_ http.Header
  2472. }
  2473. // List: List `Ruleset` metadata only and optionally filter the results
  2474. // by `Ruleset`
  2475. // name.
  2476. //
  2477. // The full `Source` contents of a `Ruleset` may be retrieved
  2478. // with
  2479. // GetRuleset.
  2480. func (r *ProjectsRulesetsService) List(name string) *ProjectsRulesetsListCall {
  2481. c := &ProjectsRulesetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2482. c.name = name
  2483. return c
  2484. }
  2485. // Filter sets the optional parameter "filter": `Ruleset` filter. The
  2486. // list method supports filters with restrictions
  2487. // on
  2488. // `Ruleset.name`.
  2489. //
  2490. // Filters on `Ruleset.create_time` should use the `date` function
  2491. // which
  2492. // parses strings that conform to the RFC 3339 date/time
  2493. // specifications.
  2494. //
  2495. // Example: `create_time > date("2017-01-01") AND name=UUID-*`
  2496. func (c *ProjectsRulesetsListCall) Filter(filter string) *ProjectsRulesetsListCall {
  2497. c.urlParams_.Set("filter", filter)
  2498. return c
  2499. }
  2500. // PageSize sets the optional parameter "pageSize": Page size to load.
  2501. // Maximum of 100. Defaults to 10.
  2502. // Note: `page_size` is just a hint and the service may choose to load
  2503. // less
  2504. // than `page_size` due to the size of the output. To traverse all of
  2505. // the
  2506. // releases, caller should iterate until the `page_token` is empty.
  2507. func (c *ProjectsRulesetsListCall) PageSize(pageSize int64) *ProjectsRulesetsListCall {
  2508. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2509. return c
  2510. }
  2511. // PageToken sets the optional parameter "pageToken": Next page token
  2512. // for loading the next batch of `Ruleset` instances.
  2513. func (c *ProjectsRulesetsListCall) PageToken(pageToken string) *ProjectsRulesetsListCall {
  2514. c.urlParams_.Set("pageToken", pageToken)
  2515. return c
  2516. }
  2517. // Fields allows partial responses to be retrieved. See
  2518. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2519. // for more information.
  2520. func (c *ProjectsRulesetsListCall) Fields(s ...googleapi.Field) *ProjectsRulesetsListCall {
  2521. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2522. return c
  2523. }
  2524. // IfNoneMatch sets the optional parameter which makes the operation
  2525. // fail if the object's ETag matches the given value. This is useful for
  2526. // getting updates only after the object has changed since the last
  2527. // request. Use googleapi.IsNotModified to check whether the response
  2528. // error from Do is the result of In-None-Match.
  2529. func (c *ProjectsRulesetsListCall) IfNoneMatch(entityTag string) *ProjectsRulesetsListCall {
  2530. c.ifNoneMatch_ = entityTag
  2531. return c
  2532. }
  2533. // Context sets the context to be used in this call's Do method. Any
  2534. // pending HTTP request will be aborted if the provided context is
  2535. // canceled.
  2536. func (c *ProjectsRulesetsListCall) Context(ctx context.Context) *ProjectsRulesetsListCall {
  2537. c.ctx_ = ctx
  2538. return c
  2539. }
  2540. // Header returns an http.Header that can be modified by the caller to
  2541. // add HTTP headers to the request.
  2542. func (c *ProjectsRulesetsListCall) Header() http.Header {
  2543. if c.header_ == nil {
  2544. c.header_ = make(http.Header)
  2545. }
  2546. return c.header_
  2547. }
  2548. func (c *ProjectsRulesetsListCall) doRequest(alt string) (*http.Response, error) {
  2549. reqHeaders := make(http.Header)
  2550. for k, v := range c.header_ {
  2551. reqHeaders[k] = v
  2552. }
  2553. reqHeaders.Set("User-Agent", c.s.userAgent())
  2554. if c.ifNoneMatch_ != "" {
  2555. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2556. }
  2557. var body io.Reader = nil
  2558. c.urlParams_.Set("alt", alt)
  2559. c.urlParams_.Set("prettyPrint", "false")
  2560. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/rulesets")
  2561. urls += "?" + c.urlParams_.Encode()
  2562. req, err := http.NewRequest("GET", urls, body)
  2563. if err != nil {
  2564. return nil, err
  2565. }
  2566. req.Header = reqHeaders
  2567. googleapi.Expand(req.URL, map[string]string{
  2568. "name": c.name,
  2569. })
  2570. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2571. }
  2572. // Do executes the "firebaserules.projects.rulesets.list" call.
  2573. // Exactly one of *ListRulesetsResponse or error will be non-nil. Any
  2574. // non-2xx status code is an error. Response headers are in either
  2575. // *ListRulesetsResponse.ServerResponse.Header or (if a response was
  2576. // returned at all) in error.(*googleapi.Error).Header. Use
  2577. // googleapi.IsNotModified to check whether the returned error was
  2578. // because http.StatusNotModified was returned.
  2579. func (c *ProjectsRulesetsListCall) Do(opts ...googleapi.CallOption) (*ListRulesetsResponse, error) {
  2580. gensupport.SetOptions(c.urlParams_, opts...)
  2581. res, err := c.doRequest("json")
  2582. if res != nil && res.StatusCode == http.StatusNotModified {
  2583. if res.Body != nil {
  2584. res.Body.Close()
  2585. }
  2586. return nil, &googleapi.Error{
  2587. Code: res.StatusCode,
  2588. Header: res.Header,
  2589. }
  2590. }
  2591. if err != nil {
  2592. return nil, err
  2593. }
  2594. defer googleapi.CloseBody(res)
  2595. if err := googleapi.CheckResponse(res); err != nil {
  2596. return nil, err
  2597. }
  2598. ret := &ListRulesetsResponse{
  2599. ServerResponse: googleapi.ServerResponse{
  2600. Header: res.Header,
  2601. HTTPStatusCode: res.StatusCode,
  2602. },
  2603. }
  2604. target := &ret
  2605. if err := gensupport.DecodeResponse(target, res); err != nil {
  2606. return nil, err
  2607. }
  2608. return ret, nil
  2609. // {
  2610. // "description": "List `Ruleset` metadata only and optionally filter the results by `Ruleset`\nname.\n\nThe full `Source` contents of a `Ruleset` may be retrieved with\nGetRuleset.",
  2611. // "flatPath": "v1/projects/{projectsId}/rulesets",
  2612. // "httpMethod": "GET",
  2613. // "id": "firebaserules.projects.rulesets.list",
  2614. // "parameterOrder": [
  2615. // "name"
  2616. // ],
  2617. // "parameters": {
  2618. // "filter": {
  2619. // "description": "`Ruleset` filter. The list method supports filters with restrictions on\n`Ruleset.name`.\n\nFilters on `Ruleset.create_time` should use the `date` function which\nparses strings that conform to the RFC 3339 date/time specifications.\n\nExample: `create_time \u003e date(\"2017-01-01\") AND name=UUID-*`",
  2620. // "location": "query",
  2621. // "type": "string"
  2622. // },
  2623. // "name": {
  2624. // "description": "Resource name for the project.\n\nFormat: `projects/{project_id}`",
  2625. // "location": "path",
  2626. // "pattern": "^projects/[^/]+$",
  2627. // "required": true,
  2628. // "type": "string"
  2629. // },
  2630. // "pageSize": {
  2631. // "description": "Page size to load. Maximum of 100. Defaults to 10.\nNote: `page_size` is just a hint and the service may choose to load less\nthan `page_size` due to the size of the output. To traverse all of the\nreleases, caller should iterate until the `page_token` is empty.",
  2632. // "format": "int32",
  2633. // "location": "query",
  2634. // "type": "integer"
  2635. // },
  2636. // "pageToken": {
  2637. // "description": "Next page token for loading the next batch of `Ruleset` instances.",
  2638. // "location": "query",
  2639. // "type": "string"
  2640. // }
  2641. // },
  2642. // "path": "v1/{+name}/rulesets",
  2643. // "response": {
  2644. // "$ref": "ListRulesetsResponse"
  2645. // },
  2646. // "scopes": [
  2647. // "https://www.googleapis.com/auth/cloud-platform",
  2648. // "https://www.googleapis.com/auth/firebase",
  2649. // "https://www.googleapis.com/auth/firebase.readonly"
  2650. // ]
  2651. // }
  2652. }
  2653. // Pages invokes f for each page of results.
  2654. // A non-nil error returned from f will halt the iteration.
  2655. // The provided context supersedes any context provided to the Context method.
  2656. func (c *ProjectsRulesetsListCall) Pages(ctx context.Context, f func(*ListRulesetsResponse) error) error {
  2657. c.ctx_ = ctx
  2658. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2659. for {
  2660. x, err := c.Do()
  2661. if err != nil {
  2662. return err
  2663. }
  2664. if err := f(x); err != nil {
  2665. return err
  2666. }
  2667. if x.NextPageToken == "" {
  2668. return nil
  2669. }
  2670. c.PageToken(x.NextPageToken)
  2671. }
  2672. }