sql

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

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:

Example usage

To get started with this package, create a client.

// go get cloud.google.com/go/sql/apiv1@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.NewSqlAvailableDatabaseVersionsClient(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.

Use of Context

The ctx passed to NewSqlAvailableDatabaseVersionsClient 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

Examples

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

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

func (it *BackupIterator) All() iter.Seq2[*sqlpb.Backup, error]

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.

Service for managing database backups.

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.

Service for managing database backups.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlBackupRunsRESTClient

func NewSqlBackupRunsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlBackupRunsClient, error)

NewSqlBackupRunsRESTClient creates a new sql backup runs service rest client.

Service for managing database backups.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

Delete deletes the backup taken by a backup run.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlBackupRunsDeleteRequest.
	}
	resp, err := c.Delete(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlBackupRunsClient) Get

Get retrieves a resource containing information about a backup run.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlBackupRunsGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlBackupRunsClient) Insert

Insert creates a new backup run on demand.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlBackupRunsInsertRequest.
	}
	resp, err := c.Insert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlBackupRunsClient) List

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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)
	}
}
Example (All)
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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
	}
}

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/apiv1"
)

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
}

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/apiv1"
)

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
}

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#CreateBackupRequest.
	}
	resp, err := c.CreateBackup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#DeleteBackupRequest.
	}
	resp, err := c.DeleteBackup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#GetBackupRequest.
	}
	resp, err := c.GetBackup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlBackupsClient) ListBackups

ListBackups lists all backups associated with the project.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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)
	}
}
Example (All)
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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
	}
}

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 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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#UpdateBackupRequest.
	}
	resp, err := c.UpdateBackup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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/apiv1"
)

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
}

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/apiv1"
)

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
}

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

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#GenerateEphemeralCertRequest.
	}
	resp, err := c.GenerateEphemeralCert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlConnectClient) GetConnectSettings

GetConnectSettings retrieves connect settings about a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#GetConnectSettingsRequest.
	}
	resp, err := c.GetConnectSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#ResolveConnectSettingsRequest.
	}
	resp, err := c.ResolveConnectSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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.

Service to manage databases.

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.

Service to manage databases.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlDatabasesRESTClient

func NewSqlDatabasesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlDatabasesClient, error)

NewSqlDatabasesRESTClient creates a new sql databases service rest client.

Service to manage databases.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

Delete deletes a database from a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesDeleteRequest.
	}
	resp, err := c.Delete(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlDatabasesClient) Get

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlDatabasesClient) Insert

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesInsertRequest.
	}
	resp, err := c.Insert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlDatabasesClient) List

List lists databases in the specified Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesListRequest.
	}
	resp, err := c.List(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlDatabasesClient) Patch

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesUpdateRequest.
	}
	resp, err := c.Patch(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlDatabasesClient) Update

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlDatabasesUpdateRequest.
	}
	resp, err := c.Update(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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.

Service to manage database flags for Cloud SQL instances.

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.

Service to manage database flags for Cloud SQL instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlFlagsRESTClient

func NewSqlFlagsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlFlagsClient, error)

NewSqlFlagsRESTClient creates a new sql flags service rest client.

Service to manage database flags for Cloud SQL instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

List lists all available database flags for Cloud SQL instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlFlagsListRequest.
	}
	resp, err := c.List(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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/apiv1"
)

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
}

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/apiv1"
)

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
}

func (*SqlInstancesClient) AcquireSsrsLease

AcquireSsrsLease acquire a lease for the setup of SQL Server Reporting Services (SSRS).

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesAcquireSsrsLeaseRequest.
	}
	resp, err := c.AcquireSsrsLease(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) AddEntraIdCertificate

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesAddEntraIdCertificateRequest.
	}
	resp, err := c.AddEntraIdCertificate(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) AddServerCa

