// getMAASClient returns a MAAS client object to use for a request, in a
// lock-protected fashion.
773788
func (env *maasEnviron) getMAASClient() *gomaasapi.MAASObject {
	env.ecfgMutex.Lock()
	defer env.ecfgMutex.Unlock()

	return env.maasClientUnlocked
}
833784
func (a *AuthorizationRequest) GetClientID() string {
	if a == nil || a.ClientID == nil {
		return ""
	}
	return *a.ClientID
}
465775
func (c *Conn) getClient() (*StreamClient, error) {
	// Check for cached client
	c.clientLock.Lock()
	front := c.clients.Front()
	if front != nil {
		c.clients.Remove(front)
	}
	c.clientLock.Unlock()
	if front != nil {
		return front.Value.(*StreamClient), nil
	}

	// Open a new session
	stream, err := c.session.Open()
	if err != nil {
		return nil, err
	}

	// Create the RPC client
	codec := msgpackrpc.NewClientCodec(stream)

	// Return a new stream client
	sc := &StreamClient{
		stream: stream,
		codec:  codec,
	}
	return sc, nil
}
788467
func (c *Client) GetItem(accessToken string) (resp GetItemResponse, err error) {
	if accessToken == "" {
		return resp, errors.New("/item/get - access token must be specified")
	}

	jsonBody, err := json.Marshal(getItemRequest{
		ClientID:    c.clientID,
		Secret:      c.secret,
		AccessToken: accessToken,
	})

	if err != nil {
		return resp, err
	}

	err = c.Call("/item/get", jsonBody, &resp)
	return resp, err
}
1243454
func GetKubernetesClient() (kubernetes.Interface, error) {
	config, err := rest.InClusterConfig()
	if err != nil {
		return nil, err
	}

	return kubernetes.NewForConfig(config)
}
784588
func (cs *clientStore) getClients() map[string]*client {
	cs.RLock()
	defer cs.RUnlock()
	clients := make(map[string]*client, len(cs.clients))
	for _, c := range cs.clients {
		clients[c.info.ID] = c
	}
	return clients
}
853063
func GetClientConnection(ctx context.Context, addr string, port int) (*grpc.ClientConn, error) {
	return GetClientConnectionWithCreds(ctx, addr, port, nil)
}
899647
func GetClient(socket string, connectionTimeout time.Duration, maxMsgSize int) (podresourcesapi.PodResourcesListerClient, *grpc.ClientConn, error) {
	addr, dialer, err := util.GetAddressAndDialer(socket)
	if err != nil {
		return nil, nil, err
	}
	ctx, cancel := context.WithTimeout(context.Background(), connectionTimeout)
	defer cancel()

	conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dialer), grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)))
	if err != nil {
		return nil, nil, fmt.Errorf("Error dialing socket %s: %v", socket, err)
	}
	return podresourcesapi.NewPodResourcesListerClient(conn), conn, nil
}
644540
func (_m *APIClient) HTTPClient() *http.Client {
	ret := _m.Called()

	var r0 *http.Client
	if rf, ok := ret.Get(0).(func() *http.Client); ok {
		r0 = rf()
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*http.Client)
		}
	}

	return r0
}
615597
func Get(url string) (string, error) {
	// Init a new HTTP client
	client := &http.Client{}
	return GetWithClient(url, client)
}
1369170
func (n *Node) GetEthereumClient() (client *EthereumClient, _ error) {
	rpc, err := n.node.Attach()
	if err != nil {
		return nil, err
	}
	return &EthereumClient{ethclient.NewClient(rpc)}, nil
}
1129685
func (k *AWSKMSSeal) getAWSKMSClient() (*kms.KMS, error) {
	credsConfig := &awsutil.CredentialsConfig{}

	credsConfig.AccessKey = k.accessKey
	credsConfig.SecretKey = k.secretKey
	credsConfig.SessionToken = k.sessionToken
	credsConfig.Region = k.region

	credsConfig.HTTPClient = cleanhttp.DefaultClient()

	creds, err := credsConfig.GenerateCredentialChain()
	if err != nil {
		return nil, err
	}

	awsConfig := &aws.Config{
		Credentials: creds,
		Region:      aws.String(credsConfig.Region),
		HTTPClient:  cleanhttp.DefaultClient(),
	}

	if k.endpoint != "" {
		awsConfig.Endpoint = aws.String(k.endpoint)
	}

	sess, err := session.NewSession(awsConfig)
	if err != nil {
		return nil, err
	}

	client := kms.New(sess)

	return client, nil
}
1328459
func (k *K8sClientGetter) GetCoreClient() (corev1.CoreV1Interface, error) {
	client, err := k.GetClientset(constants.DefaultK8sClientTimeout)
	if err != nil {
		return nil, errors.Wrap(err, "getting clientset")
	}
	return client.Core(), nil
}
391516
func (ctl *taskController) GetClient(ctx context.Context, opts ...auth.RPCOption) (*http.Client, error) {
	opts = append(opts, auth.WithProject(ctl.saved.GetProjectID()))
	t, err := auth.GetRPCTransport(ctx, auth.AsProject, opts...)
	if err != nil {
		return nil, err
	}
	return &http.Client{Transport: t}, nil
}
551011
func (tc *serverTransportCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
	return nil, nil
}
735946
func (o *OAuthProvider) OAuth1Client(c *Context) *oauth.Consumer {

	if o.ID == "" {
		log.Error(errors.New("Can't get OAuth1Client – ID not set"))
		return nil
	}

	service := c.Service()
	config := service.DefaultOAuth1

	if config.AccessTokenReceiver == nil {
		log.Error(errors.New("Can't get OAuth1Client – AccessTokenReceiver not set"))

		return nil
	}

	config.Key = o.ID
	config.Secret = o.Secret
	config.AccessTokenURL = replaceBaseURL(config.AccessTokenURL, o.BaseURL)
	config.AuthorizeTokenURL = replaceBaseURL(config.AuthorizeTokenURL, o.BaseURL)
	config.RequestTokenURL = replaceBaseURL(config.RequestTokenURL, o.BaseURL)

	consumer := oauth.NewConsumer(
		o.ID,
		o.Secret,
		oauth.ServiceProvider{
			RequestTokenUrl:   config.RequestTokenURL,
			AuthorizeTokenUrl: config.AuthorizeTokenURL,
			AccessTokenUrl:    config.AccessTokenURL,
		},
	)
	consumer.AdditionalAuthorizationUrlParams = service.DefaultOAuth1.AdditionalAuthorizationURLParams
	return consumer
}
341471
func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) {
	result := &api.ServiceAccount{}
	err := s.client.Get().
		Namespace(s.namespace).
		Resource("serviceAccounts").
		Name(name).
		Do().
		Into(result)

	return result, err
}