...

Source file src/google.golang.org/api/firebasedatabase/v1beta/firebasedatabase-gen.go

Documentation: google.golang.org/api/firebasedatabase/v1beta

     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 firebasedatabase provides access to the Firebase Realtime Database API.
     8  //
     9  // For product documentation, see: https://firebase.google.com/docs/reference/rest/database/database-management/rest/
    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/firebasedatabase/v1beta"
    27  //	...
    28  //	ctx := context.Background()
    29  //	firebasedatabaseService, err := firebasedatabase.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  //	firebasedatabaseService, err := firebasedatabase.NewService(ctx, option.WithScopes(firebasedatabase.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  //	firebasedatabaseService, err := firebasedatabase.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  //	firebasedatabaseService, err := firebasedatabase.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package firebasedatabase // import "google.golang.org/api/firebasedatabase/v1beta"
    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 = "firebasedatabase:v1beta"
    95  const apiName = "firebasedatabase"
    96  const apiVersion = "v1beta"
    97  const basePath = "https://firebasedatabase.googleapis.com/"
    98  const basePathTemplate = "https://firebasedatabase.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://firebasedatabase.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 your data across Google Cloud services and see the email address of
   108  	// your Google Account
   109  	CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
   110  
   111  	// View and administer all your Firebase data and settings
   112  	FirebaseScope = "https://www.googleapis.com/auth/firebase"
   113  
   114  	// View all your Firebase data and settings
   115  	FirebaseReadonlyScope = "https://www.googleapis.com/auth/firebase.readonly"
   116  )
   117  
   118  // NewService creates a new Service.
   119  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   120  	scopesOption := internaloption.WithDefaultScopes(
   121  		"https://www.googleapis.com/auth/cloud-platform",
   122  		"https://www.googleapis.com/auth/cloud-platform.read-only",
   123  		"https://www.googleapis.com/auth/firebase",
   124  		"https://www.googleapis.com/auth/firebase.readonly",
   125  	)
   126  	// NOTE: prepend, so we don't override user-specified scopes.
   127  	opts = append([]option.ClientOption{scopesOption}, opts...)
   128  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   129  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   130  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   131  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   132  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   133  	if err != nil {
   134  		return nil, err
   135  	}
   136  	s, err := New(client)
   137  	if err != nil {
   138  		return nil, err
   139  	}
   140  	if endpoint != "" {
   141  		s.BasePath = endpoint
   142  	}
   143  	return s, nil
   144  }
   145  
   146  // New creates a new Service. It uses the provided http.Client for requests.
   147  //
   148  // Deprecated: please use NewService instead.
   149  // To provide a custom HTTP client, use option.WithHTTPClient.
   150  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   151  func New(client *http.Client) (*Service, error) {
   152  	if client == nil {
   153  		return nil, errors.New("client is nil")
   154  	}
   155  	s := &Service{client: client, BasePath: basePath}
   156  	s.Projects = NewProjectsService(s)
   157  	return s, nil
   158  }
   159  
   160  type Service struct {
   161  	client    *http.Client
   162  	BasePath  string // API endpoint base URL
   163  	UserAgent string // optional additional User-Agent fragment
   164  
   165  	Projects *ProjectsService
   166  }
   167  
   168  func (s *Service) userAgent() string {
   169  	if s.UserAgent == "" {
   170  		return googleapi.UserAgent
   171  	}
   172  	return googleapi.UserAgent + " " + s.UserAgent
   173  }
   174  
   175  func NewProjectsService(s *Service) *ProjectsService {
   176  	rs := &ProjectsService{s: s}
   177  	rs.Locations = NewProjectsLocationsService(s)
   178  	return rs
   179  }
   180  
   181  type ProjectsService struct {
   182  	s *Service
   183  
   184  	Locations *ProjectsLocationsService
   185  }
   186  
   187  func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
   188  	rs := &ProjectsLocationsService{s: s}
   189  	rs.Instances = NewProjectsLocationsInstancesService(s)
   190  	return rs
   191  }
   192  
   193  type ProjectsLocationsService struct {
   194  	s *Service
   195  
   196  	Instances *ProjectsLocationsInstancesService
   197  }
   198  
   199  func NewProjectsLocationsInstancesService(s *Service) *ProjectsLocationsInstancesService {
   200  	rs := &ProjectsLocationsInstancesService{s: s}
   201  	return rs
   202  }
   203  
   204  type ProjectsLocationsInstancesService struct {
   205  	s *Service
   206  }
   207  
   208  // DatabaseInstance: Representation of a Realtime Database instance. Details on
   209  // interacting with contents of a DatabaseInstance can be found at:
   210  // https://firebase.google.com/docs/database/rest/start.
   211  type DatabaseInstance struct {
   212  	// DatabaseUrl: Output only. Output Only. The globally unique hostname of the
   213  	// database.
   214  	DatabaseUrl string `json:"databaseUrl,omitempty"`
   215  	// Name: The fully qualified resource name of the database instance, in the
   216  	// form:
   217  	// `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
   218  	Name string `json:"name,omitempty"`
   219  	// Project: Output only. The resource name of the project this instance belongs
   220  	// to. For example: `projects/{project-number}`.
   221  	Project string `json:"project,omitempty"`
   222  	// State: Output only. The database's lifecycle state. Read-only.
   223  	//
   224  	// Possible values:
   225  	//   "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state, likely the result of an
   226  	// error on the backend. This is only used for distinguishing unset values.
   227  	//   "ACTIVE" - The normal and active state.
   228  	//   "DISABLED" - The database is in a disabled state. It can be re-enabled
   229  	// later.
   230  	//   "DELETED" - The database is in a deleted state.
   231  	State string `json:"state,omitempty"`
   232  	// Type: Immutable. The database instance type. On creation only USER_DATABASE
   233  	// is allowed, which is also the default when omitted.
   234  	//
   235  	// Possible values:
   236  	//   "DATABASE_INSTANCE_TYPE_UNSPECIFIED" - Unknown state, likely the result of
   237  	// an error on the backend. This is only used for distinguishing unset values.
   238  	//   "DEFAULT_DATABASE" - The default database that is provisioned when a
   239  	// project is created.
   240  	//   "USER_DATABASE" - A database that the user created.
   241  	Type string `json:"type,omitempty"`
   242  
   243  	// ServerResponse contains the HTTP response code and headers from the server.
   244  	googleapi.ServerResponse `json:"-"`
   245  	// ForceSendFields is a list of field names (e.g. "DatabaseUrl") 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. "DatabaseUrl") 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 *DatabaseInstance) MarshalJSON() ([]byte, error) {
   259  	type NoMethod DatabaseInstance
   260  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   261  }
   262  
   263  // DisableDatabaseInstanceRequest: The request sent to the
   264  // DisableDatabaseInstance method.
   265  type DisableDatabaseInstanceRequest struct {
   266  }
   267  
   268  // ListDatabaseInstancesResponse: The response from the ListDatabaseInstances
   269  // method.
   270  type ListDatabaseInstancesResponse struct {
   271  	// Instances: List of each DatabaseInstance that is in the parent Firebase
   272  	// project.
   273  	Instances []*DatabaseInstance `json:"instances,omitempty"`
   274  	// NextPageToken: If the result list is too large to fit in a single response,
   275  	// then a token is returned. If the string is empty, then this response is the
   276  	// last page of results. This token can be used in a subsequent call to
   277  	// `ListDatabaseInstances` to find the next group of database instances. Page
   278  	// tokens are short-lived and should not be persisted.
   279  	NextPageToken string `json:"nextPageToken,omitempty"`
   280  
   281  	// ServerResponse contains the HTTP response code and headers from the server.
   282  	googleapi.ServerResponse `json:"-"`
   283  	// ForceSendFields is a list of field names (e.g. "Instances") to
   284  	// unconditionally include in API requests. By default, fields with empty or
   285  	// default values are omitted from API requests. See
   286  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   287  	// details.
   288  	ForceSendFields []string `json:"-"`
   289  	// NullFields is a list of field names (e.g. "Instances") to include in API
   290  	// requests with the JSON null value. By default, fields with empty values are
   291  	// omitted from API requests. See
   292  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   293  	NullFields []string `json:"-"`
   294  }
   295  
   296  func (s *ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) {
   297  	type NoMethod ListDatabaseInstancesResponse
   298  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   299  }
   300  
   301  // ReenableDatabaseInstanceRequest: The request sent to the
   302  // ReenableDatabaseInstance method.
   303  type ReenableDatabaseInstanceRequest struct {
   304  }
   305  
   306  // UndeleteDatabaseInstanceRequest: The request sent to
   307  // UndeleteDatabaseInstance method.
   308  type UndeleteDatabaseInstanceRequest struct {
   309  }
   310  
   311  type ProjectsLocationsInstancesCreateCall struct {
   312  	s                *Service
   313  	parent           string
   314  	databaseinstance *DatabaseInstance
   315  	urlParams_       gensupport.URLParams
   316  	ctx_             context.Context
   317  	header_          http.Header
   318  }
   319  
   320  // Create: Requests that a new DatabaseInstance be created. The state of a
   321  // successfully created DatabaseInstance is ACTIVE. Only available for projects
   322  // on the Blaze plan. Projects can be upgraded using the Cloud Billing API
   323  // https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo.
   324  // Note that it might take a few minutes for billing enablement state to
   325  // propagate to Firebase systems.
   326  //
   327  //   - parent: The parent project for which to create a database instance, in the
   328  //     form: `projects/{project-number}/locations/{location-id}`.
   329  func (r *ProjectsLocationsInstancesService) Create(parent string, databaseinstance *DatabaseInstance) *ProjectsLocationsInstancesCreateCall {
   330  	c := &ProjectsLocationsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   331  	c.parent = parent
   332  	c.databaseinstance = databaseinstance
   333  	return c
   334  }
   335  
   336  // DatabaseId sets the optional parameter "databaseId": The globally unique
   337  // identifier of the database instance.
   338  func (c *ProjectsLocationsInstancesCreateCall) DatabaseId(databaseId string) *ProjectsLocationsInstancesCreateCall {
   339  	c.urlParams_.Set("databaseId", databaseId)
   340  	return c
   341  }
   342  
   343  // ValidateOnly sets the optional parameter "validateOnly": When set to true,
   344  // the request will be validated but not submitted.
   345  func (c *ProjectsLocationsInstancesCreateCall) ValidateOnly(validateOnly bool) *ProjectsLocationsInstancesCreateCall {
   346  	c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
   347  	return c
   348  }
   349  
   350  // Fields allows partial responses to be retrieved. See
   351  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   352  // details.
   353  func (c *ProjectsLocationsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesCreateCall {
   354  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   355  	return c
   356  }
   357  
   358  // Context sets the context to be used in this call's Do method.
   359  func (c *ProjectsLocationsInstancesCreateCall) Context(ctx context.Context) *ProjectsLocationsInstancesCreateCall {
   360  	c.ctx_ = ctx
   361  	return c
   362  }
   363  
   364  // Header returns a http.Header that can be modified by the caller to add
   365  // headers to the request.
   366  func (c *ProjectsLocationsInstancesCreateCall) Header() http.Header {
   367  	if c.header_ == nil {
   368  		c.header_ = make(http.Header)
   369  	}
   370  	return c.header_
   371  }
   372  
   373  func (c *ProjectsLocationsInstancesCreateCall) doRequest(alt string) (*http.Response, error) {
   374  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   375  	var body io.Reader = nil
   376  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance)
   377  	if err != nil {
   378  		return nil, err
   379  	}
   380  	c.urlParams_.Set("alt", alt)
   381  	c.urlParams_.Set("prettyPrint", "false")
   382  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/instances")
   383  	urls += "?" + c.urlParams_.Encode()
   384  	req, err := http.NewRequest("POST", urls, body)
   385  	if err != nil {
   386  		return nil, err
   387  	}
   388  	req.Header = reqHeaders
   389  	googleapi.Expand(req.URL, map[string]string{
   390  		"parent": c.parent,
   391  	})
   392  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   393  }
   394  
   395  // Do executes the "firebasedatabase.projects.locations.instances.create" call.
   396  // Any non-2xx status code is an error. Response headers are in either
   397  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
   398  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   399  // check whether the returned error was because http.StatusNotModified was
   400  // returned.
   401  func (c *ProjectsLocationsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
   402  	gensupport.SetOptions(c.urlParams_, opts...)
   403  	res, err := c.doRequest("json")
   404  	if res != nil && res.StatusCode == http.StatusNotModified {
   405  		if res.Body != nil {
   406  			res.Body.Close()
   407  		}
   408  		return nil, gensupport.WrapError(&googleapi.Error{
   409  			Code:   res.StatusCode,
   410  			Header: res.Header,
   411  		})
   412  	}
   413  	if err != nil {
   414  		return nil, err
   415  	}
   416  	defer googleapi.CloseBody(res)
   417  	if err := googleapi.CheckResponse(res); err != nil {
   418  		return nil, gensupport.WrapError(err)
   419  	}
   420  	ret := &DatabaseInstance{
   421  		ServerResponse: googleapi.ServerResponse{
   422  			Header:         res.Header,
   423  			HTTPStatusCode: res.StatusCode,
   424  		},
   425  	}
   426  	target := &ret
   427  	if err := gensupport.DecodeResponse(target, res); err != nil {
   428  		return nil, err
   429  	}
   430  	return ret, nil
   431  }
   432  
   433  type ProjectsLocationsInstancesDeleteCall struct {
   434  	s          *Service
   435  	name       string
   436  	urlParams_ gensupport.URLParams
   437  	ctx_       context.Context
   438  	header_    http.Header
   439  }
   440  
   441  // Delete: Marks a DatabaseInstance to be deleted. The DatabaseInstance will be
   442  // set to the DELETED state for 20 days, and will be purged within 30 days. The
   443  // default database cannot be deleted. IDs for deleted database instances may
   444  // never be recovered or re-used. The Database may only be deleted if it is
   445  // already in a DISABLED state.
   446  //
   447  //   - name: The fully qualified resource name of the database instance, in the
   448  //     form:
   449  //     `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
   450  func (r *ProjectsLocationsInstancesService) Delete(name string) *ProjectsLocationsInstancesDeleteCall {
   451  	c := &ProjectsLocationsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   452  	c.name = name
   453  	return c
   454  }
   455  
   456  // Fields allows partial responses to be retrieved. See
   457  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   458  // details.
   459  func (c *ProjectsLocationsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDeleteCall {
   460  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   461  	return c
   462  }
   463  
   464  // Context sets the context to be used in this call's Do method.
   465  func (c *ProjectsLocationsInstancesDeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesDeleteCall {
   466  	c.ctx_ = ctx
   467  	return c
   468  }
   469  
   470  // Header returns a http.Header that can be modified by the caller to add
   471  // headers to the request.
   472  func (c *ProjectsLocationsInstancesDeleteCall) Header() http.Header {
   473  	if c.header_ == nil {
   474  		c.header_ = make(http.Header)
   475  	}
   476  	return c.header_
   477  }
   478  
   479  func (c *ProjectsLocationsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) {
   480  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   481  	var body io.Reader = nil
   482  	c.urlParams_.Set("alt", alt)
   483  	c.urlParams_.Set("prettyPrint", "false")
   484  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
   485  	urls += "?" + c.urlParams_.Encode()
   486  	req, err := http.NewRequest("DELETE", urls, body)
   487  	if err != nil {
   488  		return nil, err
   489  	}
   490  	req.Header = reqHeaders
   491  	googleapi.Expand(req.URL, map[string]string{
   492  		"name": c.name,
   493  	})
   494  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   495  }
   496  
   497  // Do executes the "firebasedatabase.projects.locations.instances.delete" call.
   498  // Any non-2xx status code is an error. Response headers are in either
   499  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
   500  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   501  // check whether the returned error was because http.StatusNotModified was
   502  // returned.
   503  func (c *ProjectsLocationsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
   504  	gensupport.SetOptions(c.urlParams_, opts...)
   505  	res, err := c.doRequest("json")
   506  	if res != nil && res.StatusCode == http.StatusNotModified {
   507  		if res.Body != nil {
   508  			res.Body.Close()
   509  		}
   510  		return nil, gensupport.WrapError(&googleapi.Error{
   511  			Code:   res.StatusCode,
   512  			Header: res.Header,
   513  		})
   514  	}
   515  	if err != nil {
   516  		return nil, err
   517  	}
   518  	defer googleapi.CloseBody(res)
   519  	if err := googleapi.CheckResponse(res); err != nil {
   520  		return nil, gensupport.WrapError(err)
   521  	}
   522  	ret := &DatabaseInstance{
   523  		ServerResponse: googleapi.ServerResponse{
   524  			Header:         res.Header,
   525  			HTTPStatusCode: res.StatusCode,
   526  		},
   527  	}
   528  	target := &ret
   529  	if err := gensupport.DecodeResponse(target, res); err != nil {
   530  		return nil, err
   531  	}
   532  	return ret, nil
   533  }
   534  
   535  type ProjectsLocationsInstancesDisableCall struct {
   536  	s                              *Service
   537  	name                           string
   538  	disabledatabaseinstancerequest *DisableDatabaseInstanceRequest
   539  	urlParams_                     gensupport.URLParams
   540  	ctx_                           context.Context
   541  	header_                        http.Header
   542  }
   543  
   544  // Disable: Disables a DatabaseInstance. The database can be re-enabled later
   545  // using ReenableDatabaseInstance. When a database is disabled, all reads and
   546  // writes are denied, including view access in the Firebase console.
   547  //
   548  //   - name: The fully qualified resource name of the database instance, in the
   549  //     form:
   550  //     `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
   551  func (r *ProjectsLocationsInstancesService) Disable(name string, disabledatabaseinstancerequest *DisableDatabaseInstanceRequest) *ProjectsLocationsInstancesDisableCall {
   552  	c := &ProjectsLocationsInstancesDisableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   553  	c.name = name
   554  	c.disabledatabaseinstancerequest = disabledatabaseinstancerequest
   555  	return c
   556  }
   557  
   558  // Fields allows partial responses to be retrieved. See
   559  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   560  // details.
   561  func (c *ProjectsLocationsInstancesDisableCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDisableCall {
   562  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   563  	return c
   564  }
   565  
   566  // Context sets the context to be used in this call's Do method.
   567  func (c *ProjectsLocationsInstancesDisableCall) Context(ctx context.Context) *ProjectsLocationsInstancesDisableCall {
   568  	c.ctx_ = ctx
   569  	return c
   570  }
   571  
   572  // Header returns a http.Header that can be modified by the caller to add
   573  // headers to the request.
   574  func (c *ProjectsLocationsInstancesDisableCall) Header() http.Header {
   575  	if c.header_ == nil {
   576  		c.header_ = make(http.Header)
   577  	}
   578  	return c.header_
   579  }
   580  
   581  func (c *ProjectsLocationsInstancesDisableCall) doRequest(alt string) (*http.Response, error) {
   582  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   583  	var body io.Reader = nil
   584  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.disabledatabaseinstancerequest)
   585  	if err != nil {
   586  		return nil, err
   587  	}
   588  	c.urlParams_.Set("alt", alt)
   589  	c.urlParams_.Set("prettyPrint", "false")
   590  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:disable")
   591  	urls += "?" + c.urlParams_.Encode()
   592  	req, err := http.NewRequest("POST", urls, body)
   593  	if err != nil {
   594  		return nil, err
   595  	}
   596  	req.Header = reqHeaders
   597  	googleapi.Expand(req.URL, map[string]string{
   598  		"name": c.name,
   599  	})
   600  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   601  }
   602  
   603  // Do executes the "firebasedatabase.projects.locations.instances.disable" call.
   604  // Any non-2xx status code is an error. Response headers are in either
   605  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
   606  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   607  // check whether the returned error was because http.StatusNotModified was
   608  // returned.
   609  func (c *ProjectsLocationsInstancesDisableCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
   610  	gensupport.SetOptions(c.urlParams_, opts...)
   611  	res, err := c.doRequest("json")
   612  	if res != nil && res.StatusCode == http.StatusNotModified {
   613  		if res.Body != nil {
   614  			res.Body.Close()
   615  		}
   616  		return nil, gensupport.WrapError(&googleapi.Error{
   617  			Code:   res.StatusCode,
   618  			Header: res.Header,
   619  		})
   620  	}
   621  	if err != nil {
   622  		return nil, err
   623  	}
   624  	defer googleapi.CloseBody(res)
   625  	if err := googleapi.CheckResponse(res); err != nil {
   626  		return nil, gensupport.WrapError(err)
   627  	}
   628  	ret := &DatabaseInstance{
   629  		ServerResponse: googleapi.ServerResponse{
   630  			Header:         res.Header,
   631  			HTTPStatusCode: res.StatusCode,
   632  		},
   633  	}
   634  	target := &ret
   635  	if err := gensupport.DecodeResponse(target, res); err != nil {
   636  		return nil, err
   637  	}
   638  	return ret, nil
   639  }
   640  
   641  type ProjectsLocationsInstancesGetCall struct {
   642  	s            *Service
   643  	nameid       string
   644  	urlParams_   gensupport.URLParams
   645  	ifNoneMatch_ string
   646  	ctx_         context.Context
   647  	header_      http.Header
   648  }
   649  
   650  // Get: Gets the DatabaseInstance identified by the specified resource name.
   651  //
   652  //   - name: The fully qualified resource name of the database instance, in the
   653  //     form:
   654  //     `projects/{project-number}/locations/{location-id}/instances/{database-id}`
   655  //     . `database-id` is a globally unique identifier across all parent
   656  //     collections. For convenience, this method allows you to supply `-` as a
   657  //     wildcard character in place of specific collections under `projects` and
   658  //     `locations`. The resulting wildcarding form of the method is:
   659  //     `projects/-/locations/-/instances/{database-id}`.
   660  func (r *ProjectsLocationsInstancesService) Get(nameid string) *ProjectsLocationsInstancesGetCall {
   661  	c := &ProjectsLocationsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   662  	c.nameid = nameid
   663  	return c
   664  }
   665  
   666  // Fields allows partial responses to be retrieved. See
   667  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   668  // details.
   669  func (c *ProjectsLocationsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetCall {
   670  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   671  	return c
   672  }
   673  
   674  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   675  // object's ETag matches the given value. This is useful for getting updates
   676  // only after the object has changed since the last request.
   677  func (c *ProjectsLocationsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetCall {
   678  	c.ifNoneMatch_ = entityTag
   679  	return c
   680  }
   681  
   682  // Context sets the context to be used in this call's Do method.
   683  func (c *ProjectsLocationsInstancesGetCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetCall {
   684  	c.ctx_ = ctx
   685  	return c
   686  }
   687  
   688  // Header returns a http.Header that can be modified by the caller to add
   689  // headers to the request.
   690  func (c *ProjectsLocationsInstancesGetCall) Header() http.Header {
   691  	if c.header_ == nil {
   692  		c.header_ = make(http.Header)
   693  	}
   694  	return c.header_
   695  }
   696  
   697  func (c *ProjectsLocationsInstancesGetCall) doRequest(alt string) (*http.Response, error) {
   698  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   699  	if c.ifNoneMatch_ != "" {
   700  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   701  	}
   702  	var body io.Reader = nil
   703  	c.urlParams_.Set("alt", alt)
   704  	c.urlParams_.Set("prettyPrint", "false")
   705  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
   706  	urls += "?" + c.urlParams_.Encode()
   707  	req, err := http.NewRequest("GET", urls, body)
   708  	if err != nil {
   709  		return nil, err
   710  	}
   711  	req.Header = reqHeaders
   712  	googleapi.Expand(req.URL, map[string]string{
   713  		"name": c.nameid,
   714  	})
   715  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   716  }
   717  
   718  // Do executes the "firebasedatabase.projects.locations.instances.get" call.
   719  // Any non-2xx status code is an error. Response headers are in either
   720  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
   721  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   722  // check whether the returned error was because http.StatusNotModified was
   723  // returned.
   724  func (c *ProjectsLocationsInstancesGetCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
   725  	gensupport.SetOptions(c.urlParams_, opts...)
   726  	res, err := c.doRequest("json")
   727  	if res != nil && res.StatusCode == http.StatusNotModified {
   728  		if res.Body != nil {
   729  			res.Body.Close()
   730  		}
   731  		return nil, gensupport.WrapError(&googleapi.Error{
   732  			Code:   res.StatusCode,
   733  			Header: res.Header,
   734  		})
   735  	}
   736  	if err != nil {
   737  		return nil, err
   738  	}
   739  	defer googleapi.CloseBody(res)
   740  	if err := googleapi.CheckResponse(res); err != nil {
   741  		return nil, gensupport.WrapError(err)
   742  	}
   743  	ret := &DatabaseInstance{
   744  		ServerResponse: googleapi.ServerResponse{
   745  			Header:         res.Header,
   746  			HTTPStatusCode: res.StatusCode,
   747  		},
   748  	}
   749  	target := &ret
   750  	if err := gensupport.DecodeResponse(target, res); err != nil {
   751  		return nil, err
   752  	}
   753  	return ret, nil
   754  }
   755  
   756  type ProjectsLocationsInstancesListCall struct {
   757  	s            *Service
   758  	parent       string
   759  	urlParams_   gensupport.URLParams
   760  	ifNoneMatch_ string
   761  	ctx_         context.Context
   762  	header_      http.Header
   763  }
   764  
   765  // List: Lists each DatabaseInstance associated with the specified parent
   766  // project. The list items are returned in no particular order, but will be a
   767  // consistent view of the database instances when additional requests are made
   768  // with a `pageToken`. The resulting list contains instances in any STATE. The
   769  // list results may be stale by a few seconds. Use GetDatabaseInstance for
   770  // consistent reads.
   771  //
   772  //   - parent: The parent project for which to list database instances, in the
   773  //     form: `projects/{project-number}/locations/{location-id}` To list across
   774  //     all locations, use a parent in the form:
   775  //     `projects/{project-number}/locations/-`.
   776  func (r *ProjectsLocationsInstancesService) List(parent string) *ProjectsLocationsInstancesListCall {
   777  	c := &ProjectsLocationsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   778  	c.parent = parent
   779  	return c
   780  }
   781  
   782  // PageSize sets the optional parameter "pageSize": The maximum number of
   783  // database instances to return in the response. The server may return fewer
   784  // than this at its discretion. If no value is specified (or too large a value
   785  // is specified), then the server will impose its own limit.
   786  func (c *ProjectsLocationsInstancesListCall) PageSize(pageSize int64) *ProjectsLocationsInstancesListCall {
   787  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   788  	return c
   789  }
   790  
   791  // PageToken sets the optional parameter "pageToken": Token returned from a
   792  // previous call to `ListDatabaseInstances` indicating where in the set of
   793  // database instances to resume listing.
   794  func (c *ProjectsLocationsInstancesListCall) PageToken(pageToken string) *ProjectsLocationsInstancesListCall {
   795  	c.urlParams_.Set("pageToken", pageToken)
   796  	return c
   797  }
   798  
   799  // ShowDeleted sets the optional parameter "showDeleted": Indicate that
   800  // DatabaseInstances in the `DELETED` state should also be returned.
   801  func (c *ProjectsLocationsInstancesListCall) ShowDeleted(showDeleted bool) *ProjectsLocationsInstancesListCall {
   802  	c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
   803  	return c
   804  }
   805  
   806  // Fields allows partial responses to be retrieved. See
   807  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   808  // details.
   809  func (c *ProjectsLocationsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesListCall {
   810  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   811  	return c
   812  }
   813  
   814  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   815  // object's ETag matches the given value. This is useful for getting updates
   816  // only after the object has changed since the last request.
   817  func (c *ProjectsLocationsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesListCall {
   818  	c.ifNoneMatch_ = entityTag
   819  	return c
   820  }
   821  
   822  // Context sets the context to be used in this call's Do method.
   823  func (c *ProjectsLocationsInstancesListCall) Context(ctx context.Context) *ProjectsLocationsInstancesListCall {
   824  	c.ctx_ = ctx
   825  	return c
   826  }
   827  
   828  // Header returns a http.Header that can be modified by the caller to add
   829  // headers to the request.
   830  func (c *ProjectsLocationsInstancesListCall) Header() http.Header {
   831  	if c.header_ == nil {
   832  		c.header_ = make(http.Header)
   833  	}
   834  	return c.header_
   835  }
   836  
   837  func (c *ProjectsLocationsInstancesListCall) doRequest(alt string) (*http.Response, error) {
   838  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   839  	if c.ifNoneMatch_ != "" {
   840  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   841  	}
   842  	var body io.Reader = nil
   843  	c.urlParams_.Set("alt", alt)
   844  	c.urlParams_.Set("prettyPrint", "false")
   845  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/instances")
   846  	urls += "?" + c.urlParams_.Encode()
   847  	req, err := http.NewRequest("GET", urls, body)
   848  	if err != nil {
   849  		return nil, err
   850  	}
   851  	req.Header = reqHeaders
   852  	googleapi.Expand(req.URL, map[string]string{
   853  		"parent": c.parent,
   854  	})
   855  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   856  }
   857  
   858  // Do executes the "firebasedatabase.projects.locations.instances.list" call.
   859  // Any non-2xx status code is an error. Response headers are in either
   860  // *ListDatabaseInstancesResponse.ServerResponse.Header or (if a response was
   861  // returned at all) in error.(*googleapi.Error).Header. Use
   862  // googleapi.IsNotModified to check whether the returned error was because
   863  // http.StatusNotModified was returned.
   864  func (c *ProjectsLocationsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListDatabaseInstancesResponse, error) {
   865  	gensupport.SetOptions(c.urlParams_, opts...)
   866  	res, err := c.doRequest("json")
   867  	if res != nil && res.StatusCode == http.StatusNotModified {
   868  		if res.Body != nil {
   869  			res.Body.Close()
   870  		}
   871  		return nil, gensupport.WrapError(&googleapi.Error{
   872  			Code:   res.StatusCode,
   873  			Header: res.Header,
   874  		})
   875  	}
   876  	if err != nil {
   877  		return nil, err
   878  	}
   879  	defer googleapi.CloseBody(res)
   880  	if err := googleapi.CheckResponse(res); err != nil {
   881  		return nil, gensupport.WrapError(err)
   882  	}
   883  	ret := &ListDatabaseInstancesResponse{
   884  		ServerResponse: googleapi.ServerResponse{
   885  			Header:         res.Header,
   886  			HTTPStatusCode: res.StatusCode,
   887  		},
   888  	}
   889  	target := &ret
   890  	if err := gensupport.DecodeResponse(target, res); err != nil {
   891  		return nil, err
   892  	}
   893  	return ret, nil
   894  }
   895  
   896  // Pages invokes f for each page of results.
   897  // A non-nil error returned from f will halt the iteration.
   898  // The provided context supersedes any context provided to the Context method.
   899  func (c *ProjectsLocationsInstancesListCall) Pages(ctx context.Context, f func(*ListDatabaseInstancesResponse) error) error {
   900  	c.ctx_ = ctx
   901  	defer c.PageToken(c.urlParams_.Get("pageToken"))
   902  	for {
   903  		x, err := c.Do()
   904  		if err != nil {
   905  			return err
   906  		}
   907  		if err := f(x); err != nil {
   908  			return err
   909  		}
   910  		if x.NextPageToken == "" {
   911  			return nil
   912  		}
   913  		c.PageToken(x.NextPageToken)
   914  	}
   915  }
   916  
   917  type ProjectsLocationsInstancesReenableCall struct {
   918  	s                               *Service
   919  	name                            string
   920  	reenabledatabaseinstancerequest *ReenableDatabaseInstanceRequest
   921  	urlParams_                      gensupport.URLParams
   922  	ctx_                            context.Context
   923  	header_                         http.Header
   924  }
   925  
   926  // Reenable: Enables a DatabaseInstance. The database must have been disabled
   927  // previously using DisableDatabaseInstance. The state of a successfully
   928  // reenabled DatabaseInstance is ACTIVE.
   929  //
   930  //   - name: The fully qualified resource name of the database instance, in the
   931  //     form:
   932  //     `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
   933  func (r *ProjectsLocationsInstancesService) Reenable(name string, reenabledatabaseinstancerequest *ReenableDatabaseInstanceRequest) *ProjectsLocationsInstancesReenableCall {
   934  	c := &ProjectsLocationsInstancesReenableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   935  	c.name = name
   936  	c.reenabledatabaseinstancerequest = reenabledatabaseinstancerequest
   937  	return c
   938  }
   939  
   940  // Fields allows partial responses to be retrieved. See
   941  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   942  // details.
   943  func (c *ProjectsLocationsInstancesReenableCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesReenableCall {
   944  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   945  	return c
   946  }
   947  
   948  // Context sets the context to be used in this call's Do method.
   949  func (c *ProjectsLocationsInstancesReenableCall) Context(ctx context.Context) *ProjectsLocationsInstancesReenableCall {
   950  	c.ctx_ = ctx
   951  	return c
   952  }
   953  
   954  // Header returns a http.Header that can be modified by the caller to add
   955  // headers to the request.
   956  func (c *ProjectsLocationsInstancesReenableCall) Header() http.Header {
   957  	if c.header_ == nil {
   958  		c.header_ = make(http.Header)
   959  	}
   960  	return c.header_
   961  }
   962  
   963  func (c *ProjectsLocationsInstancesReenableCall) doRequest(alt string) (*http.Response, error) {
   964  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   965  	var body io.Reader = nil
   966  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.reenabledatabaseinstancerequest)
   967  	if err != nil {
   968  		return nil, err
   969  	}
   970  	c.urlParams_.Set("alt", alt)
   971  	c.urlParams_.Set("prettyPrint", "false")
   972  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:reenable")
   973  	urls += "?" + c.urlParams_.Encode()
   974  	req, err := http.NewRequest("POST", urls, body)
   975  	if err != nil {
   976  		return nil, err
   977  	}
   978  	req.Header = reqHeaders
   979  	googleapi.Expand(req.URL, map[string]string{
   980  		"name": c.name,
   981  	})
   982  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   983  }
   984  
   985  // Do executes the "firebasedatabase.projects.locations.instances.reenable" call.
   986  // Any non-2xx status code is an error. Response headers are in either
   987  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
   988  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   989  // check whether the returned error was because http.StatusNotModified was
   990  // returned.
   991  func (c *ProjectsLocationsInstancesReenableCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
   992  	gensupport.SetOptions(c.urlParams_, opts...)
   993  	res, err := c.doRequest("json")
   994  	if res != nil && res.StatusCode == http.StatusNotModified {
   995  		if res.Body != nil {
   996  			res.Body.Close()
   997  		}
   998  		return nil, gensupport.WrapError(&googleapi.Error{
   999  			Code:   res.StatusCode,
  1000  			Header: res.Header,
  1001  		})
  1002  	}
  1003  	if err != nil {
  1004  		return nil, err
  1005  	}
  1006  	defer googleapi.CloseBody(res)
  1007  	if err := googleapi.CheckResponse(res); err != nil {
  1008  		return nil, gensupport.WrapError(err)
  1009  	}
  1010  	ret := &DatabaseInstance{
  1011  		ServerResponse: googleapi.ServerResponse{
  1012  			Header:         res.Header,
  1013  			HTTPStatusCode: res.StatusCode,
  1014  		},
  1015  	}
  1016  	target := &ret
  1017  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1018  		return nil, err
  1019  	}
  1020  	return ret, nil
  1021  }
  1022  
  1023  type ProjectsLocationsInstancesUndeleteCall struct {
  1024  	s                               *Service
  1025  	name                            string
  1026  	undeletedatabaseinstancerequest *UndeleteDatabaseInstanceRequest
  1027  	urlParams_                      gensupport.URLParams
  1028  	ctx_                            context.Context
  1029  	header_                         http.Header
  1030  }
  1031  
  1032  // Undelete: Restores a DatabaseInstance that was previously marked to be
  1033  // deleted. After the delete method is used, DatabaseInstances are set to the
  1034  // DELETED state for 20 days, and will be purged within 30 days. Databases in
  1035  // the DELETED state can be undeleted without losing any data. This method may
  1036  // only be used on a DatabaseInstance in the DELETED state. Purged
  1037  // DatabaseInstances may not be recovered.
  1038  //
  1039  //   - name: The fully qualified resource name of the database instance, in the
  1040  //     form:
  1041  //     `projects/{project-number}/locations/{location-id}/instances/{database-id}`.
  1042  func (r *ProjectsLocationsInstancesService) Undelete(name string, undeletedatabaseinstancerequest *UndeleteDatabaseInstanceRequest) *ProjectsLocationsInstancesUndeleteCall {
  1043  	c := &ProjectsLocationsInstancesUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1044  	c.name = name
  1045  	c.undeletedatabaseinstancerequest = undeletedatabaseinstancerequest
  1046  	return c
  1047  }
  1048  
  1049  // Fields allows partial responses to be retrieved. See
  1050  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1051  // details.
  1052  func (c *ProjectsLocationsInstancesUndeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesUndeleteCall {
  1053  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1054  	return c
  1055  }
  1056  
  1057  // Context sets the context to be used in this call's Do method.
  1058  func (c *ProjectsLocationsInstancesUndeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesUndeleteCall {
  1059  	c.ctx_ = ctx
  1060  	return c
  1061  }
  1062  
  1063  // Header returns a http.Header that can be modified by the caller to add
  1064  // headers to the request.
  1065  func (c *ProjectsLocationsInstancesUndeleteCall) Header() http.Header {
  1066  	if c.header_ == nil {
  1067  		c.header_ = make(http.Header)
  1068  	}
  1069  	return c.header_
  1070  }
  1071  
  1072  func (c *ProjectsLocationsInstancesUndeleteCall) doRequest(alt string) (*http.Response, error) {
  1073  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1074  	var body io.Reader = nil
  1075  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeletedatabaseinstancerequest)
  1076  	if err != nil {
  1077  		return nil, err
  1078  	}
  1079  	c.urlParams_.Set("alt", alt)
  1080  	c.urlParams_.Set("prettyPrint", "false")
  1081  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:undelete")
  1082  	urls += "?" + c.urlParams_.Encode()
  1083  	req, err := http.NewRequest("POST", urls, body)
  1084  	if err != nil {
  1085  		return nil, err
  1086  	}
  1087  	req.Header = reqHeaders
  1088  	googleapi.Expand(req.URL, map[string]string{
  1089  		"name": c.name,
  1090  	})
  1091  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1092  }
  1093  
  1094  // Do executes the "firebasedatabase.projects.locations.instances.undelete" call.
  1095  // Any non-2xx status code is an error. Response headers are in either
  1096  // *DatabaseInstance.ServerResponse.Header or (if a response was returned at
  1097  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1098  // check whether the returned error was because http.StatusNotModified was
  1099  // returned.
  1100  func (c *ProjectsLocationsInstancesUndeleteCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) {
  1101  	gensupport.SetOptions(c.urlParams_, opts...)
  1102  	res, err := c.doRequest("json")
  1103  	if res != nil && res.StatusCode == http.StatusNotModified {
  1104  		if res.Body != nil {
  1105  			res.Body.Close()
  1106  		}
  1107  		return nil, gensupport.WrapError(&googleapi.Error{
  1108  			Code:   res.StatusCode,
  1109  			Header: res.Header,
  1110  		})
  1111  	}
  1112  	if err != nil {
  1113  		return nil, err
  1114  	}
  1115  	defer googleapi.CloseBody(res)
  1116  	if err := googleapi.CheckResponse(res); err != nil {
  1117  		return nil, gensupport.WrapError(err)
  1118  	}
  1119  	ret := &DatabaseInstance{
  1120  		ServerResponse: googleapi.ServerResponse{
  1121  			Header:         res.Header,
  1122  			HTTPStatusCode: res.StatusCode,
  1123  		},
  1124  	}
  1125  	target := &ret
  1126  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1127  		return nil, err
  1128  	}
  1129  	return ret, nil
  1130  }
  1131  

View as plain text