AddServerCa adds 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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesAddServerCaRequest.
	}
	resp, err := c.AddServerCa(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) AddServerCertificate

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesAddServerCertificateRequest.
	}
	resp, err := c.AddServerCertificate(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Clone

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesCloneRequest.
	}
	resp, err := c.Clone(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesCreateEphemeralCertRequest.
	}
	resp, err := c.CreateEphemeral(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Delete

Delete deletes a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesDeleteRequest.
	}
	resp, err := c.Delete(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Demote

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesDemoteRequest.
	}
	resp, err := c.Demote(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) DemoteMaster

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesDemoteMasterRequest.
	}
	resp, err := c.DemoteMaster(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ExecuteSql

ExecuteSql execute SQL statements.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesExecuteSqlRequest.
	}
	resp, err := c.ExecuteSql(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Export

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesExportRequest.
	}
	resp, err := c.Export(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Failover

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesFailoverRequest.
	}
	resp, err := c.Failover(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Get

Get retrieves a resource containing information about a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) GetDiskShrinkConfig

GetDiskShrinkConfig get Disk Shrink Config for a given instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesGetDiskShrinkConfigRequest.
	}
	resp, err := c.GetDiskShrinkConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) GetLatestRecoveryTime

GetLatestRecoveryTime get Latest Recovery Time for a given instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesGetLatestRecoveryTimeRequest.
	}
	resp, err := c.GetLatestRecoveryTime(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Import

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesImportRequest.
	}
	resp, err := c.Import(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Insert

Insert creates a new Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesInsertRequest.
	}
	resp, err := c.Insert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) List

List lists instances under a given project.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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)
	}
}
Example (All)
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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
	}
}

func (*SqlInstancesClient) ListEntraIdCertificates

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesListEntraIdCertificatesRequest.
	}
	resp, err := c.ListEntraIdCertificates(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ListServerCas

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesListServerCasRequest.
	}
	resp, err := c.ListServerCas(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ListServerCertificates

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesListServerCertificatesRequest.
	}
	resp, err := c.ListServerCertificates(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Patch

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesPatchRequest.
	}
	resp, err := c.Patch(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) PerformDiskShrink

PerformDiskShrink perform Disk Shrink on primary instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesPerformDiskShrinkRequest.
	}
	resp, err := c.PerformDiskShrink(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) PointInTimeRestore

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesPointInTimeRestoreRequest.
	}
	resp, err := c.PointInTimeRestore(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) PreCheckMajorVersionUpgrade

PreCheckMajorVersionUpgrade execute MVU Pre-checks

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesPreCheckMajorVersionUpgradeRequest.
	}
	resp, err := c.PreCheckMajorVersionUpgrade(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) PromoteReplica

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesPromoteReplicaRequest.
	}
	resp, err := c.PromoteReplica(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Reencrypt

Reencrypt reencrypt CMEK instance with latest key version.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesReencryptRequest.
	}
	resp, err := c.Reencrypt(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ReleaseSsrsLease

ReleaseSsrsLease release a lease for the setup of SQL Server Reporting Services (SSRS).

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesReleaseSsrsLeaseRequest.
	}
	resp, err := c.ReleaseSsrsLease(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) RescheduleMaintenance

RescheduleMaintenance reschedules the maintenance on the given instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRescheduleMaintenanceRequest.
	}
	resp, err := c.RescheduleMaintenance(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ResetReplicaSize

ResetReplicaSize reset Replica Size to primary instance disk size.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesResetReplicaSizeRequest.
	}
	resp, err := c.ResetReplicaSize(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) ResetSslConfig

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesResetSslConfigRequest.
	}
	resp, err := c.ResetSslConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Restart

Restart restarts a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRestartRequest.
	}
	resp, err := c.Restart(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) RestoreBackup

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRestoreBackupRequest.
	}
	resp, err := c.RestoreBackup(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) RotateEntraIdCertificate

RotateEntraIdCertificate rotates the server certificate version to one previously added with the addEntraIdCertificate method.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRotateEntraIdCertificateRequest.
	}
	resp, err := c.RotateEntraIdCertificate(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) RotateServerCa

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRotateServerCaRequest.
	}
	resp, err := c.RotateServerCa(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) RotateServerCertificate

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesRotateServerCertificateRequest.
	}
	resp, err := c.RotateServerCertificate(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) StartExternalSync

