mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-16 08:10:02 +00:00
21 lines
457 B
Go
21 lines
457 B
Go
|
package getter
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
// getter is our base getter; it regroups
|
||
|
// fields all getters have in common.
|
||
|
type getter struct {
|
||
|
client *Client
|
||
|
}
|
||
|
|
||
|
func (g *getter) SetClient(c *Client) { g.client = c }
|
||
|
|
||
|
// Context tries to returns the Contex from the getter's
|
||
|
// client. otherwise context.Background() is returned.
|
||
|
func (g *getter) Context() context.Context {
|
||
|
if g == nil || g.client == nil {
|
||
|
return context.Background()
|
||
|
}
|
||
|
return g.client.Ctx
|
||
|
}
|