Documentation ¶
Index ¶
- Variables
- func SetMockMetadataFetcher(baseUrl string, now time.Time)
- type MetadataFetcher
- func (mf *MetadataFetcher) FetchAccessToken() (string, time.Duration, error)
- func (mf *MetadataFetcher) FetchConfigId() (string, error)
- func (mf *MetadataFetcher) FetchGCPAttributes() (*scpb.GcpAttributes, error)
- func (mf *MetadataFetcher) FetchIdentityJWTToken(audience string) (string, time.Duration, error)
- func (mf *MetadataFetcher) FetchProjectId() (string, error)
- func (mf *MetadataFetcher) FetchRolloutStrategy() (string, error)
- func (mf *MetadataFetcher) FetchServiceName() (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MetadataFetcherRetryConfig = util.RetryConfig{ RetryNum: 5, RetryInterval: time.Millisecond * 20, }
View Source
var ( NewMetadataFetcher = func(opts options.CommonOptions) *MetadataFetcher { return &MetadataFetcher{ client: http.Client{ Timeout: opts.HttpRequestTimeout, }, baseUrl: opts.MetadataURL, timeNow: time.Now, retryConfig: MetadataFetcherRetryConfig, } } )
Allows for unit tests to inject a mock constructor
Functions ¶
func SetMockMetadataFetcher ¶
Injects the mock constructor into source code. Mock metadata fetcher only created when source code calls constructor.
Types ¶
type MetadataFetcher ¶
type MetadataFetcher struct {
// contains filtered or unexported fields
}
func NewMockMetadataFetcher ¶
func NewMockMetadataFetcher(baseUrl string, now time.Time) *MetadataFetcher
Creates a mock metadata fetcher and returns the mock instance
func (*MetadataFetcher) FetchAccessToken ¶
func (mf *MetadataFetcher) FetchAccessToken() (string, time.Duration, error)
func (*MetadataFetcher) FetchConfigId ¶
func (mf *MetadataFetcher) FetchConfigId() (string, error)
func (*MetadataFetcher) FetchGCPAttributes ¶
func (mf *MetadataFetcher) FetchGCPAttributes() (*scpb.GcpAttributes, error)
func (*MetadataFetcher) FetchIdentityJWTToken ¶
func (*MetadataFetcher) FetchProjectId ¶
func (mf *MetadataFetcher) FetchProjectId() (string, error)
func (*MetadataFetcher) FetchRolloutStrategy ¶
func (mf *MetadataFetcher) FetchRolloutStrategy() (string, error)
func (*MetadataFetcher) FetchServiceName ¶
func (mf *MetadataFetcher) FetchServiceName() (string, error)
Click to show internal directories.
Click to hide internal directories.