StartExternalSync start External primary instance migration.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesStartExternalSyncRequest.
	}
	resp, err := c.StartExternalSync(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) StartReplica

StartReplica starts the replication in the read replica instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesStartReplicaRequest.
	}
	resp, err := c.StartReplica(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) StopReplica

StopReplica stops the replication in the read replica instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesStopReplicaRequest.
	}
	resp, err := c.StopReplica(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Switchover

Switchover switches over from the primary instance to the DR replica instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesSwitchoverRequest.
	}
	resp, err := c.Switchover(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) TruncateLog

TruncateLog truncate MySQL general and slow query log tables MySQL only.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesTruncateLogRequest.
	}
	resp, err := c.TruncateLog(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) Update

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesUpdateRequest.
	}
	resp, err := c.Update(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlInstancesClient) VerifyExternalSyncSettings

VerifyExternalSyncSettings verify External primary instance external sync settings.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlInstancesVerifyExternalSyncSettingsRequest.
	}
	resp, err := c.VerifyExternalSyncSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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.

Service to fetch operations for database instances.

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.

Service to fetch operations for database instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlOperationsRESTClient

func NewSqlOperationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlOperationsClient, error)

NewSqlOperationsRESTClient creates a new sql operations service rest client.

Service to fetch operations for database instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func (*SqlOperationsClient) Cancel

Cancel cancels an instance operation that has been performed on an instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlOperationsCancelRequest.
	}
	err = c.Cancel(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

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

Get retrieves an instance operation that has been performed on an instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlOperationsGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlOperationsClient) List

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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)
	}
}
Example (All)
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/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
	}
}

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.

Service to manage SSL certs for Cloud SQL instances.

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.

Service to manage SSL certs for Cloud SQL instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlSslCertsRESTClient

func NewSqlSslCertsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlSslCertsClient, error)

NewSqlSslCertsRESTClient creates a new sql ssl certs service rest client.

Service to manage SSL certs for Cloud SQL instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlSslCertsDeleteRequest.
	}
	resp, err := c.Delete(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlSslCertsClient) Get

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlSslCertsGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlSslCertsClient) Insert

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/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlSslCertsInsertRequest.
	}
	resp, err := c.Insert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlSslCertsClient) List

List lists all of the current SSL certificates for the instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlSslCertsListRequest.
	}
	resp, err := c.List(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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 instances.

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 instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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 instances.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

List lists all available machine types (tiers) for Cloud SQL, for example, db-custom-1-3840. For more information, see https://cloud.google.com/sql/pricing (at https://cloud.google.com/sql/pricing).

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlTiersListRequest.
	}
	resp, err := c.List(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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.

Cloud SQL users service.

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.

Cloud SQL users service.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

func NewSqlUsersRESTClient

func NewSqlUsersRESTClient(ctx context.Context, opts ...option.ClientOption) (*SqlUsersClient, error)

NewSqlUsersRESTClient creates a new sql users service rest client.

Cloud SQL users service.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
)

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
}

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

Delete deletes a user from a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlUsersDeleteRequest.
	}
	resp, err := c.Delete(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlUsersClient) Get

Get retrieves a resource containing information about a user.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlUsersGetRequest.
	}
	resp, err := c.Get(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlUsersClient) Insert

Insert creates a new user in a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlUsersInsertRequest.
	}
	resp, err := c.Insert(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlUsersClient) List

List lists users in the specified Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlUsersListRequest.
	}
	resp, err := c.List(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*SqlUsersClient) Update

Update updates an existing user in a Cloud SQL instance.

Example
package main

import (
	"context"

	sql "cloud.google.com/go/sql/apiv1"
	sqlpb "cloud.google.com/go/sql/apiv1/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/apiv1/sqlpb#SqlUsersUpdateRequest.
	}
	resp, err := c.Update(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL