Documentation ¶
Overview ¶
Package apiv1 is an auto-generated package for the Cloud Firestore API.
Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/firestore/apiv1/admin@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &adminpb.BulkDeleteDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#BulkDeleteDocumentsRequest. } op, err := c.BulkDeleteDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewFirestoreAdminClient 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.
Index ¶
- func DefaultAuthScopes() []string
- type BulkDeleteDocumentsOperation
- func (op *BulkDeleteDocumentsOperation) Done() bool
- func (op *BulkDeleteDocumentsOperation) Metadata() (*adminpb.BulkDeleteDocumentsMetadata, error)
- func (op *BulkDeleteDocumentsOperation) Name() string
- func (op *BulkDeleteDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.BulkDeleteDocumentsResponse, error)
- func (op *BulkDeleteDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.BulkDeleteDocumentsResponse, error)
- type CreateDatabaseOperation
- func (op *CreateDatabaseOperation) Done() bool
- func (op *CreateDatabaseOperation) Metadata() (*adminpb.CreateDatabaseMetadata, error)
- func (op *CreateDatabaseOperation) Name() string
- func (op *CreateDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- func (op *CreateDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- type CreateIndexOperation
- func (op *CreateIndexOperation) Done() bool
- func (op *CreateIndexOperation) Metadata() (*adminpb.IndexOperationMetadata, error)
- func (op *CreateIndexOperation) Name() string
- func (op *CreateIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Index, error)
- func (op *CreateIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Index, error)
- type DeleteDatabaseOperation
- func (op *DeleteDatabaseOperation) Done() bool
- func (op *DeleteDatabaseOperation) Metadata() (*adminpb.DeleteDatabaseMetadata, error)
- func (op *DeleteDatabaseOperation) Name() string
- func (op *DeleteDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- func (op *DeleteDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- type ExportDocumentsOperation
- func (op *ExportDocumentsOperation) Done() bool
- func (op *ExportDocumentsOperation) Metadata() (*adminpb.ExportDocumentsMetadata, error)
- func (op *ExportDocumentsOperation) Name() string
- func (op *ExportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.ExportDocumentsResponse, error)
- func (op *ExportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.ExportDocumentsResponse, error)
- type FieldIterator
- type FirestoreAdminCallOptions
- type FirestoreAdminClient
- func (c *FirestoreAdminClient) BulkDeleteDocuments(ctx context.Context, req *adminpb.BulkDeleteDocumentsRequest, ...) (*BulkDeleteDocumentsOperation, error)
- func (c *FirestoreAdminClient) BulkDeleteDocumentsOperation(name string) *BulkDeleteDocumentsOperation
- func (c *FirestoreAdminClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, ...) error
- func (c *FirestoreAdminClient) Close() error
- func (c *FirestoreAdminClient) Connection() *grpc.ClientConndeprecated
- func (c *FirestoreAdminClient) CreateBackupSchedule(ctx context.Context, req *adminpb.CreateBackupScheduleRequest, ...) (*adminpb.BackupSchedule, error)
- func (c *FirestoreAdminClient) CreateDatabase(ctx context.Context, req *adminpb.CreateDatabaseRequest, ...) (*CreateDatabaseOperation, error)
- func (c *FirestoreAdminClient) CreateDatabaseOperation(name string) *CreateDatabaseOperation
- func (c *FirestoreAdminClient) CreateIndex(ctx context.Context, req *adminpb.CreateIndexRequest, opts ...gax.CallOption) (*CreateIndexOperation, error)
- func (c *FirestoreAdminClient) CreateIndexOperation(name string) *CreateIndexOperation
- func (c *FirestoreAdminClient) DeleteBackup(ctx context.Context, req *adminpb.DeleteBackupRequest, opts ...gax.CallOption) error
- func (c *FirestoreAdminClient) DeleteBackupSchedule(ctx context.Context, req *adminpb.DeleteBackupScheduleRequest, ...) error
- func (c *FirestoreAdminClient) DeleteDatabase(ctx context.Context, req *adminpb.DeleteDatabaseRequest, ...) (*DeleteDatabaseOperation, error)
- func (c *FirestoreAdminClient) DeleteDatabaseOperation(name string) *DeleteDatabaseOperation
- func (c *FirestoreAdminClient) DeleteIndex(ctx context.Context, req *adminpb.DeleteIndexRequest, opts ...gax.CallOption) error
- func (c *FirestoreAdminClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, ...) error
- func (c *FirestoreAdminClient) ExportDocuments(ctx context.Context, req *adminpb.ExportDocumentsRequest, ...) (*ExportDocumentsOperation, error)
- func (c *FirestoreAdminClient) ExportDocumentsOperation(name string) *ExportDocumentsOperation
- func (c *FirestoreAdminClient) GetBackup(ctx context.Context, req *adminpb.GetBackupRequest, opts ...gax.CallOption) (*adminpb.Backup, error)
- func (c *FirestoreAdminClient) GetBackupSchedule(ctx context.Context, req *adminpb.GetBackupScheduleRequest, ...) (*adminpb.BackupSchedule, error)
- func (c *FirestoreAdminClient) GetDatabase(ctx context.Context, req *adminpb.GetDatabaseRequest, opts ...gax.CallOption) (*adminpb.Database, 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) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *FirestoreAdminClient) ImportDocuments(ctx context.Context, req *adminpb.ImportDocumentsRequest, ...) (*ImportDocumentsOperation, error)
- func (c *FirestoreAdminClient) ImportDocumentsOperation(name string) *ImportDocumentsOperation
- func (c *FirestoreAdminClient) ListBackupSchedules(ctx context.Context, req *adminpb.ListBackupSchedulesRequest, ...) (*adminpb.ListBackupSchedulesResponse, error)
- func (c *FirestoreAdminClient) ListBackups(ctx context.Context, req *adminpb.ListBackupsRequest, opts ...gax.CallOption) (*adminpb.ListBackupsResponse, error)
- func (c *FirestoreAdminClient) ListDatabases(ctx context.Context, req *adminpb.ListDatabasesRequest, opts ...gax.CallOption) (*adminpb.ListDatabasesResponse, 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) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *FirestoreAdminClient) RestoreDatabase(ctx context.Context, req *adminpb.RestoreDatabaseRequest, ...) (*RestoreDatabaseOperation, error)
- func (c *FirestoreAdminClient) RestoreDatabaseOperation(name string) *RestoreDatabaseOperation
- func (c *FirestoreAdminClient) SetGoogleClientInfo(keyval ...string)
- func (c *FirestoreAdminClient) UpdateBackupSchedule(ctx context.Context, req *adminpb.UpdateBackupScheduleRequest, ...) (*adminpb.BackupSchedule, error)
- func (c *FirestoreAdminClient) UpdateDatabase(ctx context.Context, req *adminpb.UpdateDatabaseRequest, ...) (*UpdateDatabaseOperation, error)
- func (c *FirestoreAdminClient) UpdateDatabaseOperation(name string) *UpdateDatabaseOperation
- func (c *FirestoreAdminClient) UpdateField(ctx context.Context, req *adminpb.UpdateFieldRequest, opts ...gax.CallOption) (*UpdateFieldOperation, error)
- func (c *FirestoreAdminClient) UpdateFieldOperation(name string) *UpdateFieldOperation
- type ImportDocumentsOperation
- func (op *ImportDocumentsOperation) Done() bool
- func (op *ImportDocumentsOperation) Metadata() (*adminpb.ImportDocumentsMetadata, error)
- func (op *ImportDocumentsOperation) Name() string
- func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type IndexIterator
- type OperationIterator
- type RestoreDatabaseOperation
- func (op *RestoreDatabaseOperation) Done() bool
- func (op *RestoreDatabaseOperation) Metadata() (*adminpb.RestoreDatabaseMetadata, error)
- func (op *RestoreDatabaseOperation) Name() string
- func (op *RestoreDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- func (op *RestoreDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- type UpdateDatabaseOperation
- func (op *UpdateDatabaseOperation) Done() bool
- func (op *UpdateDatabaseOperation) Metadata() (*adminpb.UpdateDatabaseMetadata, error)
- func (op *UpdateDatabaseOperation) Name() string
- func (op *UpdateDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- func (op *UpdateDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
- type UpdateFieldOperation
- func (op *UpdateFieldOperation) Done() bool
- func (op *UpdateFieldOperation) Metadata() (*adminpb.FieldOperationMetadata, error)
- func (op *UpdateFieldOperation) Name() string
- func (op *UpdateFieldOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Field, error)
- func (op *UpdateFieldOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Field, error)
Examples ¶
- FirestoreAdminClient.BulkDeleteDocuments
- FirestoreAdminClient.CancelOperation
- FirestoreAdminClient.CreateBackupSchedule
- FirestoreAdminClient.CreateDatabase
- FirestoreAdminClient.CreateIndex
- FirestoreAdminClient.DeleteBackup
- FirestoreAdminClient.DeleteBackupSchedule
- FirestoreAdminClient.DeleteDatabase
- FirestoreAdminClient.DeleteIndex
- FirestoreAdminClient.DeleteOperation
- FirestoreAdminClient.ExportDocuments
- FirestoreAdminClient.GetBackup
- FirestoreAdminClient.GetBackupSchedule
- FirestoreAdminClient.GetDatabase
- FirestoreAdminClient.GetField
- FirestoreAdminClient.GetIndex
- FirestoreAdminClient.GetOperation
- FirestoreAdminClient.ImportDocuments
- FirestoreAdminClient.ListBackupSchedules
- FirestoreAdminClient.ListBackups
- FirestoreAdminClient.ListDatabases
- FirestoreAdminClient.ListFields
- FirestoreAdminClient.ListFields (All)
- FirestoreAdminClient.ListIndexes
- FirestoreAdminClient.ListIndexes (All)
- FirestoreAdminClient.ListOperations
- FirestoreAdminClient.ListOperations (All)
- FirestoreAdminClient.RestoreDatabase
- FirestoreAdminClient.UpdateBackupSchedule
- FirestoreAdminClient.UpdateDatabase
- FirestoreAdminClient.UpdateField
- NewFirestoreAdminClient
- NewFirestoreAdminRESTClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type BulkDeleteDocumentsOperation ¶ added in v1.16.0
type BulkDeleteDocumentsOperation struct {
// contains filtered or unexported fields
}
BulkDeleteDocumentsOperation manages a long-running operation from BulkDeleteDocuments.
func (*BulkDeleteDocumentsOperation) Done ¶ added in v1.16.0
func (op *BulkDeleteDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BulkDeleteDocumentsOperation) Metadata ¶ added in v1.16.0
func (op *BulkDeleteDocumentsOperation) Metadata() (*adminpb.BulkDeleteDocumentsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BulkDeleteDocumentsOperation) Name ¶ added in v1.16.0
func (op *BulkDeleteDocumentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BulkDeleteDocumentsOperation) Poll ¶ added in v1.16.0
func (op *BulkDeleteDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.BulkDeleteDocumentsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BulkDeleteDocumentsOperation) Wait ¶ added in v1.16.0
func (op *BulkDeleteDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.BulkDeleteDocumentsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type CreateDatabaseOperation ¶ added in v1.15.0
type CreateDatabaseOperation struct {
// contains filtered or unexported fields
}
CreateDatabaseOperation manages a long-running operation from CreateDatabase.
func (*CreateDatabaseOperation) Done ¶ added in v1.15.0
func (op *CreateDatabaseOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateDatabaseOperation) Metadata ¶ added in v1.15.0
func (op *CreateDatabaseOperation) Metadata() (*adminpb.CreateDatabaseMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateDatabaseOperation) Name ¶ added in v1.15.0
func (op *CreateDatabaseOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateDatabaseOperation) Poll ¶ added in v1.15.0
func (op *CreateDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateDatabaseOperation) Wait ¶ added in v1.15.0
func (op *CreateDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type CreateIndexOperation ¶ added in v1.2.0
type CreateIndexOperation struct {
// contains filtered or unexported fields
}
CreateIndexOperation manages a long-running operation from CreateIndex.
func (*CreateIndexOperation) Done ¶ added in v1.2.0
func (op *CreateIndexOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateIndexOperation) Metadata ¶ added in v1.2.0
func (op *CreateIndexOperation) Metadata() (*adminpb.IndexOperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateIndexOperation) Name ¶ added in v1.2.0
func (op *CreateIndexOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateIndexOperation) Poll ¶ added in v1.2.0
func (op *CreateIndexOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Index, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateIndexOperation) Wait ¶ added in v1.2.0
func (op *CreateIndexOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Index, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DeleteDatabaseOperation ¶ added in v1.15.0
type DeleteDatabaseOperation struct {
// contains filtered or unexported fields
}
DeleteDatabaseOperation manages a long-running operation from DeleteDatabase.
func (*DeleteDatabaseOperation) Done ¶ added in v1.15.0
func (op *DeleteDatabaseOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteDatabaseOperation) Metadata ¶ added in v1.15.0
func (op *DeleteDatabaseOperation) Metadata() (*adminpb.DeleteDatabaseMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteDatabaseOperation) Name ¶ added in v1.15.0
func (op *DeleteDatabaseOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteDatabaseOperation) Poll ¶ added in v1.15.0
func (op *DeleteDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteDatabaseOperation) Wait ¶ added in v1.15.0
func (op *DeleteDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ExportDocumentsOperation ¶ added in v1.2.0
type ExportDocumentsOperation struct {
// contains filtered or unexported fields
}
ExportDocumentsOperation manages a long-running operation from ExportDocuments.
func (*ExportDocumentsOperation) Done ¶ added in v1.2.0
func (op *ExportDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportDocumentsOperation) Metadata ¶ added in v1.2.0
func (op *ExportDocumentsOperation) Metadata() (*adminpb.ExportDocumentsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportDocumentsOperation) Name ¶ added in v1.2.0
func (op *ExportDocumentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportDocumentsOperation) Poll ¶ added in v1.2.0
func (op *ExportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.ExportDocumentsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportDocumentsOperation) Wait ¶ added in v1.2.0
func (op *ExportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.ExportDocumentsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type FieldIterator ¶
type FieldIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // 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) All ¶ added in v1.17.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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 GetField []gax.CallOption UpdateField []gax.CallOption ListFields []gax.CallOption ExportDocuments []gax.CallOption ImportDocuments []gax.CallOption BulkDeleteDocuments []gax.CallOption CreateDatabase []gax.CallOption GetDatabase []gax.CallOption ListDatabases []gax.CallOption UpdateDatabase []gax.CallOption DeleteDatabase []gax.CallOption GetBackup []gax.CallOption ListBackups []gax.CallOption DeleteBackup []gax.CallOption RestoreDatabase []gax.CallOption CreateBackupSchedule []gax.CallOption GetBackupSchedule []gax.CallOption ListBackupSchedules []gax.CallOption UpdateBackupSchedule []gax.CallOption DeleteBackupSchedule []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []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 // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }
FirestoreAdminClient is a client for interacting with Cloud Firestore API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
The Cloud Firestore Admin API.
This API provides several administrative services for Cloud Firestore.
Project, Database, Namespace, Collection, Collection Group, and Document are used as defined in the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.
The Operations collection provides a record of actions performed for the specified Project (including any Operations in progress). Operations are not created directly but through calls on other collections or resources.
An Operation that is done may be deleted so that it is no longer listed as part of the Operation collection. Operations are garbage collected after 30 days. By default, ListOperations will only return in progress and failed operations. To list completed operation, issue a ListOperations request with the filter done: true.
Operations are created by service FirestoreAdmin, but are accessed via service google.longrunning.Operations.
func NewFirestoreAdminClient ¶
func NewFirestoreAdminClient(ctx context.Context, opts ...option.ClientOption) (*FirestoreAdminClient, error)
NewFirestoreAdminClient creates a new firestore admin client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
The Cloud Firestore Admin API.
This API provides several administrative services for Cloud Firestore.
Project, Database, Namespace, Collection, Collection Group, and Document are used as defined in the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.
The Operations collection provides a record of actions performed for the specified Project (including any Operations in progress). Operations are not created directly but through calls on other collections or resources.
An Operation that is done may be deleted so that it is no longer listed as part of the Operation collection. Operations are garbage collected after 30 days. By default, ListOperations will only return in progress and failed operations. To list completed operation, issue a ListOperations request with the filter done: true.
Operations are created by service FirestoreAdmin, but are accessed via service google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewFirestoreAdminRESTClient ¶ added in v1.10.0
func NewFirestoreAdminRESTClient(ctx context.Context, opts ...option.ClientOption) (*FirestoreAdminClient, error)
NewFirestoreAdminRESTClient creates a new firestore admin rest client.
The Cloud Firestore Admin API.
This API provides several administrative services for Cloud Firestore.
Project, Database, Namespace, Collection, Collection Group, and Document are used as defined in the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.
The Operations collection provides a record of actions performed for the specified Project (including any Operations in progress). Operations are not created directly but through calls on other collections or resources.
An Operation that is done may be deleted so that it is no longer listed as part of the Operation collection. Operations are garbage collected after 30 days. By default, ListOperations will only return in progress and failed operations. To list completed operation, issue a ListOperations request with the filter done: true.
Operations are created by service FirestoreAdmin, but are accessed via service google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*FirestoreAdminClient) BulkDeleteDocuments ¶ added in v1.16.0
func (c *FirestoreAdminClient) BulkDeleteDocuments(ctx context.Context, req *adminpb.BulkDeleteDocumentsRequest, opts ...gax.CallOption) (*BulkDeleteDocumentsOperation, error)
BulkDeleteDocuments bulk deletes a subset of documents from Google Cloud Firestore. Documents created or updated after the underlying system starts to process the request will not be deleted. The bulk delete occurs in the background and its progress can be monitored and managed via the Operation resource that is created.
For more details on bulk delete behavior, refer to: https://cloud.google.com/firestore/docs/manage-data/bulk-delete (at https://cloud.google.com/firestore/docs/manage-data/bulk-delete)
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.BulkDeleteDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#BulkDeleteDocumentsRequest. } op, err := c.BulkDeleteDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) BulkDeleteDocumentsOperation ¶ added in v1.16.0
func (c *FirestoreAdminClient) BulkDeleteDocumentsOperation(name string) *BulkDeleteDocumentsOperation
BulkDeleteDocumentsOperation returns a new BulkDeleteDocumentsOperation from a given name. The name must be that of a previously created BulkDeleteDocumentsOperation, possibly from a different process.
func (*FirestoreAdminClient) CancelOperation ¶ added in v1.7.0
func (c *FirestoreAdminClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
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
deprecated
func (c *FirestoreAdminClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*FirestoreAdminClient) CreateBackupSchedule ¶ added in v1.16.0
func (c *FirestoreAdminClient) CreateBackupSchedule(ctx context.Context, req *adminpb.CreateBackupScheduleRequest, opts ...gax.CallOption) (*adminpb.BackupSchedule, error)
CreateBackupSchedule creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule and one weekly backup schedule.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.CreateBackupScheduleRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateBackupScheduleRequest. } resp, err := c.CreateBackupSchedule(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) CreateDatabase ¶ added in v1.15.0
func (c *FirestoreAdminClient) CreateDatabase(ctx context.Context, req *adminpb.CreateDatabaseRequest, opts ...gax.CallOption) (*CreateDatabaseOperation, error)
CreateDatabase create a database.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.CreateDatabaseRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateDatabaseRequest. } op, err := c.CreateDatabase(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) CreateDatabaseOperation ¶ added in v1.15.0
func (c *FirestoreAdminClient) CreateDatabaseOperation(name string) *CreateDatabaseOperation
CreateDatabaseOperation returns a new CreateDatabaseOperation from a given name. The name must be that of a previously created CreateDatabaseOperation, possibly from a different process.
func (*FirestoreAdminClient) CreateIndex ¶
func (c *FirestoreAdminClient) CreateIndex(ctx context.Context, req *adminpb.CreateIndexRequest, opts ...gax.CallOption) (*CreateIndexOperation, error)
CreateIndex creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.CreateIndexRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#CreateIndexRequest. } op, err := c.CreateIndex(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) CreateIndexOperation ¶ added in v1.2.0
func (c *FirestoreAdminClient) CreateIndexOperation(name string) *CreateIndexOperation
CreateIndexOperation returns a new CreateIndexOperation from a given name. The name must be that of a previously created CreateIndexOperation, possibly from a different process.
func (*FirestoreAdminClient) DeleteBackup ¶ added in v1.16.0
func (c *FirestoreAdminClient) DeleteBackup(ctx context.Context, req *adminpb.DeleteBackupRequest, opts ...gax.CallOption) error
DeleteBackup deletes a backup.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.DeleteBackupRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteBackupRequest. } err = c.DeleteBackup(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*FirestoreAdminClient) DeleteBackupSchedule ¶ added in v1.16.0
func (c *FirestoreAdminClient) DeleteBackupSchedule(ctx context.Context, req *adminpb.DeleteBackupScheduleRequest, opts ...gax.CallOption) error
DeleteBackupSchedule deletes a backup schedule.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.DeleteBackupScheduleRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteBackupScheduleRequest. } err = c.DeleteBackupSchedule(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*FirestoreAdminClient) DeleteDatabase ¶ added in v1.15.0
func (c *FirestoreAdminClient) DeleteDatabase(ctx context.Context, req *adminpb.DeleteDatabaseRequest, opts ...gax.CallOption) (*DeleteDatabaseOperation, error)
DeleteDatabase deletes a database.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.DeleteDatabaseRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteDatabaseRequest. } op, err := c.DeleteDatabase(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) DeleteDatabaseOperation ¶ added in v1.15.0
func (c *FirestoreAdminClient) DeleteDatabaseOperation(name string) *DeleteDatabaseOperation
DeleteDatabaseOperation returns a new DeleteDatabaseOperation from a given name. The name must be that of a previously created DeleteDatabaseOperation, possibly from a different process.
func (*FirestoreAdminClient) DeleteIndex ¶
func (c *FirestoreAdminClient) DeleteIndex(ctx context.Context, req *adminpb.DeleteIndexRequest, opts ...gax.CallOption) error
DeleteIndex deletes a composite index.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.DeleteIndexRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#DeleteIndexRequest. } err = c.DeleteIndex(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*FirestoreAdminClient) DeleteOperation ¶ added in v1.7.0
func (c *FirestoreAdminClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.DeleteOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. } err = c.DeleteOperation(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*FirestoreAdminClient) ExportDocuments ¶
func (c *FirestoreAdminClient) ExportDocuments(ctx context.Context, req *adminpb.ExportDocumentsRequest, opts ...gax.CallOption) (*ExportDocumentsOperation, 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.
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import (at https://cloud.google.com/firestore/docs/manage-data/export-import)
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ExportDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ExportDocumentsRequest. } op, err := c.ExportDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) ExportDocumentsOperation ¶ added in v1.2.0
func (c *FirestoreAdminClient) ExportDocumentsOperation(name string) *ExportDocumentsOperation
ExportDocumentsOperation returns a new ExportDocumentsOperation from a given name. The name must be that of a previously created ExportDocumentsOperation, possibly from a different process.
func (*FirestoreAdminClient) GetBackup ¶ added in v1.16.0
func (c *FirestoreAdminClient) GetBackup(ctx context.Context, req *adminpb.GetBackupRequest, opts ...gax.CallOption) (*adminpb.Backup, error)
GetBackup gets information about a backup.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.GetBackupRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetBackupRequest. } resp, err := c.GetBackup(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) GetBackupSchedule ¶ added in v1.16.0
func (c *FirestoreAdminClient) GetBackupSchedule(ctx context.Context, req *adminpb.GetBackupScheduleRequest, opts ...gax.CallOption) (*adminpb.BackupSchedule, error)
GetBackupSchedule gets information about a backup schedule.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.GetBackupScheduleRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetBackupScheduleRequest. } resp, err := c.GetBackupSchedule(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) GetDatabase ¶ added in v1.7.0
func (c *FirestoreAdminClient) GetDatabase(ctx context.Context, req *adminpb.GetDatabaseRequest, opts ...gax.CallOption) (*adminpb.Database, error)
GetDatabase gets information about a database.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.GetDatabaseRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetDatabaseRequest. } resp, err := c.GetDatabase(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
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.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.GetFieldRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetFieldRequest. } resp, err := c.GetField(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) GetIndex ¶
func (c *FirestoreAdminClient) GetIndex(ctx context.Context, req *adminpb.GetIndexRequest, opts ...gax.CallOption) (*adminpb.Index, error)
GetIndex gets a composite index.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.GetIndexRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#GetIndexRequest. } resp, err := c.GetIndex(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) GetOperation ¶ added in v1.7.0
func (c *FirestoreAdminClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) ImportDocuments ¶
func (c *FirestoreAdminClient) ImportDocuments(ctx context.Context, req *adminpb.ImportDocumentsRequest, opts ...gax.CallOption) (*ImportDocumentsOperation, 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.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ImportDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ImportDocumentsRequest. } op, err := c.ImportDocuments(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*FirestoreAdminClient) ImportDocumentsOperation ¶ added in v1.2.0
func (c *FirestoreAdminClient) ImportDocumentsOperation(name string) *ImportDocumentsOperation
ImportDocumentsOperation returns a new ImportDocumentsOperation from a given name. The name must be that of a previously created ImportDocumentsOperation, possibly from a different process.
func (*FirestoreAdminClient) ListBackupSchedules ¶ added in v1.16.0
func (c *FirestoreAdminClient) ListBackupSchedules(ctx context.Context, req *adminpb.ListBackupSchedulesRequest, opts ...gax.CallOption) (*adminpb.ListBackupSchedulesResponse, error)
ListBackupSchedules list backup schedules.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListBackupSchedulesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListBackupSchedulesRequest. } resp, err := c.ListBackupSchedules(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) ListBackups ¶ added in v1.16.0
func (c *FirestoreAdminClient) ListBackups(ctx context.Context, req *adminpb.ListBackupsRequest, opts ...gax.CallOption) (*adminpb.ListBackupsResponse, error)
ListBackups lists all the backups.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListBackupsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListBackupsRequest. } resp, err := c.ListBackups(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) ListDatabases ¶ added in v1.7.0
func (c *FirestoreAdminClient) ListDatabases(ctx context.Context, req *adminpb.ListDatabasesRequest, opts ...gax.CallOption) (*adminpb.ListDatabasesResponse, error)
ListDatabases list all the databases in the project.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListDatabasesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListDatabasesRequest. } resp, err := c.ListDatabases(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
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 only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to indexConfig.usesAncestorConfig:false or ttlConfig:*.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" "google.golang.org/api/iterator" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListFieldsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListFieldsRequest. } 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 // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*adminpb.ListFieldsResponse) } }
Output:
Example (All) ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListFieldsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListFieldsRequest. } for resp, err := range c.ListFields(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*FirestoreAdminClient) ListIndexes ¶
func (c *FirestoreAdminClient) ListIndexes(ctx context.Context, req *adminpb.ListIndexesRequest, opts ...gax.CallOption) *IndexIterator
ListIndexes lists composite indexes.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" "google.golang.org/api/iterator" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListIndexesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListIndexesRequest. } 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 // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*adminpb.ListIndexesResponse) } }
Output:
Example (All) ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.ListIndexesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#ListIndexesRequest. } for resp, err := range c.ListIndexes(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*FirestoreAdminClient) ListOperations ¶ added in v1.7.0
func (c *FirestoreAdminClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "google.golang.org/api/iterator" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } }
Output:
Example (All) ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } }
Output:
func (*FirestoreAdminClient) RestoreDatabase ¶ added in v1.16.0
func (c *FirestoreAdminClient) RestoreDatabase(ctx context.Context, req *adminpb.RestoreDatabaseRequest, opts ...gax.CallOption) (*RestoreDatabaseOperation, error)
RestoreDatabase creates a new database by restoring from an existing backup.
The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup.
The [long-running operation][google.longrunning.Operation] can be used to track the progress of the restore, with the Operation’s metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.RestoreDatabaseRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#RestoreDatabaseRequest. } op, err := c.RestoreDatabase(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) RestoreDatabaseOperation ¶ added in v1.16.0
func (c *FirestoreAdminClient) RestoreDatabaseOperation(name string) *RestoreDatabaseOperation
RestoreDatabaseOperation returns a new RestoreDatabaseOperation from a given name. The name must be that of a previously created RestoreDatabaseOperation, possibly from a different process.
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. Also passes any provided key-value pairs. Intended for use by Google-written clients.
Internal use only.
func (*FirestoreAdminClient) UpdateBackupSchedule ¶ added in v1.16.0
func (c *FirestoreAdminClient) UpdateBackupSchedule(ctx context.Context, req *adminpb.UpdateBackupScheduleRequest, opts ...gax.CallOption) (*adminpb.BackupSchedule, error)
UpdateBackupSchedule updates a backup schedule.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.UpdateBackupScheduleRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateBackupScheduleRequest. } resp, err := c.UpdateBackupSchedule(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) UpdateDatabase ¶ added in v1.7.0
func (c *FirestoreAdminClient) UpdateDatabase(ctx context.Context, req *adminpb.UpdateDatabaseRequest, opts ...gax.CallOption) (*UpdateDatabaseOperation, error)
UpdateDatabase updates a database.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.UpdateDatabaseRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateDatabaseRequest. } op, err := c.UpdateDatabase(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) UpdateDatabaseOperation ¶ added in v1.7.0
func (c *FirestoreAdminClient) UpdateDatabaseOperation(name string) *UpdateDatabaseOperation
UpdateDatabaseOperation returns a new UpdateDatabaseOperation from a given name. The name must be that of a previously created UpdateDatabaseOperation, possibly from a different process.
func (*FirestoreAdminClient) UpdateField ¶
func (c *FirestoreAdminClient) UpdateField(ctx context.Context, req *adminpb.UpdateFieldRequest, opts ...gax.CallOption) (*UpdateFieldOperation, error)
UpdateField updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to 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 which may be used to track the status of the field update. The metadata for the operation will be the type 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/*.
Example ¶
package main import ( "context" apiv1 "cloud.google.com/go/firestore/apiv1/admin" adminpb "cloud.google.com/go/firestore/apiv1/admin/adminpb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := apiv1.NewFirestoreAdminClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &adminpb.UpdateFieldRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin/adminpb#UpdateFieldRequest. } op, err := c.UpdateField(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*FirestoreAdminClient) UpdateFieldOperation ¶ added in v1.2.0
func (c *FirestoreAdminClient) UpdateFieldOperation(name string) *UpdateFieldOperation
UpdateFieldOperation returns a new UpdateFieldOperation from a given name. The name must be that of a previously created UpdateFieldOperation, possibly from a different process.
type ImportDocumentsOperation ¶ added in v1.2.0
type ImportDocumentsOperation struct {
// contains filtered or unexported fields
}
ImportDocumentsOperation manages a long-running operation from ImportDocuments.
func (*ImportDocumentsOperation) Done ¶ added in v1.2.0
func (op *ImportDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDocumentsOperation) Metadata ¶ added in v1.2.0
func (op *ImportDocumentsOperation) Metadata() (*adminpb.ImportDocumentsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportDocumentsOperation) Name ¶ added in v1.2.0
func (op *ImportDocumentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportDocumentsOperation) Poll ¶ added in v1.2.0
func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportDocumentsOperation) Wait ¶ added in v1.2.0
func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type IndexIterator ¶
type IndexIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // 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) All ¶ added in v1.17.0
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
type OperationIterator ¶ added in v1.7.0
type OperationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // 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 []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All ¶ added in v1.17.0
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶ added in v1.7.0
func (it *OperationIterator) Next() (*longrunningpb.Operation, 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 (*OperationIterator) PageInfo ¶ added in v1.7.0
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type RestoreDatabaseOperation ¶ added in v1.16.0
type RestoreDatabaseOperation struct {
// contains filtered or unexported fields
}
RestoreDatabaseOperation manages a long-running operation from RestoreDatabase.
func (*RestoreDatabaseOperation) Done ¶ added in v1.16.0
func (op *RestoreDatabaseOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RestoreDatabaseOperation) Metadata ¶ added in v1.16.0
func (op *RestoreDatabaseOperation) Metadata() (*adminpb.RestoreDatabaseMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*RestoreDatabaseOperation) Name ¶ added in v1.16.0
func (op *RestoreDatabaseOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*RestoreDatabaseOperation) Poll ¶ added in v1.16.0
func (op *RestoreDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*RestoreDatabaseOperation) Wait ¶ added in v1.16.0
func (op *RestoreDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type UpdateDatabaseOperation ¶ added in v1.7.0
type UpdateDatabaseOperation struct {
// contains filtered or unexported fields
}
UpdateDatabaseOperation manages a long-running operation from UpdateDatabase.
func (*UpdateDatabaseOperation) Done ¶ added in v1.7.0
func (op *UpdateDatabaseOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateDatabaseOperation) Metadata ¶ added in v1.7.0
func (op *UpdateDatabaseOperation) Metadata() (*adminpb.UpdateDatabaseMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateDatabaseOperation) Name ¶ added in v1.7.0
func (op *UpdateDatabaseOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateDatabaseOperation) Poll ¶ added in v1.7.0
func (op *UpdateDatabaseOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateDatabaseOperation) Wait ¶ added in v1.7.0
func (op *UpdateDatabaseOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Database, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type UpdateFieldOperation ¶ added in v1.2.0
type UpdateFieldOperation struct {
// contains filtered or unexported fields
}
UpdateFieldOperation manages a long-running operation from UpdateField.
func (*UpdateFieldOperation) Done ¶ added in v1.2.0
func (op *UpdateFieldOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateFieldOperation) Metadata ¶ added in v1.2.0
func (op *UpdateFieldOperation) Metadata() (*adminpb.FieldOperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateFieldOperation) Name ¶ added in v1.2.0
func (op *UpdateFieldOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateFieldOperation) Poll ¶ added in v1.2.0
func (op *UpdateFieldOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*adminpb.Field, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateFieldOperation) Wait ¶ added in v1.2.0
func (op *UpdateFieldOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*adminpb.Field, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.