選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

2818 行
99 KiB

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