package apiv1
import "cloud.google.com/go/firestore/apiv1/admin"
Package apiv1 is an auto-generated package for the Google Cloud Firestore Admin API.
NOTE: This package is in alpha. It is not stable, and is likely to change.
Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type FieldIterator
- func (it *FieldIterator) Next() (*adminpb.Field, error)
- func (it *FieldIterator) PageInfo() *iterator.PageInfo
- type FirestoreAdminCallOptions
- type FirestoreAdminClient
- func NewFirestoreAdminClient(ctx context.Context, opts ...option.ClientOption) (*FirestoreAdminClient, error)
- func (c *FirestoreAdminClient) Close() error
- func (c *FirestoreAdminClient) Connection() *grpc.ClientConn
- func (c *FirestoreAdminClient) CreateIndex(ctx context.Context, req *adminpb.CreateIndexRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *FirestoreAdminClient) DeleteIndex(ctx context.Context, req *adminpb.DeleteIndexRequest, opts ...gax.CallOption) error
- func (c *FirestoreAdminClient) ExportDocuments(ctx context.Context, req *adminpb.ExportDocumentsRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *FirestoreAdminClient) GetField(ctx context.Context, req *adminpb.GetFieldRequest, opts ...gax.CallOption) (*adminpb.Field, error)
- func (c *FirestoreAdminClient) GetIndex(ctx context.Context, req *adminpb.GetIndexRequest, opts ...gax.CallOption) (*adminpb.Index, error)
- func (c *FirestoreAdminClient) ImportDocuments(ctx context.Context, req *adminpb.ImportDocumentsRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *FirestoreAdminClient) ListFields(ctx context.Context, req *adminpb.ListFieldsRequest, opts ...gax.CallOption) *FieldIterator
- func (c *FirestoreAdminClient) ListIndexes(ctx context.Context, req *adminpb.ListIndexesRequest, opts ...gax.CallOption) *IndexIterator
- func (c *FirestoreAdminClient) SetGoogleClientInfo(keyval ...string)
- func (c *FirestoreAdminClient) UpdateField(ctx context.Context, req *adminpb.UpdateFieldRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- type IndexIterator
Examples ¶
- FirestoreAdminClient.CreateIndex
- FirestoreAdminClient.DeleteIndex
- FirestoreAdminClient.ExportDocuments
- FirestoreAdminClient.GetField
- FirestoreAdminClient.GetIndex
- FirestoreAdminClient.ImportDocuments
- FirestoreAdminClient.ListFields
- FirestoreAdminClient.ListIndexes
- FirestoreAdminClient.UpdateField
- NewFirestoreAdminClient
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type FieldIterator ¶
type FieldIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*adminpb.Field, nextPageToken string, err error) // contains filtered or unexported fields }
FieldIterator manages a stream of *adminpb.Field.
func (*FieldIterator) Next ¶
func (it *FieldIterator) Next() (*adminpb.Field, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*FieldIterator) PageInfo ¶
func (it *FieldIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type FirestoreAdminCallOptions ¶
type FirestoreAdminCallOptions struct { CreateIndex []gax.CallOption ListIndexes []gax.CallOption GetIndex []gax.CallOption DeleteIndex []gax.CallOption ImportDocuments []gax.CallOption ExportDocuments []gax.CallOption GetField []gax.CallOption ListFields []gax.CallOption UpdateField []gax.CallOption }
FirestoreAdminCallOptions contains the retry settings for each method of FirestoreAdminClient.
type FirestoreAdminClient ¶
type FirestoreAdminClient struct { // The call options for this service. CallOptions *FirestoreAdminCallOptions // contains filtered or unexported fields }
FirestoreAdminClient is a client for interacting with Google Cloud Firestore Admin API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewFirestoreAdminClient ¶
func NewFirestoreAdminClient(ctx context.Context, opts ...option.ClientOption) (*FirestoreAdminClient, error)
NewFirestoreAdminClient creates a new firestore admin client.
Operations are created by service FirestoreAdmin, but are accessed via service google.longrunning.Operations.
func (*FirestoreAdminClient) Close ¶
func (c *FirestoreAdminClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*FirestoreAdminClient) Connection ¶
func (c *FirestoreAdminClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*FirestoreAdminClient) CreateIndex ¶
func (c *FirestoreAdminClient) CreateIndex(ctx context.Context, req *adminpb.CreateIndexRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
CreateIndex creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation]
which may be used to track the status of the creation. The metadata for
the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.CreateIndexRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FirestoreAdminClient) DeleteIndex ¶
func (c *FirestoreAdminClient) DeleteIndex(ctx context.Context, req *adminpb.DeleteIndexRequest, opts ...gax.CallOption) error
DeleteIndex deletes a composite index.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.DeleteIndexRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*FirestoreAdminClient) ExportDocuments ¶
func (c *FirestoreAdminClient) ExportDocuments(ctx context.Context, req *adminpb.ExportDocumentsRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
ExportDocuments exports a copy of all or a subset of documents from Google Cloud Firestore
to another storage system, such as Google Cloud Storage. Recent updates to
documents may not be reflected in the export. The export occurs in the
background and its progress can be monitored and managed via the
Operation resource that is created. The output of an export may only be
used once the associated operation is done. If an export operation is
cancelled before completion it may leave partial data behind in Google
Cloud Storage.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.ExportDocumentsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ExportDocuments(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FirestoreAdminClient) GetField ¶
func (c *FirestoreAdminClient) GetField(ctx context.Context, req *adminpb.GetFieldRequest, opts ...gax.CallOption) (*adminpb.Field, error)
GetField gets the metadata and configuration for a Field.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.GetFieldRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetField(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FirestoreAdminClient) GetIndex ¶
func (c *FirestoreAdminClient) GetIndex(ctx context.Context, req *adminpb.GetIndexRequest, opts ...gax.CallOption) (*adminpb.Index, error)
GetIndex gets a composite index.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.GetIndexRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetIndex(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FirestoreAdminClient) ImportDocuments ¶
func (c *FirestoreAdminClient) ImportDocuments(ctx context.Context, req *adminpb.ImportDocumentsRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
ImportDocuments imports documents into Google Cloud Firestore. Existing documents with the
same name are overwritten. The import occurs in the background and its
progress can be monitored and managed via the Operation resource that is
created. If an ImportDocuments operation is cancelled, it is possible
that a subset of the data has already been imported to Cloud Firestore.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.ImportDocumentsRequest{
// TODO: Fill request struct fields.
}
resp, err := c.ImportDocuments(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FirestoreAdminClient) ListFields ¶
func (c *FirestoreAdminClient) ListFields(ctx context.Context, req *adminpb.ListFieldsRequest, opts ...gax.CallOption) *FieldIterator
ListFields lists the field configuration and metadata for this database.
Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields
that have been explicitly overridden. To issue this query, call
[FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to
indexConfig.usesAncestorConfig:false.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
"google.golang.org/api/iterator"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.ListFieldsRequest{
// TODO: Fill request struct fields.
}
it := c.ListFields(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*FirestoreAdminClient) ListIndexes ¶
func (c *FirestoreAdminClient) ListIndexes(ctx context.Context, req *adminpb.ListIndexesRequest, opts ...gax.CallOption) *IndexIterator
ListIndexes lists composite indexes.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
"google.golang.org/api/iterator"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.ListIndexesRequest{
// TODO: Fill request struct fields.
}
it := c.ListIndexes(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*FirestoreAdminClient) SetGoogleClientInfo ¶
func (c *FirestoreAdminClient) SetGoogleClientInfo(keyval ...string)
SetGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.
func (*FirestoreAdminClient) UpdateField ¶
func (c *FirestoreAdminClient) UpdateField(ctx context.Context, req *adminpb.UpdateFieldRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
UpdateField updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: { paths: "index_config" }.
This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to track the status of the field update. The metadata for the operation will be the type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
To configure the default field settings for the database, use
the special Field with resource name:
projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*.
Code:play
Example¶
package main
import (
"context"
apiv1 "cloud.google.com/go/firestore/apiv1/admin"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
)
func main() {
ctx := context.Background()
c, err := apiv1.NewFirestoreAdminClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &adminpb.UpdateFieldRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateField(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type IndexIterator ¶
type IndexIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*adminpb.Index, nextPageToken string, err error) // contains filtered or unexported fields }
IndexIterator manages a stream of *adminpb.Index.
func (*IndexIterator) Next ¶
func (it *IndexIterator) Next() (*adminpb.Index, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*IndexIterator) PageInfo ¶
func (it *IndexIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
Source Files ¶
doc.go firestore_admin_client.go
- Version
- v0.43.0
- Published
- Jul 18, 2019
- Platform
- windows/amd64
- Imports
- 18 packages
- Last checked
- 47 minutes ago –
Tools for package owners.