| // Copyright 2021 Google LLC. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Code generated file. DO NOT EDIT. |
| |
| // Package firebasedatabase provides access to the Firebase Realtime Database Management API. |
| // |
| // For product documentation, see: https://firebase.google.com/docs/reference/rest/database/database-management/rest/ |
| // |
| // Creating a client |
| // |
| // Usage example: |
| // |
| // import "google.golang.org/api/firebasedatabase/v1beta" |
| // ... |
| // ctx := context.Background() |
| // firebasedatabaseService, err := firebasedatabase.NewService(ctx) |
| // |
| // In this example, Google Application Default Credentials are used for authentication. |
| // |
| // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. |
| // |
| // Other authentication options |
| // |
| // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: |
| // |
| // firebasedatabaseService, err := firebasedatabase.NewService(ctx, option.WithScopes(firebasedatabase.FirebaseReadonlyScope)) |
| // |
| // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: |
| // |
| // firebasedatabaseService, err := firebasedatabase.NewService(ctx, option.WithAPIKey("AIza...")) |
| // |
| // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: |
| // |
| // config := &oauth2.Config{...} |
| // // ... |
| // token, err := config.Exchange(ctx, ...) |
| // firebasedatabaseService, err := firebasedatabase.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) |
| // |
| // See https://godoc.org/google.golang.org/api/option/ for details on options. |
| package firebasedatabase // import "google.golang.org/api/firebasedatabase/v1beta" |
| |
| import ( |
| "bytes" |
| "context" |
| "encoding/json" |
| "errors" |
| "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| "strconv" |
| "strings" |
| |
| googleapi "google.golang.org/api/googleapi" |
| gensupport "google.golang.org/api/internal/gensupport" |
| option "google.golang.org/api/option" |
| internaloption "google.golang.org/api/option/internaloption" |
| htransport "google.golang.org/api/transport/http" |
| ) |
| |
| // Always reference these packages, just in case the auto-generated code |
| // below doesn't. |
| var _ = bytes.NewBuffer |
| var _ = strconv.Itoa |
| var _ = fmt.Sprintf |
| var _ = json.NewDecoder |
| var _ = io.Copy |
| var _ = url.Parse |
| var _ = gensupport.MarshalJSON |
| var _ = googleapi.Version |
| var _ = errors.New |
| var _ = strings.Replace |
| var _ = context.Canceled |
| var _ = internaloption.WithDefaultEndpoint |
| |
| const apiId = "firebasedatabase:v1beta" |
| const apiName = "firebasedatabase" |
| const apiVersion = "v1beta" |
| const basePath = "https://firebasedatabase.googleapis.com/" |
| const mtlsBasePath = "https://firebasedatabase.mtls.googleapis.com/" |
| |
| // OAuth2 scopes used by this API. |
| const ( |
| // View and manage your data across Google Cloud Platform services |
| CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" |
| |
| // View your data across Google Cloud Platform services |
| CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" |
| |
| // View and administer all your Firebase data and settings |
| FirebaseScope = "https://www.googleapis.com/auth/firebase" |
| |
| // View all your Firebase data and settings |
| FirebaseReadonlyScope = "https://www.googleapis.com/auth/firebase.readonly" |
| ) |
| |
| // NewService creates a new Service. |
| func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { |
| scopesOption := option.WithScopes( |
| "https://www.googleapis.com/auth/cloud-platform", |
| "https://www.googleapis.com/auth/cloud-platform.read-only", |
| "https://www.googleapis.com/auth/firebase", |
| "https://www.googleapis.com/auth/firebase.readonly", |
| ) |
| // NOTE: prepend, so we don't override user-specified scopes. |
| opts = append([]option.ClientOption{scopesOption}, opts...) |
| opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) |
| opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) |
| client, endpoint, err := htransport.NewClient(ctx, opts...) |
| if err != nil { |
| return nil, err |
| } |
| s, err := New(client) |
| if err != nil { |
| return nil, err |
| } |
| if endpoint != "" { |
| s.BasePath = endpoint |
| } |
| return s, nil |
| } |
| |
| // New creates a new Service. It uses the provided http.Client for requests. |
| // |
| // Deprecated: please use NewService instead. |
| // To provide a custom HTTP client, use option.WithHTTPClient. |
| // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. |
| func New(client *http.Client) (*Service, error) { |
| if client == nil { |
| return nil, errors.New("client is nil") |
| } |
| s := &Service{client: client, BasePath: basePath} |
| s.Projects = NewProjectsService(s) |
| return s, nil |
| } |
| |
| type Service struct { |
| client *http.Client |
| BasePath string // API endpoint base URL |
| UserAgent string // optional additional User-Agent fragment |
| |
| Projects *ProjectsService |
| } |
| |
| func (s *Service) userAgent() string { |
| if s.UserAgent == "" { |
| return googleapi.UserAgent |
| } |
| return googleapi.UserAgent + " " + s.UserAgent |
| } |
| |
| func NewProjectsService(s *Service) *ProjectsService { |
| rs := &ProjectsService{s: s} |
| rs.Locations = NewProjectsLocationsService(s) |
| return rs |
| } |
| |
| type ProjectsService struct { |
| s *Service |
| |
| Locations *ProjectsLocationsService |
| } |
| |
| func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { |
| rs := &ProjectsLocationsService{s: s} |
| rs.Instances = NewProjectsLocationsInstancesService(s) |
| return rs |
| } |
| |
| type ProjectsLocationsService struct { |
| s *Service |
| |
| Instances *ProjectsLocationsInstancesService |
| } |
| |
| func NewProjectsLocationsInstancesService(s *Service) *ProjectsLocationsInstancesService { |
| rs := &ProjectsLocationsInstancesService{s: s} |
| return rs |
| } |
| |
| type ProjectsLocationsInstancesService struct { |
| s *Service |
| } |
| |
| // DatabaseInstance: Representation of a Realtime Database instance. |
| // Details on interacting with contents of a DatabaseInstance can be |
| // found at: https://firebase.google.com/docs/database/rest/start. |
| type DatabaseInstance struct { |
| // DatabaseUrl: Immutable. The globally unique hostname of the database. |
| DatabaseUrl string `json:"databaseUrl,omitempty"` |
| |
| // Name: The fully qualified resource name of the database instance, in |
| // the form: |
| // `projects/{project-number}/locations/{location-id}/instances/{database |
| // -id}`. Currently the only supported location is 'us-central1'. |
| Name string `json:"name,omitempty"` |
| |
| // Project: The resource name of the project this instance belongs to. |
| // For example: `projects/{project-number}`. |
| Project string `json:"project,omitempty"` |
| |
| // State: The database's lifecycle state. Read-only. |
| // |
| // Possible values: |
| // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state, likely the |
| // result of an error on the backend. This is only used for |
| // distinguishing unset values. |
| // "ACTIVE" - The normal and active state. |
| // "DISABLED" - The database is in a disabled state. It can be |
| // re-enabled later. |
| // "DELETED" - The database is in a deleted state. |
| State string `json:"state,omitempty"` |
| |
| // Type: The database instance type. On creation only USER_DATABASE is |
| // allowed, which is also the default when omitted. |
| // |
| // Possible values: |
| // "DATABASE_INSTANCE_TYPE_UNSPECIFIED" - Unknown state, likely the |
| // result of an error on the backend. This is only used for |
| // distinguishing unset values. |
| // "DEFAULT_DATABASE" - The default database that is provisioned when |
| // a project is created. |
| // "USER_DATABASE" - A database that the user created. |
| Type string `json:"type,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "DatabaseUrl") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "DatabaseUrl") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *DatabaseInstance) MarshalJSON() ([]byte, error) { |
| type NoMethod DatabaseInstance |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // DisableDatabaseInstanceRequest: The request sent to the |
| // DisableDatabaseInstance method. |
| type DisableDatabaseInstanceRequest struct { |
| } |
| |
| // ListDatabaseInstancesResponse: The response from the |
| // ListDatabaseInstances method. |
| type ListDatabaseInstancesResponse struct { |
| // Instances: List of each DatabaseInstance that is in the parent |
| // Firebase project. |
| Instances []*DatabaseInstance `json:"instances,omitempty"` |
| |
| // NextPageToken: If the result list is too large to fit in a single |
| // response, then a token is returned. If the string is empty, then this |
| // response is the last page of results. This token can be used in a |
| // subsequent call to `ListDatabaseInstances` to find the next group of |
| // database instances. Page tokens are short-lived and should not be |
| // persisted. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Instances") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Instances") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListDatabaseInstancesResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListDatabaseInstancesResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ReenableDatabaseInstanceRequest: The request sent to the |
| // ReenableDatabaseInstance method. |
| type ReenableDatabaseInstanceRequest struct { |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.create": |
| |
| type ProjectsLocationsInstancesCreateCall struct { |
| s *Service |
| parent string |
| databaseinstance *DatabaseInstance |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Create: Requests that a new DatabaseInstance be created. The state of |
| // a successfully created DatabaseInstance is ACTIVE. Only available for |
| // projects on the Blaze plan. Projects can be upgraded using the Cloud |
| // Billing API |
| // https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. |
| // Note that it might take a few minutes for billing enablement state to |
| // propagate to Firebase systems. |
| func (r *ProjectsLocationsInstancesService) Create(parent string, databaseinstance *DatabaseInstance) *ProjectsLocationsInstancesCreateCall { |
| c := &ProjectsLocationsInstancesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| c.databaseinstance = databaseinstance |
| return c |
| } |
| |
| // DatabaseId sets the optional parameter "databaseId": The globally |
| // unique identifier of the database instance. |
| func (c *ProjectsLocationsInstancesCreateCall) DatabaseId(databaseId string) *ProjectsLocationsInstancesCreateCall { |
| c.urlParams_.Set("databaseId", databaseId) |
| return c |
| } |
| |
| // ValidateOnly sets the optional parameter "validateOnly": When set to |
| // true, the request will be validated but not submitted. |
| func (c *ProjectsLocationsInstancesCreateCall) ValidateOnly(validateOnly bool) *ProjectsLocationsInstancesCreateCall { |
| c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly)) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesCreateCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesCreateCall) Context(ctx context.Context) *ProjectsLocationsInstancesCreateCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesCreateCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesCreateCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.databaseinstance) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/instances") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.create" call. |
| // Exactly one of *DatabaseInstance or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *DatabaseInstance.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesCreateCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &DatabaseInstance{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Requests that a new DatabaseInstance be created. The state of a successfully created DatabaseInstance is ACTIVE. Only available for projects on the Blaze plan. Projects can be upgraded using the Cloud Billing API https://cloud.google.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it might take a few minutes for billing enablement state to propagate to Firebase systems.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances", |
| // "httpMethod": "POST", |
| // "id": "firebasedatabase.projects.locations.instances.create", |
| // "parameterOrder": [ |
| // "parent" |
| // ], |
| // "parameters": { |
| // "databaseId": { |
| // "description": "The globally unique identifier of the database instance.", |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "parent": { |
| // "description": "The parent project for which to create a database instance, in the form: `projects/{project-number}/locations/{location-id}`.", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "validateOnly": { |
| // "description": "When set to true, the request will be validated but not submitted.", |
| // "location": "query", |
| // "type": "boolean" |
| // } |
| // }, |
| // "path": "v1beta/{+parent}/instances", |
| // "request": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "response": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/firebase" |
| // ] |
| // } |
| |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.delete": |
| |
| type ProjectsLocationsInstancesDeleteCall struct { |
| s *Service |
| name string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Delete: Marks a DatabaseInstance to be deleted. The DatabaseInstance |
| // will be purged within 30 days. The default database cannot be |
| // deleted. IDs for deleted database instances may never be recovered or |
| // re-used. The Database may only be deleted if it is already in a |
| // DISABLED state. |
| func (r *ProjectsLocationsInstancesService) Delete(name string) *ProjectsLocationsInstancesDeleteCall { |
| c := &ProjectsLocationsInstancesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDeleteCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesDeleteCall) Context(ctx context.Context) *ProjectsLocationsInstancesDeleteCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesDeleteCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesDeleteCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("DELETE", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.delete" call. |
| // Exactly one of *DatabaseInstance or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *DatabaseInstance.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesDeleteCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &DatabaseInstance{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Marks a DatabaseInstance to be deleted. The DatabaseInstance will be purged within 30 days. The default database cannot be deleted. IDs for deleted database instances may never be recovered or re-used. The Database may only be deleted if it is already in a DISABLED state.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}", |
| // "httpMethod": "DELETE", |
| // "id": "firebasedatabase.projects.locations.instances.delete", |
| // "parameterOrder": [ |
| // "name" |
| // ], |
| // "parameters": { |
| // "name": { |
| // "description": "The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "v1beta/{+name}", |
| // "response": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/firebase" |
| // ] |
| // } |
| |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.disable": |
| |
| type ProjectsLocationsInstancesDisableCall struct { |
| s *Service |
| name string |
| disabledatabaseinstancerequest *DisableDatabaseInstanceRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Disable: Disables a DatabaseInstance. The database can be re-enabled |
| // later using ReenableDatabaseInstance. When a database is disabled, |
| // all reads and writes are denied, including view access in the |
| // Firebase console. |
| func (r *ProjectsLocationsInstancesService) Disable(name string, disabledatabaseinstancerequest *DisableDatabaseInstanceRequest) *ProjectsLocationsInstancesDisableCall { |
| c := &ProjectsLocationsInstancesDisableCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| c.disabledatabaseinstancerequest = disabledatabaseinstancerequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesDisableCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesDisableCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesDisableCall) Context(ctx context.Context) *ProjectsLocationsInstancesDisableCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesDisableCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesDisableCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.disabledatabaseinstancerequest) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:disable") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.disable" call. |
| // Exactly one of *DatabaseInstance or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *DatabaseInstance.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesDisableCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &DatabaseInstance{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Disables a DatabaseInstance. The database can be re-enabled later using ReenableDatabaseInstance. When a database is disabled, all reads and writes are denied, including view access in the Firebase console.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:disable", |
| // "httpMethod": "POST", |
| // "id": "firebasedatabase.projects.locations.instances.disable", |
| // "parameterOrder": [ |
| // "name" |
| // ], |
| // "parameters": { |
| // "name": { |
| // "description": "The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "v1beta/{+name}:disable", |
| // "request": { |
| // "$ref": "DisableDatabaseInstanceRequest" |
| // }, |
| // "response": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/firebase" |
| // ] |
| // } |
| |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.get": |
| |
| type ProjectsLocationsInstancesGetCall struct { |
| s *Service |
| nameid string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Gets the DatabaseInstance identified by the specified resource |
| // name. |
| func (r *ProjectsLocationsInstancesService) Get(nameid string) *ProjectsLocationsInstancesGetCall { |
| c := &ProjectsLocationsInstancesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.nameid = nameid |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ProjectsLocationsInstancesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesGetCall) Context(ctx context.Context) *ProjectsLocationsInstancesGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.nameid, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.get" call. |
| // Exactly one of *DatabaseInstance or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *DatabaseInstance.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesGetCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &DatabaseInstance{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Gets the DatabaseInstance identified by the specified resource name.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}", |
| // "httpMethod": "GET", |
| // "id": "firebasedatabase.projects.locations.instances.get", |
| // "parameterOrder": [ |
| // "name" |
| // ], |
| // "parameters": { |
| // "name": { |
| // "description": "The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`. `database-id` is a globally unique identifier across all parent collections. For convenience, this method allows you to supply `-` as a wildcard character in place of specific collections under `projects` and `locations`. The resulting wildcarding form of the method is: `projects/-/locations/-/instances/{database-id}`.", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "v1beta/{+name}", |
| // "response": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/cloud-platform.read-only", |
| // "https://www.googleapis.com/auth/firebase", |
| // "https://www.googleapis.com/auth/firebase.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.list": |
| |
| type ProjectsLocationsInstancesListCall struct { |
| s *Service |
| parent string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists each DatabaseInstance associated with the specified |
| // parent project. The list items are returned in no particular order, |
| // but will be a consistent view of the database instances when |
| // additional requests are made with a `pageToken`. The resulting list |
| // contains instances in any STATE. The list results may be stale by a |
| // few seconds. Use GetDatabaseInstance for consistent reads. |
| func (r *ProjectsLocationsInstancesService) List(parent string) *ProjectsLocationsInstancesListCall { |
| c := &ProjectsLocationsInstancesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.parent = parent |
| return c |
| } |
| |
| // PageSize sets the optional parameter "pageSize": The maximum number |
| // of database instances to return in the response. The server may |
| // return fewer than this at its discretion. If no value is specified |
| // (or too large a value is specified), then the server will impose its |
| // own limit. |
| func (c *ProjectsLocationsInstancesListCall) PageSize(pageSize int64) *ProjectsLocationsInstancesListCall { |
| c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": Token returned |
| // from a previous call to `ListDatabaseInstances` indicating where in |
| // the set of database instances to resume listing. |
| func (c *ProjectsLocationsInstancesListCall) PageToken(pageToken string) *ProjectsLocationsInstancesListCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *ProjectsLocationsInstancesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsInstancesListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesListCall) Context(ctx context.Context) *ProjectsLocationsInstancesListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/instances") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "parent": c.parent, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.list" call. |
| // Exactly one of *ListDatabaseInstancesResponse or error will be |
| // non-nil. Any non-2xx status code is an error. Response headers are in |
| // either *ListDatabaseInstancesResponse.ServerResponse.Header or (if a |
| // response was returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesListCall) Do(opts ...googleapi.CallOption) (*ListDatabaseInstancesResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &ListDatabaseInstancesResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Lists each DatabaseInstance associated with the specified parent project. The list items are returned in no particular order, but will be a consistent view of the database instances when additional requests are made with a `pageToken`. The resulting list contains instances in any STATE. The list results may be stale by a few seconds. Use GetDatabaseInstance for consistent reads.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances", |
| // "httpMethod": "GET", |
| // "id": "firebasedatabase.projects.locations.instances.list", |
| // "parameterOrder": [ |
| // "parent" |
| // ], |
| // "parameters": { |
| // "pageSize": { |
| // "description": "The maximum number of database instances to return in the response. The server may return fewer than this at its discretion. If no value is specified (or too large a value is specified), then the server will impose its own limit.", |
| // "format": "int32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "pageToken": { |
| // "description": "Token returned from a previous call to `ListDatabaseInstances` indicating where in the set of database instances to resume listing.", |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "parent": { |
| // "description": "The parent project for which to list database instances, in the form: `projects/{project-number}/locations/{location-id}` To list across all locations, use a parent in the form: `projects/{project-number}/locations/-`", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "v1beta/{+parent}/instances", |
| // "response": { |
| // "$ref": "ListDatabaseInstancesResponse" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/cloud-platform.read-only", |
| // "https://www.googleapis.com/auth/firebase", |
| // "https://www.googleapis.com/auth/firebase.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *ProjectsLocationsInstancesListCall) Pages(ctx context.Context, f func(*ListDatabaseInstancesResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| // method id "firebasedatabase.projects.locations.instances.reenable": |
| |
| type ProjectsLocationsInstancesReenableCall struct { |
| s *Service |
| name string |
| reenabledatabaseinstancerequest *ReenableDatabaseInstanceRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Reenable: Enables a DatabaseInstance. The database must have been |
| // disabled previously using DisableDatabaseInstance. The state of a |
| // successfully reenabled DatabaseInstance is ACTIVE. |
| func (r *ProjectsLocationsInstancesService) Reenable(name string, reenabledatabaseinstancerequest *ReenableDatabaseInstanceRequest) *ProjectsLocationsInstancesReenableCall { |
| c := &ProjectsLocationsInstancesReenableCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.name = name |
| c.reenabledatabaseinstancerequest = reenabledatabaseinstancerequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *ProjectsLocationsInstancesReenableCall) Fields(s ...googleapi.Field) *ProjectsLocationsInstancesReenableCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *ProjectsLocationsInstancesReenableCall) Context(ctx context.Context) *ProjectsLocationsInstancesReenableCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *ProjectsLocationsInstancesReenableCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *ProjectsLocationsInstancesReenableCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210314") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.reenabledatabaseinstancerequest) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}:reenable") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "name": c.name, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "firebasedatabase.projects.locations.instances.reenable" call. |
| // Exactly one of *DatabaseInstance or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *DatabaseInstance.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *ProjectsLocationsInstancesReenableCall) Do(opts ...googleapi.CallOption) (*DatabaseInstance, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &DatabaseInstance{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Enables a DatabaseInstance. The database must have been disabled previously using DisableDatabaseInstance. The state of a successfully reenabled DatabaseInstance is ACTIVE.", |
| // "flatPath": "v1beta/projects/{projectsId}/locations/{locationsId}/instances/{instancesId}:reenable", |
| // "httpMethod": "POST", |
| // "id": "firebasedatabase.projects.locations.instances.reenable", |
| // "parameterOrder": [ |
| // "name" |
| // ], |
| // "parameters": { |
| // "name": { |
| // "description": "The fully qualified resource name of the database instance, in the form: `projects/{project-number}/locations/{location-id}/instances/{database-id}`", |
| // "location": "path", |
| // "pattern": "^projects/[^/]+/locations/[^/]+/instances/[^/]+$", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "v1beta/{+name}:reenable", |
| // "request": { |
| // "$ref": "ReenableDatabaseInstanceRequest" |
| // }, |
| // "response": { |
| // "$ref": "DatabaseInstance" |
| // }, |
| // "scopes": [ |
| // "https://www.googleapis.com/auth/cloud-platform", |
| // "https://www.googleapis.com/auth/firebase" |
| // ] |
| // } |
| |
| } |