mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-12-29 05:40:18 +01:00
68 lines
1.6 KiB
Go
68 lines
1.6 KiB
Go
|
// Package iamcredentials provides access to the IAM Service Account Credentials API.
|
||
|
//
|
||
|
// See https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
||
|
//
|
||
|
// Usage example:
|
||
|
//
|
||
|
// import "google.golang.org/api/iamcredentials/v1"
|
||
|
// ...
|
||
|
// iamcredentialsService, err := iamcredentials.New(oauthHttpClient)
|
||
|
package iamcredentials // import "google.golang.org/api/iamcredentials/v1"
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"encoding/json"
|
||
|
"errors"
|
||
|
"fmt"
|
||
|
context "golang.org/x/net/context"
|
||
|
ctxhttp "golang.org/x/net/context/ctxhttp"
|
||
|
gensupport "google.golang.org/api/gensupport"
|
||
|
googleapi "google.golang.org/api/googleapi"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
"net/url"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// Always reference these packages, just in case the auto-generated code
|
||
|
// below doesn't.
|
||
|
var _ = bytes.NewBuffer
|
||
|
var _ = strconv.Itoa
|
||
|
var _ = fmt.Sprintf
|
||
|
var _ = json.NewDecoder
|
||
|
var _ = io.Copy
|
||
|
var _ = url.Parse
|
||
|
var _ = gensupport.MarshalJSON
|
||
|
var _ = googleapi.Version
|
||
|
var _ = errors.New
|
||
|
var _ = strings.Replace
|
||
|
var _ = context.Canceled
|
||
|
var _ = ctxhttp.Do
|
||
|
|
||
|
const apiId = "iamcredentials:v1"
|
||
|
const apiName = "iamcredentials"
|
||
|
const apiVersion = "v1"
|
||
|
const basePath = "https://iamcredentials.googleapis.com/"
|
||
|
|
||
|
func New(client *http.Client) (*Service, error) {
|
||
|
if client == nil {
|
||
|
return nil, errors.New("client is nil")
|
||
|
}
|
||
|
s := &Service{client: client, BasePath: basePath}
|
||
|
return s, nil
|
||
|
}
|
||
|
|
||
|
type Service struct {
|
||
|
client *http.Client
|
||
|
BasePath string // API endpoint base URL
|
||
|
UserAgent string // optional additional User-Agent fragment
|
||
|
}
|
||
|
|
||
|
func (s *Service) userAgent() string {
|
||
|
if s.UserAgent == "" {
|
||
|
return googleapi.UserAgent
|
||
|
}
|
||
|
return googleapi.UserAgent + " " + s.UserAgent
|
||
|
}
|