Documentation ¶
Overview ¶
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- type Instance
- func (i *Instance) Close()
- func (i *Instance) ConnectInfo(ctx context.Context, ipType string) (string, *tls.Config, error)
- func (i *Instance) ForceRefresh()
- func (i *Instance) InstanceEngineVersion(ctx context.Context) (string, error)
- func (i *Instance) String() string
- func (i *Instance) UpdateRefresh(cfg RefreshCfg)
- type RefreshCfg
Constants ¶
const ( // PublicIP is the value for public IP Cloud SQL instances. PublicIP = "PUBLIC" // PrivateIP is the value for private IP Cloud SQL instances. PrivateIP = "PRIVATE" // AutoIP selects public IP if available and otherwise selects private IP. AutoIP = "AutoIP" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct { // OpenConns is the number of open connections to the instance. OpenConns uint64 RefreshCfg RefreshCfg // contains filtered or unexported fields }
Instance manages the information used to connect to the Cloud SQL instance by periodically calling the Cloud SQL Admin API. It automatically refreshes the required information approximately 5 minutes before the previous certificate expires (every 55 minutes).
func NewInstance ¶
func NewInstance( instance string, client *sqladmin.Service, key *rsa.PrivateKey, refreshTimeout time.Duration, ts oauth2.TokenSource, dialerID string, r RefreshCfg, ) (*Instance, error)
NewInstance initializes a new Instance given an instance connection name
func (*Instance) Close ¶
func (i *Instance) Close()
Close closes the instance; it stops the refresh cycle and prevents it from making additional calls to the Cloud SQL Admin API.
func (*Instance) ConnectInfo ¶
ConnectInfo returns an IP address specified by ipType (i.e., public or private) and a TLS config that can be used to connect to a Cloud SQL instance.
func (*Instance) ForceRefresh ¶
func (i *Instance) ForceRefresh()
ForceRefresh triggers an immediate refresh operation to be scheduled and used for future connection attempts.
func (*Instance) InstanceEngineVersion ¶
InstanceEngineVersion returns the engine type and version for the instance. The value coresponds to one of the following types for the instance: https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/SqlDatabaseVersion
func (*Instance) UpdateRefresh ¶ added in v0.4.0
func (i *Instance) UpdateRefresh(cfg RefreshCfg)
UpdateRefresh cancels all existing refresh attempts and schedules new attempts with the provided config.
type RefreshCfg ¶ added in v0.4.0
type RefreshCfg struct {
UseIAMAuthN bool
}
RefreshCfg is a of attributes that trigger new refresh operations.