// Retrieve will attempt to request the credentials from the endpoint the Provider
// was configured for. And error will be returned if the retrieval fails.
428288
func (p *Provider) Retrieve() (credentials.Value, error) {
	resp, err := p.getCredentials()
	if err != nil {
		return credentials.Value{ProviderName: ProviderName},
			awserr.New("CredentialsEndpointError", "failed to load credentials", err)
	}

	if resp.Expiration != nil {
		p.SetExpiration(*resp.Expiration, p.ExpiryWindow)
	} else {
		p.staticCreds = true
	}

	return credentials.Value{
		AccessKeyID:     resp.AccessKeyID,
		SecretAccessKey: resp.SecretAccessKey,
		SessionToken:    resp.Token,
		ProviderName:    ProviderName,
	}, nil
}
1304151
func (s *AuthorizationsService) Get(ctx context.Context, id int64) (*Authorization, *Response, error) {
	u := fmt.Sprintf("authorizations/%d", id)

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	a := new(Authorization)
	resp, err := s.client.Do(ctx, req, a)
	if err != nil {
		return nil, resp, err
	}
	return a, resp, nil
}
704074
func (ed *ContainersEndpoint) Get(ctx context.Context, in *pb.ContainersRequest) (*pb.ContainersReply, error) {
	key, err := ed.getKey(in, ctx)
	if err != nil {
		return nil, err
	}
	data, err := ed.wch.Get(key)
	if err != nil {
		return nil, err
	}
	obj, _, err := ed.make(key, data)
	if err != nil {
		return nil, err
	}
	return obj, nil
}
728446
func (p *ApplicationCredentialsProvider) Retrieve() (Value, error) {
	p.retrieved = false

	filename, err := p.filename()
	if err != nil {
		return Value{}, err
	}

	f, err := os.Open(filename)
	if err != nil {
		return Value{}, err
	}
	defer f.Close()

	creds := Value{}
	if err := json.NewDecoder(f).Decode(&creds); err != nil {
		return Value{}, err
	}

	p.retrieved = true
	return creds, nil
}
1357759
func (c *Client) Get(ctx context.Context, container, key string) (body io.ReadCloser, size int64, err error) {
	req := newReq(ctx, c.keyURL(container, key))
	c.Auth.SignRequest(req)
	res, err := c.transport().RoundTrip(req)
	if err != nil {
		return
	}
	switch res.StatusCode {
	case http.StatusOK:
		return res.Body, res.ContentLength, nil
	case http.StatusNotFound:
		res.Body.Close()
		return nil, 0, os.ErrNotExist
	default:
		res.Body.Close()
		return nil, 0, fmt.Errorf("azure HTTP error on GET: %d", res.StatusCode)
	}
}
762590
func (el *EndpointsLock) Get() (*LeaderElectionRecord, error) {
	var record LeaderElectionRecord
	var err error
	el.e, err = el.Client.Endpoints(el.EndpointsMeta.Namespace).Get(el.EndpointsMeta.Name, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}
	if el.e.Annotations == nil {
		el.e.Annotations = make(map[string]string)
	}
	if recordBytes, found := el.e.Annotations[LeaderElectionRecordAnnotationKey]; found {
		if err := json.Unmarshal([]byte(recordBytes), &record); err != nil {
			return nil, err
		}
	}
	return &record, nil
}
1211378
func (self *InvoiceClient) Retrieve(id string) (*Invoice, error) {
	invoice := Invoice{}
	path := "/v1/invoices/" + url.QueryEscape(id)
	err := query("GET", path, nil, &invoice)
	return &invoice, err
}
1300450
func (ed *AppsEndpoint) Get(ctx context.Context, in *pb.AppsRequest) (*pb.AppsReply, error) {
	key, err := ed.getKey(in, ctx)
	if err != nil {
		return nil, err
	}
	data, err := ed.wch.Get(key)
	if err != nil {
		return nil, err
	}
	obj, _, err := ed.make(key, data)
	if err != nil {
		return nil, err
	}
	return obj, nil
}
1021931
func (c *Client) Get(endpoint string) (*RawResponse, error) {
	return c.getCancelable(endpoint, nil)
}
774265
func (c *EndpointCache) get(endpointKey string) (Endpoint, bool) {
	endpoint, ok := c.endpoints.Load(endpointKey)
	if !ok {
		return Endpoint{}, false
	}

	c.endpoints.Store(endpointKey, endpoint)
	return endpoint.(Endpoint), true
}
1249248
func (m *IAM) Retrieve() (Value, error) {
	endpoint, isEcsTask := getEndpoint(m.endpoint)
	var roleCreds ec2RoleCredRespBody
	var err error
	if isEcsTask {
		roleCreds, err = getEcsTaskCredentials(m.Client, endpoint)
	} else {
		roleCreds, err = getCredentials(m.Client, endpoint)
	}
	if err != nil {
		return Value{}, err
	}
	// Expiry window is set to 10secs.
	m.SetExpiration(roleCreds.Expiration, DefaultExpiryWindow)

	return Value{
		AccessKeyID:     roleCreds.AccessKeyID,
		SecretAccessKey: roleCreds.SecretAccessKey,
		SessionToken:    roleCreds.Token,
		SignerType:      SignatureV4,
	}, nil
}
1124925
func (s *Session) Get(key string) interface{} {
	return s.provider.db.Get(s.sid, key)
}
267539
func (c *Client) Get() *Request {
	return NewRequest(c.httpClient, c.base, "GET", c.version, c.authstring, c.userAgent)
}
39421
func (p ErrorProvider) Retrieve() (Value, error) {
	return Value{ProviderName: p.ProviderName}, p.Err
}
988485
func (self *PlanClient) Retrieve(id string) (*Plan, error) {
	plan := Plan{}
	path := "/v1/plans/" + url.QueryEscape(id)
	err := query("GET", path, nil, &plan)
	return &plan, err
}
757192
func (p *FileAWSCredentials) Retrieve() (Value, error) {
	if p.filename == "" {
		p.filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE")
		if p.filename == "" {
			homeDir, err := homedir.Dir()
			if err != nil {
				return Value{}, err
			}
			p.filename = filepath.Join(homeDir, ".aws", "credentials")
		}
	}
	if p.profile == "" {
		p.profile = os.Getenv("AWS_PROFILE")
		if p.profile == "" {
			p.profile = "default"
		}
	}

	p.retrieved = false

	iniProfile, err := loadProfile(p.filename, p.profile)
	if err != nil {
		return Value{}, err
	}

	// Default to empty string if not found.
	id := iniProfile.Key("aws_access_key_id")
	// Default to empty string if not found.
	secret := iniProfile.Key("aws_secret_access_key")
	// Default to empty string if not found.
	token := iniProfile.Key("aws_session_token")

	p.retrieved = true
	return Value{
		AccessKeyID:     id.String(),
		SecretAccessKey: secret.String(),
		SessionToken:    token.String(),
		SignerType:      SignatureV4,
	}, nil
}
1079478
func (hp *HTTP) Get(key *url.URL) (interface{}, error) {
	if pdebug.Enabled {
		g := pdebug.Marker("HTTP.Get(%s)", key)
		defer g.End()
	}

	switch strings.ToLower(key.Scheme) {
	case "http", "https":
	default:
		return nil, errors.New("key is not http/https URL")
	}

	v, err := hp.mp.Get(key)
	if err == nil { // Found!
		return v, nil
	}

	res, err := hp.Client.Get(key.String())
	if err != nil {
		return nil, errors.Wrap(err, "failed to fetch HTTP resource")
	}
	defer res.Body.Close()

	dec := json.NewDecoder(res.Body)

	var x interface{}
	if err := dec.Decode(&x); err != nil {
		return nil, errors.Wrap(err, "failed to parse JSON from HTTP resource")
	}

	return x, nil
}