Documentation
¶
Overview ¶
Package sql is an auto-generated package for the Cloud SQL Admin API.
Cloud SQL Admin API
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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/sql/apiv1beta4@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 := sql.NewSqlBackupRunsClient(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 := &sqlpb.SqlBackupRunsDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
Use of Context ¶
The ctx passed to NewSqlBackupRunsClient 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 ApiWarningIterator
- type BackupIterator
- type BackupRunIterator
- type OperationIterator
- type SqlBackupRunsCallOptions
- type SqlBackupRunsClient
- func (c *SqlBackupRunsClient) Close() error
- func (c *SqlBackupRunsClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlBackupRunsClient) Delete(ctx context.Context, req *sqlpb.SqlBackupRunsDeleteRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlBackupRunsClient) Get(ctx context.Context, req *sqlpb.SqlBackupRunsGetRequest, ...) (*sqlpb.BackupRun, error)
- func (c *SqlBackupRunsClient) Insert(ctx context.Context, req *sqlpb.SqlBackupRunsInsertRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlBackupRunsClient) List(ctx context.Context, req *sqlpb.SqlBackupRunsListRequest, ...) *BackupRunIterator
- type SqlBackupsCallOptions
- type SqlBackupsClient
- func (c *SqlBackupsClient) Close() error
- func (c *SqlBackupsClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlBackupsClient) CreateBackup(ctx context.Context, req *sqlpb.CreateBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
- func (c *SqlBackupsClient) DeleteBackup(ctx context.Context, req *sqlpb.DeleteBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
- func (c *SqlBackupsClient) GetBackup(ctx context.Context, req *sqlpb.GetBackupRequest, opts ...gax.CallOption) (*sqlpb.Backup, error)
- func (c *SqlBackupsClient) ListBackups(ctx context.Context, req *sqlpb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator
- func (c *SqlBackupsClient) UpdateBackup(ctx context.Context, req *sqlpb.UpdateBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
- type SqlConnectCallOptions
- type SqlConnectClient
- func (c *SqlConnectClient) Close() error
- func (c *SqlConnectClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlConnectClient) GenerateEphemeralCert(ctx context.Context, req *sqlpb.GenerateEphemeralCertRequest, ...) (*sqlpb.GenerateEphemeralCertResponse, error)
- func (c *SqlConnectClient) GetConnectSettings(ctx context.Context, req *sqlpb.GetConnectSettingsRequest, ...) (*sqlpb.ConnectSettings, error)
- func (c *SqlConnectClient) ResolveConnectSettings(ctx context.Context, req *sqlpb.ResolveConnectSettingsRequest, ...) (*sqlpb.ConnectSettings, error)
- type SqlDataCallOptions
- type SqlDataClient
- type SqlDatabasesCallOptions
- type SqlDatabasesClient
- func (c *SqlDatabasesClient) Close() error
- func (c *SqlDatabasesClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlDatabasesClient) Delete(ctx context.Context, req *sqlpb.SqlDatabasesDeleteRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlDatabasesClient) Get(ctx context.Context, req *sqlpb.SqlDatabasesGetRequest, opts ...gax.CallOption) (*sqlpb.Database, error)
- func (c *SqlDatabasesClient) Insert(ctx context.Context, req *sqlpb.SqlDatabasesInsertRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlDatabasesClient) List(ctx context.Context, req *sqlpb.SqlDatabasesListRequest, ...) (*sqlpb.DatabasesListResponse, error)
- func (c *SqlDatabasesClient) Patch(ctx context.Context, req *sqlpb.SqlDatabasesUpdateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlDatabasesClient) Update(ctx context.Context, req *sqlpb.SqlDatabasesUpdateRequest, ...) (*sqlpb.Operation, error)
- type SqlFlagsCallOptions
- type SqlFlagsClient
- type SqlInstancesCallOptions
- type SqlInstancesClient
- func (c *SqlInstancesClient) AcquireSsrsLease(ctx context.Context, req *sqlpb.SqlInstancesAcquireSsrsLeaseRequest, ...) (*sqlpb.SqlInstancesAcquireSsrsLeaseResponse, error)
- func (c *SqlInstancesClient) AddEntraIdCertificate(ctx context.Context, req *sqlpb.SqlInstancesAddEntraIdCertificateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) AddServerCa(ctx context.Context, req *sqlpb.SqlInstancesAddServerCaRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) AddServerCertificate(ctx context.Context, req *sqlpb.SqlInstancesAddServerCertificateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Clone(ctx context.Context, req *sqlpb.SqlInstancesCloneRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Close() error
- func (c *SqlInstancesClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlInstancesClient) CreateEphemeral(ctx context.Context, req *sqlpb.SqlInstancesCreateEphemeralCertRequest, ...) (*sqlpb.SslCert, error)
- func (c *SqlInstancesClient) Delete(ctx context.Context, req *sqlpb.SqlInstancesDeleteRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Demote(ctx context.Context, req *sqlpb.SqlInstancesDemoteRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) DemoteMaster(ctx context.Context, req *sqlpb.SqlInstancesDemoteMasterRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) ExecuteSql(ctx context.Context, req *sqlpb.SqlInstancesExecuteSqlRequest, ...) (*sqlpb.SqlInstancesExecuteSqlResponse, error)
- func (c *SqlInstancesClient) Export(ctx context.Context, req *sqlpb.SqlInstancesExportRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Failover(ctx context.Context, req *sqlpb.SqlInstancesFailoverRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Get(ctx context.Context, req *sqlpb.SqlInstancesGetRequest, opts ...gax.CallOption) (*sqlpb.DatabaseInstance, error)
- func (c *SqlInstancesClient) GetDiskShrinkConfig(ctx context.Context, req *sqlpb.SqlInstancesGetDiskShrinkConfigRequest, ...) (*sqlpb.SqlInstancesGetDiskShrinkConfigResponse, error)
- func (c *SqlInstancesClient) GetLatestRecoveryTime(ctx context.Context, req *sqlpb.SqlInstancesGetLatestRecoveryTimeRequest, ...) (*sqlpb.SqlInstancesGetLatestRecoveryTimeResponse, error)
- func (c *SqlInstancesClient) Import(ctx context.Context, req *sqlpb.SqlInstancesImportRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Insert(ctx context.Context, req *sqlpb.SqlInstancesInsertRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) List(ctx context.Context, req *sqlpb.SqlInstancesListRequest, ...) *ApiWarningIterator
- func (c *SqlInstancesClient) ListEntraIdCertificates(ctx context.Context, req *sqlpb.SqlInstancesListEntraIdCertificatesRequest, ...) (*sqlpb.InstancesListEntraIdCertificatesResponse, error)
- func (c *SqlInstancesClient) ListServerCas(ctx context.Context, req *sqlpb.SqlInstancesListServerCasRequest, ...) (*sqlpb.InstancesListServerCasResponse, error)
- func (c *SqlInstancesClient) ListServerCertificates(ctx context.Context, req *sqlpb.SqlInstancesListServerCertificatesRequest, ...) (*sqlpb.InstancesListServerCertificatesResponse, error)
- func (c *SqlInstancesClient) Patch(ctx context.Context, req *sqlpb.SqlInstancesPatchRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) PerformDiskShrink(ctx context.Context, req *sqlpb.SqlInstancesPerformDiskShrinkRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) PointInTimeRestore(ctx context.Context, req *sqlpb.SqlInstancesPointInTimeRestoreRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) PreCheckMajorVersionUpgrade(ctx context.Context, req *sqlpb.SqlInstancesPreCheckMajorVersionUpgradeRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) PromoteReplica(ctx context.Context, req *sqlpb.SqlInstancesPromoteReplicaRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Reencrypt(ctx context.Context, req *sqlpb.SqlInstancesReencryptRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) ReleaseSsrsLease(ctx context.Context, req *sqlpb.SqlInstancesReleaseSsrsLeaseRequest, ...) (*sqlpb.SqlInstancesReleaseSsrsLeaseResponse, error)
- func (c *SqlInstancesClient) RescheduleMaintenance(ctx context.Context, req *sqlpb.SqlInstancesRescheduleMaintenanceRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) ResetReplicaSize(ctx context.Context, req *sqlpb.SqlInstancesResetReplicaSizeRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) ResetSslConfig(ctx context.Context, req *sqlpb.SqlInstancesResetSslConfigRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Restart(ctx context.Context, req *sqlpb.SqlInstancesRestartRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) RestoreBackup(ctx context.Context, req *sqlpb.SqlInstancesRestoreBackupRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) RotateEntraIdCertificate(ctx context.Context, req *sqlpb.SqlInstancesRotateEntraIdCertificateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) RotateServerCa(ctx context.Context, req *sqlpb.SqlInstancesRotateServerCaRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) RotateServerCertificate(ctx context.Context, req *sqlpb.SqlInstancesRotateServerCertificateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) StartExternalSync(ctx context.Context, req *sqlpb.SqlInstancesStartExternalSyncRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) StartReplica(ctx context.Context, req *sqlpb.SqlInstancesStartReplicaRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) StopReplica(ctx context.Context, req *sqlpb.SqlInstancesStopReplicaRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Switchover(ctx context.Context, req *sqlpb.SqlInstancesSwitchoverRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) TruncateLog(ctx context.Context, req *sqlpb.SqlInstancesTruncateLogRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) Update(ctx context.Context, req *sqlpb.SqlInstancesUpdateRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlInstancesClient) VerifyExternalSyncSettings(ctx context.Context, req *sqlpb.SqlInstancesVerifyExternalSyncSettingsRequest, ...) (*sqlpb.SqlInstancesVerifyExternalSyncSettingsResponse, error)
- type SqlOperationsCallOptions
- type SqlOperationsClient
- func (c *SqlOperationsClient) Cancel(ctx context.Context, req *sqlpb.SqlOperationsCancelRequest, ...) error
- func (c *SqlOperationsClient) Close() error
- func (c *SqlOperationsClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlOperationsClient) Get(ctx context.Context, req *sqlpb.SqlOperationsGetRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlOperationsClient) List(ctx context.Context, req *sqlpb.SqlOperationsListRequest, ...) *OperationIterator
- type SqlSslCertsCallOptions
- type SqlSslCertsClient
- func (c *SqlSslCertsClient) Close() error
- func (c *SqlSslCertsClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlSslCertsClient) Delete(ctx context.Context, req *sqlpb.SqlSslCertsDeleteRequest, ...) (*sqlpb.Operation, error)
- func (c *SqlSslCertsClient) Get(ctx context.Context, req *sqlpb.SqlSslCertsGetRequest, opts ...gax.CallOption) (*sqlpb.SslCert, error)
- func (c *SqlSslCertsClient) Insert(ctx context.Context, req *sqlpb.SqlSslCertsInsertRequest, ...) (*sqlpb.SslCertsInsertResponse, error)
- func (c *SqlSslCertsClient) List(ctx context.Context, req *sqlpb.SqlSslCertsListRequest, opts ...gax.CallOption) (*sqlpb.SslCertsListResponse, error)
- type SqlTiersCallOptions
- type SqlTiersClient
- type SqlUsersCallOptions
- type SqlUsersClient
- func (c *SqlUsersClient) Close() error
- func (c *SqlUsersClient) Connection() *grpc.ClientConndeprecated
- func (c *SqlUsersClient) Delete(ctx context.Context, req *sqlpb.SqlUsersDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
- func (c *SqlUsersClient) Get(ctx context.Context, req *sqlpb.SqlUsersGetRequest, opts ...gax.CallOption) (*sqlpb.User, error)
- func (c *SqlUsersClient) Insert(ctx context.Context, req *sqlpb.SqlUsersInsertRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
- func (c *SqlUsersClient) List(ctx context.Context, req *sqlpb.SqlUsersListRequest, opts ...gax.CallOption) (*sqlpb.UsersListResponse, error)
- func (c *SqlUsersClient) Update(ctx context.Context, req *sqlpb.SqlUsersUpdateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Examples ¶
- NewSqlBackupRunsClient
- NewSqlBackupRunsRESTClient
- NewSqlBackupsClient
- NewSqlBackupsRESTClient
- NewSqlConnectClient
- NewSqlConnectRESTClient
- NewSqlDataClient
- NewSqlDatabasesClient
- NewSqlDatabasesRESTClient
- NewSqlFlagsClient
- NewSqlFlagsRESTClient
- NewSqlInstancesClient
- NewSqlInstancesRESTClient
- NewSqlOperationsClient
- NewSqlOperationsRESTClient
- NewSqlSslCertsClient
- NewSqlSslCertsRESTClient
- NewSqlTiersClient
- NewSqlTiersRESTClient
- NewSqlUsersClient
- NewSqlUsersRESTClient
- SqlBackupRunsClient.Delete
- SqlBackupRunsClient.Get
- SqlBackupRunsClient.Insert
- SqlBackupRunsClient.List
- SqlBackupRunsClient.List (All)
- SqlBackupsClient.CreateBackup
- SqlBackupsClient.DeleteBackup
- SqlBackupsClient.GetBackup
- SqlBackupsClient.ListBackups
- SqlBackupsClient.ListBackups (All)
- SqlBackupsClient.UpdateBackup
- SqlConnectClient.GenerateEphemeralCert
- SqlConnectClient.GetConnectSettings
- SqlConnectClient.ResolveConnectSettings
- SqlDataClient.StreamSqlData
- SqlDatabasesClient.Delete
- SqlDatabasesClient.Get
- SqlDatabasesClient.Insert
- SqlDatabasesClient.List
- SqlDatabasesClient.Patch
- SqlDatabasesClient.Update
- SqlFlagsClient.List
- SqlInstancesClient.AcquireSsrsLease
- SqlInstancesClient.AddEntraIdCertificate
- SqlInstancesClient.AddServerCa
- SqlInstancesClient.AddServerCertificate
- SqlInstancesClient.Clone
- SqlInstancesClient.CreateEphemeral
- SqlInstancesClient.Delete
- SqlInstancesClient.Demote
- SqlInstancesClient.DemoteMaster
- SqlInstancesClient.ExecuteSql
- SqlInstancesClient.Export
- SqlInstancesClient.Failover
- SqlInstancesClient.Get
- SqlInstancesClient.GetDiskShrinkConfig
- SqlInstancesClient.GetLatestRecoveryTime
- SqlInstancesClient.Import
- SqlInstancesClient.Insert
- SqlInstancesClient.List
- SqlInstancesClient.List (All)
- SqlInstancesClient.ListEntraIdCertificates
- SqlInstancesClient.ListServerCas
- SqlInstancesClient.ListServerCertificates
- SqlInstancesClient.Patch
- SqlInstancesClient.PerformDiskShrink
- SqlInstancesClient.PointInTimeRestore
- SqlInstancesClient.PreCheckMajorVersionUpgrade
- SqlInstancesClient.PromoteReplica
- SqlInstancesClient.Reencrypt
- SqlInstancesClient.ReleaseSsrsLease
- SqlInstancesClient.RescheduleMaintenance
- SqlInstancesClient.ResetReplicaSize
- SqlInstancesClient.ResetSslConfig
- SqlInstancesClient.Restart
- SqlInstancesClient.RestoreBackup
- SqlInstancesClient.RotateEntraIdCertificate
- SqlInstancesClient.RotateServerCa
- SqlInstancesClient.RotateServerCertificate
- SqlInstancesClient.StartExternalSync
- SqlInstancesClient.StartReplica
- SqlInstancesClient.StopReplica
- SqlInstancesClient.Switchover
- SqlInstancesClient.TruncateLog
- SqlInstancesClient.Update
- SqlInstancesClient.VerifyExternalSyncSettings
- SqlOperationsClient.Cancel
- SqlOperationsClient.Get
- SqlOperationsClient.List
- SqlOperationsClient.List (All)
- SqlSslCertsClient.Delete
- SqlSslCertsClient.Get
- SqlSslCertsClient.Insert
- SqlSslCertsClient.List
- SqlTiersClient.List
- SqlUsersClient.Delete
- SqlUsersClient.Get
- SqlUsersClient.Insert
- SqlUsersClient.List
- SqlUsersClient.Update
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 ApiWarningIterator ¶
type ApiWarningIterator 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 []*sqlpb.ApiWarning, nextPageToken string, err error)
// contains filtered or unexported fields
}
ApiWarningIterator manages a stream of *sqlpb.ApiWarning.
func (*ApiWarningIterator) All ¶
func (it *ApiWarningIterator) All() iter.Seq2[*sqlpb.ApiWarning, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ApiWarningIterator) Next ¶
func (it *ApiWarningIterator) Next() (*sqlpb.ApiWarning, 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 (*ApiWarningIterator) PageInfo ¶
func (it *ApiWarningIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type BackupIterator ¶
type BackupIterator 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 []*sqlpb.Backup, nextPageToken string, err error)
// contains filtered or unexported fields
}
BackupIterator manages a stream of *sqlpb.Backup.
func (*BackupIterator) All ¶
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*BackupIterator) Next ¶
func (it *BackupIterator) Next() (*sqlpb.Backup, 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 (*BackupIterator) PageInfo ¶
func (it *BackupIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type BackupRunIterator ¶
type BackupRunIterator 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 []*sqlpb.BackupRun, nextPageToken string, err error)
// contains filtered or unexported fields
}
BackupRunIterator manages a stream of *sqlpb.BackupRun.
func (*BackupRunIterator) All ¶
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*BackupRunIterator) Next ¶
func (it *BackupRunIterator) Next() (*sqlpb.BackupRun, 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 (*BackupRunIterator) PageInfo ¶
func (it *BackupRunIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OperationIterator ¶
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 []*sqlpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}
OperationIterator manages a stream of *sqlpb.Operation.
func (*OperationIterator) All ¶
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() (*sqlpb.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 ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SqlBackupRunsCallOptions ¶
type SqlBackupRunsCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
}
SqlBackupRunsCallOptions contains the retry settings for each method of SqlBackupRunsClient.
type SqlBackupRunsClient ¶
type SqlBackupRunsClient struct {
// The call options for this service.
CallOptions *SqlBackupRunsCallOptions
// contains filtered or unexported fields
}
SqlBackupRunsClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlBackupRunsClient ¶
func NewSqlBackupRunsClient(ctx context.Context, opts ...option.ClientOption) (*SqlBackupRunsClient, error)
NewSqlBackupRunsClient creates a new sql backup runs service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlBackupRunsRESTClient ¶
func NewSqlBackupRunsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlBackupRunsClient, error)
NewSqlBackupRunsRESTClient creates a new sql backup runs service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlBackupRunsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlBackupRunsClient) Close ¶
func (c *SqlBackupRunsClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlBackupRunsClient) Connection
deprecated
func (c *SqlBackupRunsClient) 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 (*SqlBackupRunsClient) Delete ¶
func (c *SqlBackupRunsClient) Delete(ctx context.Context, req *sqlpb.SqlBackupRunsDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Delete deletes the backup taken by a backup run.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlBackupRunsDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupRunsClient) Get ¶
func (c *SqlBackupRunsClient) Get(ctx context.Context, req *sqlpb.SqlBackupRunsGetRequest, opts ...gax.CallOption) (*sqlpb.BackupRun, error)
Get retrieves a resource containing information about a backup run.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlBackupRunsGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupRunsClient) Insert ¶
func (c *SqlBackupRunsClient) Insert(ctx context.Context, req *sqlpb.SqlBackupRunsInsertRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Insert creates a new backup run on demand.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlBackupRunsInsertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsInsertRequest.
}
resp, err := c.Insert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupRunsClient) List ¶
func (c *SqlBackupRunsClient) List(ctx context.Context, req *sqlpb.SqlBackupRunsListRequest, opts ...gax.CallOption) *BackupRunIterator
List lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
"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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlBackupRunsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsListRequest.
}
it := c.List(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.(*sqlpb.BackupRunsListResponse)
}
}
Output:
Example (All) ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupRunsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlBackupRunsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlBackupRunsListRequest.
}
for resp, err := range c.List(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
Output:
type SqlBackupsCallOptions ¶
type SqlBackupsCallOptions struct {
CreateBackup []gax.CallOption
GetBackup []gax.CallOption
ListBackups []gax.CallOption
UpdateBackup []gax.CallOption
DeleteBackup []gax.CallOption
}
SqlBackupsCallOptions contains the retry settings for each method of SqlBackupsClient.
type SqlBackupsClient ¶
type SqlBackupsClient struct {
// The call options for this service.
CallOptions *SqlBackupsCallOptions
// contains filtered or unexported fields
}
SqlBackupsClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlBackupsClient ¶
func NewSqlBackupsClient(ctx context.Context, opts ...option.ClientOption) (*SqlBackupsClient, error)
NewSqlBackupsClient creates a new sql backups service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlBackupsRESTClient ¶
func NewSqlBackupsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlBackupsClient, error)
NewSqlBackupsRESTClient creates a new sql backups service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlBackupsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlBackupsClient) Close ¶
func (c *SqlBackupsClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlBackupsClient) Connection
deprecated
func (c *SqlBackupsClient) 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 (*SqlBackupsClient) CreateBackup ¶
func (c *SqlBackupsClient) CreateBackup(ctx context.Context, req *sqlpb.CreateBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
CreateBackup creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.CreateBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#CreateBackupRequest.
}
resp, err := c.CreateBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupsClient) DeleteBackup ¶
func (c *SqlBackupsClient) DeleteBackup(ctx context.Context, req *sqlpb.DeleteBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
DeleteBackup deletes the backup.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.DeleteBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#DeleteBackupRequest.
}
resp, err := c.DeleteBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupsClient) GetBackup ¶
func (c *SqlBackupsClient) GetBackup(ctx context.Context, req *sqlpb.GetBackupRequest, opts ...gax.CallOption) (*sqlpb.Backup, error)
GetBackup retrieves a resource containing information about a backup.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.GetBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#GetBackupRequest.
}
resp, err := c.GetBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlBackupsClient) ListBackups ¶
func (c *SqlBackupsClient) ListBackups(ctx context.Context, req *sqlpb.ListBackupsRequest, opts ...gax.CallOption) *BackupIterator
ListBackups lists all backups associated with the project.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
"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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.ListBackupsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#ListBackupsRequest.
}
it := c.ListBackups(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.(*sqlpb.ListBackupsResponse)
}
}
Output:
Example (All) ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.ListBackupsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#ListBackupsRequest.
}
for resp, err := range c.ListBackups(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 (*SqlBackupsClient) UpdateBackup ¶
func (c *SqlBackupsClient) UpdateBackup(ctx context.Context, req *sqlpb.UpdateBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
UpdateBackup updates the retention period and the description of the backup. You can use this API to update final backups only.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlBackupsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.UpdateBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#UpdateBackupRequest.
}
resp, err := c.UpdateBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlConnectCallOptions ¶
type SqlConnectCallOptions struct {
GetConnectSettings []gax.CallOption
ResolveConnectSettings []gax.CallOption
GenerateEphemeralCert []gax.CallOption
}
SqlConnectCallOptions contains the retry settings for each method of SqlConnectClient.
type SqlConnectClient ¶
type SqlConnectClient struct {
// The call options for this service.
CallOptions *SqlConnectCallOptions
// contains filtered or unexported fields
}
SqlConnectClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Cloud SQL connect service.
func NewSqlConnectClient ¶
func NewSqlConnectClient(ctx context.Context, opts ...option.ClientOption) (*SqlConnectClient, error)
NewSqlConnectClient creates a new sql connect service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Cloud SQL connect service.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlConnectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlConnectRESTClient ¶
func NewSqlConnectRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlConnectClient, error)
NewSqlConnectRESTClient creates a new sql connect service rest client.
Cloud SQL connect service.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlConnectRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlConnectClient) Close ¶
func (c *SqlConnectClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlConnectClient) Connection
deprecated
func (c *SqlConnectClient) 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 (*SqlConnectClient) GenerateEphemeralCert ¶
func (c *SqlConnectClient) GenerateEphemeralCert(ctx context.Context, req *sqlpb.GenerateEphemeralCertRequest, opts ...gax.CallOption) (*sqlpb.GenerateEphemeralCertResponse, error)
GenerateEphemeralCert generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlConnectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.GenerateEphemeralCertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#GenerateEphemeralCertRequest.
}
resp, err := c.GenerateEphemeralCert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlConnectClient) GetConnectSettings ¶
func (c *SqlConnectClient) GetConnectSettings(ctx context.Context, req *sqlpb.GetConnectSettingsRequest, opts ...gax.CallOption) (*sqlpb.ConnectSettings, error)
GetConnectSettings retrieves connect settings about a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlConnectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.GetConnectSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#GetConnectSettingsRequest.
}
resp, err := c.GetConnectSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlConnectClient) ResolveConnectSettings ¶
func (c *SqlConnectClient) ResolveConnectSettings(ctx context.Context, req *sqlpb.ResolveConnectSettingsRequest, opts ...gax.CallOption) (*sqlpb.ConnectSettings, error)
ResolveConnectSettings retrieves connect settings about a Cloud SQL instance using the instance DNS name.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlConnectClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.ResolveConnectSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#ResolveConnectSettingsRequest.
}
resp, err := c.ResolveConnectSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlDataCallOptions ¶
type SqlDataCallOptions struct {
StreamSqlData []gax.CallOption
}
SqlDataCallOptions contains the retry settings for each method of SqlDataClient.
type SqlDataClient ¶
type SqlDataClient struct {
// The call options for this service.
CallOptions *SqlDataCallOptions
// contains filtered or unexported fields
}
SqlDataClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for streaming data to and from Cloud SQL instances.
func NewSqlDataClient ¶
func NewSqlDataClient(ctx context.Context, opts ...option.ClientOption) (*SqlDataClient, error)
NewSqlDataClient creates a new sql data service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for streaming data to and from Cloud SQL instances.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlDataClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlDataClient) Close ¶
func (c *SqlDataClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlDataClient) Connection
deprecated
func (c *SqlDataClient) 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 (*SqlDataClient) StreamSqlData ¶
func (c *SqlDataClient) StreamSqlData(ctx context.Context, opts ...gax.CallOption) (sqlpb.SqlDataService_StreamSqlDataClient, error)
StreamSqlData StreamSqlData establishes a bidirectional stream to a Cloud SQL instance, and then streams data to and from the instance.
The first message from the client MUST be a StreamSqlDataRequest request with configuration settings, including required values for the connection_settings field. Subsequent messages from the client may contain the payload field.
Messages from the server may contain the payload field.
The payload fields of the request and response streams contain the raw data of the database’s native wire protocol (e.g., PostgreSQL wire protocol). The database client is responsible for generating and parsing this data.
Any errors on initial connection (e.g., connection failure, authorization issues, network problems) will result in the stream being terminated with an appropriate RPC status exception.
After a successful connection is made, if an error occurs, then the server terminates connection and returns the appropriate RPC status exception.
Add the request params headers to the request to ensure that the streaming request is routed to the correct service for your database.
Use this format for the request params header:
location_path is locations/{location_name} instance_path is projects/{project_name}/instances/{instance_name}
for example: x-goog-request-params: location_id=locations/us-central1&instance_id=projects/myproject/instances/instancename
Example ¶
package main
import (
"context"
"io"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDataClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.StreamSqlData(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*sqlpb.StreamSqlDataRequest{
// TODO: Create requests.
}
for _, req := range reqs {
if err := stream.Send(req); err != nil {
// TODO: Handle error.
}
}
stream.CloseSend()
}()
for {
resp, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
// TODO: handle error.
}
// TODO: Use resp.
_ = resp
}
}
Output:
type SqlDatabasesCallOptions ¶
type SqlDatabasesCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
Update []gax.CallOption
}
SqlDatabasesCallOptions contains the retry settings for each method of SqlDatabasesClient.
type SqlDatabasesClient ¶
type SqlDatabasesClient struct {
// The call options for this service.
CallOptions *SqlDatabasesCallOptions
// contains filtered or unexported fields
}
SqlDatabasesClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlDatabasesClient ¶
func NewSqlDatabasesClient(ctx context.Context, opts ...option.ClientOption) (*SqlDatabasesClient, error)
NewSqlDatabasesClient creates a new sql databases service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlDatabasesRESTClient ¶
func NewSqlDatabasesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlDatabasesClient, error)
NewSqlDatabasesRESTClient creates a new sql databases service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlDatabasesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlDatabasesClient) Close ¶
func (c *SqlDatabasesClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlDatabasesClient) Connection
deprecated
func (c *SqlDatabasesClient) 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 (*SqlDatabasesClient) Delete ¶
func (c *SqlDatabasesClient) Delete(ctx context.Context, req *sqlpb.SqlDatabasesDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Delete deletes a database from a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlDatabasesClient) Get ¶
func (c *SqlDatabasesClient) Get(ctx context.Context, req *sqlpb.SqlDatabasesGetRequest, opts ...gax.CallOption) (*sqlpb.Database, error)
Get retrieves a resource containing information about a database inside a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlDatabasesClient) Insert ¶
func (c *SqlDatabasesClient) Insert(ctx context.Context, req *sqlpb.SqlDatabasesInsertRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Insert inserts a resource containing information about a database inside a Cloud SQL instance.
Note: You can’t modify the default character set and collation.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesInsertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesInsertRequest.
}
resp, err := c.Insert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlDatabasesClient) List ¶
func (c *SqlDatabasesClient) List(ctx context.Context, req *sqlpb.SqlDatabasesListRequest, opts ...gax.CallOption) (*sqlpb.DatabasesListResponse, error)
List lists databases in the specified Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesListRequest.
}
resp, err := c.List(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlDatabasesClient) Patch ¶
func (c *SqlDatabasesClient) Patch(ctx context.Context, req *sqlpb.SqlDatabasesUpdateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Patch partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesUpdateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesUpdateRequest.
}
resp, err := c.Patch(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlDatabasesClient) Update ¶
func (c *SqlDatabasesClient) Update(ctx context.Context, req *sqlpb.SqlDatabasesUpdateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Update updates a resource containing information about a database inside a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlDatabasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlDatabasesUpdateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlDatabasesUpdateRequest.
}
resp, err := c.Update(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlFlagsCallOptions ¶
type SqlFlagsCallOptions struct {
List []gax.CallOption
}
SqlFlagsCallOptions contains the retry settings for each method of SqlFlagsClient.
type SqlFlagsClient ¶
type SqlFlagsClient struct {
// The call options for this service.
CallOptions *SqlFlagsCallOptions
// contains filtered or unexported fields
}
SqlFlagsClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlFlagsClient ¶
func NewSqlFlagsClient(ctx context.Context, opts ...option.ClientOption) (*SqlFlagsClient, error)
NewSqlFlagsClient creates a new sql flags service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlFlagsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlFlagsRESTClient ¶
func NewSqlFlagsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlFlagsClient, error)
NewSqlFlagsRESTClient creates a new sql flags service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlFlagsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlFlagsClient) Close ¶
func (c *SqlFlagsClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlFlagsClient) Connection
deprecated
func (c *SqlFlagsClient) 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 (*SqlFlagsClient) List ¶
func (c *SqlFlagsClient) List(ctx context.Context, req *sqlpb.SqlFlagsListRequest, opts ...gax.CallOption) (*sqlpb.FlagsListResponse, error)
List lists all available database flags for Cloud SQL instances.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlFlagsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlFlagsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlFlagsListRequest.
}
resp, err := c.List(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlInstancesCallOptions ¶
type SqlInstancesCallOptions struct {
AddServerCa []gax.CallOption
AddServerCertificate []gax.CallOption
AddEntraIdCertificate []gax.CallOption
Clone []gax.CallOption
Delete []gax.CallOption
DemoteMaster []gax.CallOption
Demote []gax.CallOption
Export []gax.CallOption
Failover []gax.CallOption
Reencrypt []gax.CallOption
Get []gax.CallOption
Import []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
ListServerCas []gax.CallOption
ListServerCertificates []gax.CallOption
ListEntraIdCertificates []gax.CallOption
Patch []gax.CallOption
PromoteReplica []gax.CallOption
Switchover []gax.CallOption
ResetSslConfig []gax.CallOption
Restart []gax.CallOption
RestoreBackup []gax.CallOption
RotateServerCa []gax.CallOption
RotateServerCertificate []gax.CallOption
RotateEntraIdCertificate []gax.CallOption
StartReplica []gax.CallOption
StopReplica []gax.CallOption
TruncateLog []gax.CallOption
Update []gax.CallOption
CreateEphemeral []gax.CallOption
RescheduleMaintenance []gax.CallOption
VerifyExternalSyncSettings []gax.CallOption
StartExternalSync []gax.CallOption
PerformDiskShrink []gax.CallOption
GetDiskShrinkConfig []gax.CallOption
ResetReplicaSize []gax.CallOption
GetLatestRecoveryTime []gax.CallOption
ExecuteSql []gax.CallOption
AcquireSsrsLease []gax.CallOption
ReleaseSsrsLease []gax.CallOption
PreCheckMajorVersionUpgrade []gax.CallOption
PointInTimeRestore []gax.CallOption
}
SqlInstancesCallOptions contains the retry settings for each method of SqlInstancesClient.
type SqlInstancesClient ¶
type SqlInstancesClient struct {
// The call options for this service.
CallOptions *SqlInstancesCallOptions
// contains filtered or unexported fields
}
SqlInstancesClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlInstancesClient ¶
func NewSqlInstancesClient(ctx context.Context, opts ...option.ClientOption) (*SqlInstancesClient, error)
NewSqlInstancesClient creates a new sql instances service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlInstancesRESTClient ¶
func NewSqlInstancesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlInstancesClient, error)
NewSqlInstancesRESTClient creates a new sql instances service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlInstancesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlInstancesClient) AcquireSsrsLease ¶
func (c *SqlInstancesClient) AcquireSsrsLease(ctx context.Context, req *sqlpb.SqlInstancesAcquireSsrsLeaseRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesAcquireSsrsLeaseResponse, error)
AcquireSsrsLease acquire a lease for the setup of SQL Server Reporting Services (SSRS).
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesAcquireSsrsLeaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesAcquireSsrsLeaseRequest.
}
resp, err := c.AcquireSsrsLease(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) AddEntraIdCertificate ¶
func (c *SqlInstancesClient) AddEntraIdCertificate(ctx context.Context, req *sqlpb.SqlInstancesAddEntraIdCertificateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
AddEntraIdCertificate adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesAddEntraIdCertificateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesAddEntraIdCertificateRequest.
}
resp, err := c.AddEntraIdCertificate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) AddServerCa ¶
func (c *SqlInstancesClient) AddServerCa(ctx context.Context, req *sqlpb.SqlInstancesAddServerCaRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
AddServerCa add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesAddServerCaRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesAddServerCaRequest.
}
resp, err := c.AddServerCa(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) AddServerCertificate ¶
func (c *SqlInstancesClient) AddServerCertificate(ctx context.Context, req *sqlpb.SqlInstancesAddServerCertificateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
AddServerCertificate add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesAddServerCertificateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesAddServerCertificateRequest.
}
resp, err := c.AddServerCertificate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Clone ¶
func (c *SqlInstancesClient) Clone(ctx context.Context, req *sqlpb.SqlInstancesCloneRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Clone creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesCloneRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesCloneRequest.
}
resp, err := c.Clone(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Close ¶
func (c *SqlInstancesClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlInstancesClient) Connection
deprecated
func (c *SqlInstancesClient) 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 (*SqlInstancesClient) CreateEphemeral ¶
func (c *SqlInstancesClient) CreateEphemeral(ctx context.Context, req *sqlpb.SqlInstancesCreateEphemeralCertRequest, opts ...gax.CallOption) (*sqlpb.SslCert, error)
CreateEphemeral generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesCreateEphemeralCertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesCreateEphemeralCertRequest.
}
resp, err := c.CreateEphemeral(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Delete ¶
func (c *SqlInstancesClient) Delete(ctx context.Context, req *sqlpb.SqlInstancesDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Delete deletes a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Demote ¶
func (c *SqlInstancesClient) Demote(ctx context.Context, req *sqlpb.SqlInstancesDemoteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Demote demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesDemoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesDemoteRequest.
}
resp, err := c.Demote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) DemoteMaster ¶
func (c *SqlInstancesClient) DemoteMaster(ctx context.Context, req *sqlpb.SqlInstancesDemoteMasterRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
DemoteMaster demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesDemoteMasterRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesDemoteMasterRequest.
}
resp, err := c.DemoteMaster(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ExecuteSql ¶
func (c *SqlInstancesClient) ExecuteSql(ctx context.Context, req *sqlpb.SqlInstancesExecuteSqlRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesExecuteSqlResponse, error)
ExecuteSql execute SQL statements.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesExecuteSqlRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesExecuteSqlRequest.
}
resp, err := c.ExecuteSql(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Export ¶
func (c *SqlInstancesClient) Export(ctx context.Context, req *sqlpb.SqlInstancesExportRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Export exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesExportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesExportRequest.
}
resp, err := c.Export(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Failover ¶
func (c *SqlInstancesClient) Failover(ctx context.Context, req *sqlpb.SqlInstancesFailoverRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Failover initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability (at https://cloud.google.com/sql/docs/mysql/high-availability) page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesFailoverRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesFailoverRequest.
}
resp, err := c.Failover(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Get ¶
func (c *SqlInstancesClient) Get(ctx context.Context, req *sqlpb.SqlInstancesGetRequest, opts ...gax.CallOption) (*sqlpb.DatabaseInstance, error)
Get retrieves a resource containing information about a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) GetDiskShrinkConfig ¶
func (c *SqlInstancesClient) GetDiskShrinkConfig(ctx context.Context, req *sqlpb.SqlInstancesGetDiskShrinkConfigRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesGetDiskShrinkConfigResponse, error)
GetDiskShrinkConfig get Disk Shrink Config for a given instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesGetDiskShrinkConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesGetDiskShrinkConfigRequest.
}
resp, err := c.GetDiskShrinkConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) GetLatestRecoveryTime ¶
func (c *SqlInstancesClient) GetLatestRecoveryTime(ctx context.Context, req *sqlpb.SqlInstancesGetLatestRecoveryTimeRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesGetLatestRecoveryTimeResponse, error)
GetLatestRecoveryTime get Latest Recovery Time for a given instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesGetLatestRecoveryTimeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesGetLatestRecoveryTimeRequest.
}
resp, err := c.GetLatestRecoveryTime(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Import ¶
func (c *SqlInstancesClient) Import(ctx context.Context, req *sqlpb.SqlInstancesImportRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Import imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesImportRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesImportRequest.
}
resp, err := c.Import(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Insert ¶
func (c *SqlInstancesClient) Insert(ctx context.Context, req *sqlpb.SqlInstancesInsertRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Insert creates a new Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesInsertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesInsertRequest.
}
resp, err := c.Insert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) List ¶
func (c *SqlInstancesClient) List(ctx context.Context, req *sqlpb.SqlInstancesListRequest, opts ...gax.CallOption) *ApiWarningIterator
List lists instances under a given project.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
"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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesListRequest.
}
it := c.List(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.(*sqlpb.InstancesListResponse)
}
}
Output:
Example (All) ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesListRequest.
}
for resp, err := range c.List(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 (*SqlInstancesClient) ListEntraIdCertificates ¶
func (c *SqlInstancesClient) ListEntraIdCertificates(ctx context.Context, req *sqlpb.SqlInstancesListEntraIdCertificatesRequest, opts ...gax.CallOption) (*sqlpb.InstancesListEntraIdCertificatesResponse, error)
ListEntraIdCertificates lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesListEntraIdCertificatesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesListEntraIdCertificatesRequest.
}
resp, err := c.ListEntraIdCertificates(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ListServerCas ¶
func (c *SqlInstancesClient) ListServerCas(ctx context.Context, req *sqlpb.SqlInstancesListServerCasRequest, opts ...gax.CallOption) (*sqlpb.InstancesListServerCasResponse, error)
ListServerCas lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesListServerCasRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesListServerCasRequest.
}
resp, err := c.ListServerCas(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ListServerCertificates ¶
func (c *SqlInstancesClient) ListServerCertificates(ctx context.Context, req *sqlpb.SqlInstancesListServerCertificatesRequest, opts ...gax.CallOption) (*sqlpb.InstancesListServerCertificatesResponse, error)
ListServerCertificates lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesListServerCertificatesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesListServerCertificatesRequest.
}
resp, err := c.ListServerCertificates(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Patch ¶
func (c *SqlInstancesClient) Patch(ctx context.Context, req *sqlpb.SqlInstancesPatchRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Patch partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesPatchRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesPatchRequest.
}
resp, err := c.Patch(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) PerformDiskShrink ¶
func (c *SqlInstancesClient) PerformDiskShrink(ctx context.Context, req *sqlpb.SqlInstancesPerformDiskShrinkRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
PerformDiskShrink perform Disk Shrink on primary instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesPerformDiskShrinkRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesPerformDiskShrinkRequest.
}
resp, err := c.PerformDiskShrink(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) PointInTimeRestore ¶
func (c *SqlInstancesClient) PointInTimeRestore(ctx context.Context, req *sqlpb.SqlInstancesPointInTimeRestoreRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
PointInTimeRestore point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesPointInTimeRestoreRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesPointInTimeRestoreRequest.
}
resp, err := c.PointInTimeRestore(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) PreCheckMajorVersionUpgrade ¶
func (c *SqlInstancesClient) PreCheckMajorVersionUpgrade(ctx context.Context, req *sqlpb.SqlInstancesPreCheckMajorVersionUpgradeRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
PreCheckMajorVersionUpgrade execute MVU Pre-checks
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesPreCheckMajorVersionUpgradeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesPreCheckMajorVersionUpgradeRequest.
}
resp, err := c.PreCheckMajorVersionUpgrade(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) PromoteReplica ¶
func (c *SqlInstancesClient) PromoteReplica(ctx context.Context, req *sqlpb.SqlInstancesPromoteReplicaRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
PromoteReplica promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesPromoteReplicaRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesPromoteReplicaRequest.
}
resp, err := c.PromoteReplica(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Reencrypt ¶
func (c *SqlInstancesClient) Reencrypt(ctx context.Context, req *sqlpb.SqlInstancesReencryptRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Reencrypt reencrypt CMEK instance with latest key version.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesReencryptRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesReencryptRequest.
}
resp, err := c.Reencrypt(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ReleaseSsrsLease ¶
func (c *SqlInstancesClient) ReleaseSsrsLease(ctx context.Context, req *sqlpb.SqlInstancesReleaseSsrsLeaseRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesReleaseSsrsLeaseResponse, error)
ReleaseSsrsLease release a lease for the setup of SQL Server Reporting Services (SSRS).
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesReleaseSsrsLeaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesReleaseSsrsLeaseRequest.
}
resp, err := c.ReleaseSsrsLease(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) RescheduleMaintenance ¶
func (c *SqlInstancesClient) RescheduleMaintenance(ctx context.Context, req *sqlpb.SqlInstancesRescheduleMaintenanceRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
RescheduleMaintenance reschedules the maintenance on the given instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRescheduleMaintenanceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRescheduleMaintenanceRequest.
}
resp, err := c.RescheduleMaintenance(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ResetReplicaSize ¶
func (c *SqlInstancesClient) ResetReplicaSize(ctx context.Context, req *sqlpb.SqlInstancesResetReplicaSizeRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
ResetReplicaSize reset Replica Size to primary instance disk size.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesResetReplicaSizeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesResetReplicaSizeRequest.
}
resp, err := c.ResetReplicaSize(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) ResetSslConfig ¶
func (c *SqlInstancesClient) ResetSslConfig(ctx context.Context, req *sqlpb.SqlInstancesResetSslConfigRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
ResetSslConfig deletes all client certificates and generates a new server SSL certificate for the instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesResetSslConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesResetSslConfigRequest.
}
resp, err := c.ResetSslConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Restart ¶
func (c *SqlInstancesClient) Restart(ctx context.Context, req *sqlpb.SqlInstancesRestartRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Restart restarts a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRestartRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRestartRequest.
}
resp, err := c.Restart(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) RestoreBackup ¶
func (c *SqlInstancesClient) RestoreBackup(ctx context.Context, req *sqlpb.SqlInstancesRestoreBackupRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
RestoreBackup restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRestoreBackupRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRestoreBackupRequest.
}
resp, err := c.RestoreBackup(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) RotateEntraIdCertificate ¶
func (c *SqlInstancesClient) RotateEntraIdCertificate(ctx context.Context, req *sqlpb.SqlInstancesRotateEntraIdCertificateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
RotateEntraIdCertificate rotates the Entra Id certificate version to one previously added with the addEntraIdCertificate method.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRotateEntraIdCertificateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRotateEntraIdCertificateRequest.
}
resp, err := c.RotateEntraIdCertificate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) RotateServerCa ¶
func (c *SqlInstancesClient) RotateServerCa(ctx context.Context, req *sqlpb.SqlInstancesRotateServerCaRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
RotateServerCa rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRotateServerCaRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRotateServerCaRequest.
}
resp, err := c.RotateServerCa(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) RotateServerCertificate ¶
func (c *SqlInstancesClient) RotateServerCertificate(ctx context.Context, req *sqlpb.SqlInstancesRotateServerCertificateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
RotateServerCertificate rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesRotateServerCertificateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesRotateServerCertificateRequest.
}
resp, err := c.RotateServerCertificate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) StartExternalSync ¶
func (c *SqlInstancesClient) StartExternalSync(ctx context.Context, req *sqlpb.SqlInstancesStartExternalSyncRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
StartExternalSync start External primary instance migration.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesStartExternalSyncRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesStartExternalSyncRequest.
}
resp, err := c.StartExternalSync(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) StartReplica ¶
func (c *SqlInstancesClient) StartReplica(ctx context.Context, req *sqlpb.SqlInstancesStartReplicaRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
StartReplica starts the replication in the read replica instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesStartReplicaRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesStartReplicaRequest.
}
resp, err := c.StartReplica(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) StopReplica ¶
func (c *SqlInstancesClient) StopReplica(ctx context.Context, req *sqlpb.SqlInstancesStopReplicaRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
StopReplica stops the replication in the read replica instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesStopReplicaRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesStopReplicaRequest.
}
resp, err := c.StopReplica(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Switchover ¶
func (c *SqlInstancesClient) Switchover(ctx context.Context, req *sqlpb.SqlInstancesSwitchoverRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Switchover switches over from the primary instance to the DR replica instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesSwitchoverRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesSwitchoverRequest.
}
resp, err := c.Switchover(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) TruncateLog ¶
func (c *SqlInstancesClient) TruncateLog(ctx context.Context, req *sqlpb.SqlInstancesTruncateLogRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
TruncateLog truncate MySQL general and slow query log tables MySQL only.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesTruncateLogRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesTruncateLogRequest.
}
resp, err := c.TruncateLog(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) Update ¶
func (c *SqlInstancesClient) Update(ctx context.Context, req *sqlpb.SqlInstancesUpdateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Update updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesUpdateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesUpdateRequest.
}
resp, err := c.Update(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlInstancesClient) VerifyExternalSyncSettings ¶
func (c *SqlInstancesClient) VerifyExternalSyncSettings(ctx context.Context, req *sqlpb.SqlInstancesVerifyExternalSyncSettingsRequest, opts ...gax.CallOption) (*sqlpb.SqlInstancesVerifyExternalSyncSettingsResponse, error)
VerifyExternalSyncSettings verify External primary instance external sync settings.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlInstancesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlInstancesVerifyExternalSyncSettingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlInstancesVerifyExternalSyncSettingsRequest.
}
resp, err := c.VerifyExternalSyncSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlOperationsCallOptions ¶
type SqlOperationsCallOptions struct {
Get []gax.CallOption
List []gax.CallOption
Cancel []gax.CallOption
}
SqlOperationsCallOptions contains the retry settings for each method of SqlOperationsClient.
type SqlOperationsClient ¶
type SqlOperationsClient struct {
// The call options for this service.
CallOptions *SqlOperationsCallOptions
// contains filtered or unexported fields
}
SqlOperationsClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlOperationsClient ¶
func NewSqlOperationsClient(ctx context.Context, opts ...option.ClientOption) (*SqlOperationsClient, error)
NewSqlOperationsClient creates a new sql operations service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlOperationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlOperationsRESTClient ¶
func NewSqlOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlOperationsClient, error)
NewSqlOperationsRESTClient creates a new sql operations service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlOperationsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlOperationsClient) Cancel ¶
func (c *SqlOperationsClient) Cancel(ctx context.Context, req *sqlpb.SqlOperationsCancelRequest, opts ...gax.CallOption) error
Cancel cancels an instance operation that has been performed on an instance. Ordinarily, this method name should be CancelSqlOperation.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlOperationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlOperationsCancelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlOperationsCancelRequest.
}
err = c.Cancel(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
Output:
func (*SqlOperationsClient) Close ¶
func (c *SqlOperationsClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlOperationsClient) Connection
deprecated
func (c *SqlOperationsClient) 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 (*SqlOperationsClient) Get ¶
func (c *SqlOperationsClient) Get(ctx context.Context, req *sqlpb.SqlOperationsGetRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Get retrieves an instance operation that has been performed on an instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlOperationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlOperationsGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlOperationsGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlOperationsClient) List ¶
func (c *SqlOperationsClient) List(ctx context.Context, req *sqlpb.SqlOperationsListRequest, opts ...gax.CallOption) *OperationIterator
List lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
"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 := sql.NewSqlOperationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlOperationsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlOperationsListRequest.
}
it := c.List(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.(*sqlpb.OperationsListResponse)
}
}
Output:
Example (All) ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlOperationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlOperationsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlOperationsListRequest.
}
for resp, err := range c.List(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
Output:
type SqlSslCertsCallOptions ¶
type SqlSslCertsCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
}
SqlSslCertsCallOptions contains the retry settings for each method of SqlSslCertsClient.
type SqlSslCertsClient ¶
type SqlSslCertsClient struct {
// The call options for this service.
CallOptions *SqlSslCertsCallOptions
// contains filtered or unexported fields
}
SqlSslCertsClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlSslCertsClient ¶
func NewSqlSslCertsClient(ctx context.Context, opts ...option.ClientOption) (*SqlSslCertsClient, error)
NewSqlSslCertsClient creates a new sql ssl certs service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlSslCertsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlSslCertsRESTClient ¶
func NewSqlSslCertsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlSslCertsClient, error)
NewSqlSslCertsRESTClient creates a new sql ssl certs service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlSslCertsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlSslCertsClient) Close ¶
func (c *SqlSslCertsClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlSslCertsClient) Connection
deprecated
func (c *SqlSslCertsClient) 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 (*SqlSslCertsClient) Delete ¶
func (c *SqlSslCertsClient) Delete(ctx context.Context, req *sqlpb.SqlSslCertsDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Delete deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlSslCertsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlSslCertsDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlSslCertsDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlSslCertsClient) Get ¶
func (c *SqlSslCertsClient) Get(ctx context.Context, req *sqlpb.SqlSslCertsGetRequest, opts ...gax.CallOption) (*sqlpb.SslCert, error)
Get retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlSslCertsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlSslCertsGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlSslCertsGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlSslCertsClient) Insert ¶
func (c *SqlSslCertsClient) Insert(ctx context.Context, req *sqlpb.SqlSslCertsInsertRequest, opts ...gax.CallOption) (*sqlpb.SslCertsInsertResponse, error)
Insert creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlSslCertsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlSslCertsInsertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlSslCertsInsertRequest.
}
resp, err := c.Insert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlSslCertsClient) List ¶
func (c *SqlSslCertsClient) List(ctx context.Context, req *sqlpb.SqlSslCertsListRequest, opts ...gax.CallOption) (*sqlpb.SslCertsListResponse, error)
List lists all of the current SSL certificates for the instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlSslCertsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlSslCertsListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlSslCertsListRequest.
}
resp, err := c.List(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlTiersCallOptions ¶
type SqlTiersCallOptions struct {
List []gax.CallOption
}
SqlTiersCallOptions contains the retry settings for each method of SqlTiersClient.
type SqlTiersClient ¶
type SqlTiersClient struct {
// The call options for this service.
CallOptions *SqlTiersCallOptions
// contains filtered or unexported fields
}
SqlTiersClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for providing machine types (tiers) for Cloud SQL.
func NewSqlTiersClient ¶
func NewSqlTiersClient(ctx context.Context, opts ...option.ClientOption) (*SqlTiersClient, error)
NewSqlTiersClient creates a new sql tiers service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for providing machine types (tiers) for Cloud SQL.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlTiersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlTiersRESTClient ¶
func NewSqlTiersRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlTiersClient, error)
NewSqlTiersRESTClient creates a new sql tiers service rest client.
Service for providing machine types (tiers) for Cloud SQL.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlTiersRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlTiersClient) Close ¶
func (c *SqlTiersClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlTiersClient) Connection
deprecated
func (c *SqlTiersClient) 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 (*SqlTiersClient) List ¶
func (c *SqlTiersClient) List(ctx context.Context, req *sqlpb.SqlTiersListRequest, opts ...gax.CallOption) (*sqlpb.TiersListResponse, error)
List lists all available machine types (tiers) for Cloud SQL, for example, db-custom-1-3840. For related information, see Pricing (at /sql/pricing).
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlTiersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlTiersListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlTiersListRequest.
}
resp, err := c.List(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
type SqlUsersCallOptions ¶
type SqlUsersCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Update []gax.CallOption
}
SqlUsersCallOptions contains the retry settings for each method of SqlUsersClient.
type SqlUsersClient ¶
type SqlUsersClient struct {
// The call options for this service.
CallOptions *SqlUsersCallOptions
// contains filtered or unexported fields
}
SqlUsersClient is a client for interacting with Cloud SQL Admin API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSqlUsersClient ¶
func NewSqlUsersClient(ctx context.Context, opts ...option.ClientOption) (*SqlUsersClient, error)
NewSqlUsersClient creates a new sql users service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewSqlUsersRESTClient ¶
func NewSqlUsersRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlUsersClient, error)
NewSqlUsersRESTClient creates a new sql users service rest client.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
)
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 := sql.NewSqlUsersRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*SqlUsersClient) Close ¶
func (c *SqlUsersClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*SqlUsersClient) Connection
deprecated
func (c *SqlUsersClient) 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 (*SqlUsersClient) Delete ¶
func (c *SqlUsersClient) Delete(ctx context.Context, req *sqlpb.SqlUsersDeleteRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Delete deletes a user from a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlUsersDeleteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlUsersDeleteRequest.
}
resp, err := c.Delete(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlUsersClient) Get ¶
func (c *SqlUsersClient) Get(ctx context.Context, req *sqlpb.SqlUsersGetRequest, opts ...gax.CallOption) (*sqlpb.User, error)
Get retrieves a resource containing information about a user.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlUsersGetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlUsersGetRequest.
}
resp, err := c.Get(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlUsersClient) Insert ¶
func (c *SqlUsersClient) Insert(ctx context.Context, req *sqlpb.SqlUsersInsertRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Insert creates a new user in a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlUsersInsertRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlUsersInsertRequest.
}
resp, err := c.Insert(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlUsersClient) List ¶
func (c *SqlUsersClient) List(ctx context.Context, req *sqlpb.SqlUsersListRequest, opts ...gax.CallOption) (*sqlpb.UsersListResponse, error)
List lists users in the specified Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlUsersListRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlUsersListRequest.
}
resp, err := c.List(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output:
func (*SqlUsersClient) Update ¶
func (c *SqlUsersClient) Update(ctx context.Context, req *sqlpb.SqlUsersUpdateRequest, opts ...gax.CallOption) (*sqlpb.Operation, error)
Update updates an existing user in a Cloud SQL instance.
Example ¶
package main
import (
"context"
sql "cloud.google.com/go/sql/apiv1beta4"
sqlpb "cloud.google.com/go/sql/apiv1beta4/sqlpb"
)
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 := sql.NewSqlUsersClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &sqlpb.SqlUsersUpdateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/sql/apiv1beta4/sqlpb#SqlUsersUpdateRequest.
}
resp, err := c.Update(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output: