...

Source file src/google.golang.org/api/firebaserules/v1/firebaserules-gen.go

Documentation: google.golang.org/api/firebaserules/v1

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

View as plain text