id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
30,500
Azure/go-autorest
autorest/azure/auth/auth.go
GetClientCertificate
func (settings EnvironmentSettings) GetClientCertificate() (ClientCertificateConfig, error) { certPath := settings.Values[CertificatePath] if certPath == "" { return ClientCertificateConfig{}, errors.New("missing certificate path") } certPwd := settings.Values[CertificatePassword] clientID, tenantID := settings....
go
func (settings EnvironmentSettings) GetClientCertificate() (ClientCertificateConfig, error) { certPath := settings.Values[CertificatePath] if certPath == "" { return ClientCertificateConfig{}, errors.New("missing certificate path") } certPwd := settings.Values[CertificatePassword] clientID, tenantID := settings....
[ "func", "(", "settings", "EnvironmentSettings", ")", "GetClientCertificate", "(", ")", "(", "ClientCertificateConfig", ",", "error", ")", "{", "certPath", ":=", "settings", ".", "Values", "[", "CertificatePath", "]", "\n", "if", "certPath", "==", "\"", "\"", "...
// GetClientCertificate creates a config object from the available certificate credentials. // An error is returned if no certificate credentials are available.
[ "GetClientCertificate", "creates", "a", "config", "object", "from", "the", "available", "certificate", "credentials", ".", "An", "error", "is", "returned", "if", "no", "certificate", "credentials", "are", "available", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L153-L164
30,501
Azure/go-autorest
autorest/azure/auth/auth.go
GetMSI
func (settings EnvironmentSettings) GetMSI() MSIConfig { config := NewMSIConfig() config.Resource = settings.Values[Resource] config.ClientID = settings.Values[ClientID] return config }
go
func (settings EnvironmentSettings) GetMSI() MSIConfig { config := NewMSIConfig() config.Resource = settings.Values[Resource] config.ClientID = settings.Values[ClientID] return config }
[ "func", "(", "settings", "EnvironmentSettings", ")", "GetMSI", "(", ")", "MSIConfig", "{", "config", ":=", "NewMSIConfig", "(", ")", "\n", "config", ".", "Resource", "=", "settings", ".", "Values", "[", "Resource", "]", "\n", "config", ".", "ClientID", "="...
// GetMSI creates a MSI config object from the available client ID.
[ "GetMSI", "creates", "a", "MSI", "config", "object", "from", "the", "available", "client", "ID", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L182-L187
30,502
Azure/go-autorest
autorest/azure/auth/auth.go
GetDeviceFlow
func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig { clientID, tenantID := settings.getClientAndTenant() config := NewDeviceFlowConfig(clientID, tenantID) config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint config.Resource = settings.Values[Resource] return config }
go
func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig { clientID, tenantID := settings.getClientAndTenant() config := NewDeviceFlowConfig(clientID, tenantID) config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint config.Resource = settings.Values[Resource] return config }
[ "func", "(", "settings", "EnvironmentSettings", ")", "GetDeviceFlow", "(", ")", "DeviceFlowConfig", "{", "clientID", ",", "tenantID", ":=", "settings", ".", "getClientAndTenant", "(", ")", "\n", "config", ":=", "NewDeviceFlowConfig", "(", "clientID", ",", "tenantI...
// GetDeviceFlow creates a device-flow config object from the available client and tenant IDs.
[ "GetDeviceFlow", "creates", "a", "device", "-", "flow", "config", "object", "from", "the", "available", "client", "and", "tenant", "IDs", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L190-L196
30,503
Azure/go-autorest
autorest/azure/auth/auth.go
NewAuthorizerFromFile
func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) { settings, err := GetSettingsFromFile() if err != nil { return nil, err } if a, err := settings.ClientCredentialsAuthorizer(baseURI); err == nil { return a, err } if a, err := settings.ClientCertificateAuthorizer(baseURI); err == nil { ...
go
func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) { settings, err := GetSettingsFromFile() if err != nil { return nil, err } if a, err := settings.ClientCredentialsAuthorizer(baseURI); err == nil { return a, err } if a, err := settings.ClientCertificateAuthorizer(baseURI); err == nil { ...
[ "func", "NewAuthorizerFromFile", "(", "baseURI", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "settings", ",", "err", ":=", "GetSettingsFromFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "...
// NewAuthorizerFromFile creates an Authorizer configured from a configuration file in the following order. // 1. Client credentials // 2. Client certificate
[ "NewAuthorizerFromFile", "creates", "an", "Authorizer", "configured", "from", "a", "configuration", "file", "in", "the", "following", "order", ".", "1", ".", "Client", "credentials", "2", ".", "Client", "certificate" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L226-L238
30,504
Azure/go-autorest
autorest/azure/auth/auth.go
NewAuthorizerFromFileWithResource
func NewAuthorizerFromFileWithResource(resource string) (autorest.Authorizer, error) { s, err := GetSettingsFromFile() if err != nil { return nil, err } if a, err := s.ClientCredentialsAuthorizerWithResource(resource); err == nil { return a, err } if a, err := s.ClientCertificateAuthorizerWithResource(resourc...
go
func NewAuthorizerFromFileWithResource(resource string) (autorest.Authorizer, error) { s, err := GetSettingsFromFile() if err != nil { return nil, err } if a, err := s.ClientCredentialsAuthorizerWithResource(resource); err == nil { return a, err } if a, err := s.ClientCertificateAuthorizerWithResource(resourc...
[ "func", "NewAuthorizerFromFileWithResource", "(", "resource", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "s", ",", "err", ":=", "GetSettingsFromFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err...
// NewAuthorizerFromFileWithResource creates an Authorizer configured from a configuration file in the following order. // 1. Client credentials // 2. Client certificate
[ "NewAuthorizerFromFileWithResource", "creates", "an", "Authorizer", "configured", "from", "a", "configuration", "file", "in", "the", "following", "order", ".", "1", ".", "Client", "credentials", "2", ".", "Client", "certificate" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L243-L255
30,505
Azure/go-autorest
autorest/azure/auth/auth.go
NewAuthorizerFromCLI
func NewAuthorizerFromCLI() (autorest.Authorizer, error) { settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err } if settings.Values[Resource] == "" { settings.Values[Resource] = settings.Environment.ResourceManagerEndpoint } return NewAuthorizerFromCLIWithResource(settings.Values[R...
go
func NewAuthorizerFromCLI() (autorest.Authorizer, error) { settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err } if settings.Values[Resource] == "" { settings.Values[Resource] = settings.Environment.ResourceManagerEndpoint } return NewAuthorizerFromCLIWithResource(settings.Values[R...
[ "func", "NewAuthorizerFromCLI", "(", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "settings", ",", "err", ":=", "GetSettingsFromEnvironment", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n...
// NewAuthorizerFromCLI creates an Authorizer configured from Azure CLI 2.0 for local development scenarios.
[ "NewAuthorizerFromCLI", "creates", "an", "Authorizer", "configured", "from", "Azure", "CLI", "2", ".", "0", "for", "local", "development", "scenarios", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L258-L269
30,506
Azure/go-autorest
autorest/azure/auth/auth.go
NewAuthorizerFromCLIWithResource
func NewAuthorizerFromCLIWithResource(resource string) (autorest.Authorizer, error) { token, err := cli.GetTokenFromCLI(resource) if err != nil { return nil, err } adalToken, err := token.ToADALToken() if err != nil { return nil, err } return autorest.NewBearerAuthorizer(&adalToken), nil }
go
func NewAuthorizerFromCLIWithResource(resource string) (autorest.Authorizer, error) { token, err := cli.GetTokenFromCLI(resource) if err != nil { return nil, err } adalToken, err := token.ToADALToken() if err != nil { return nil, err } return autorest.NewBearerAuthorizer(&adalToken), nil }
[ "func", "NewAuthorizerFromCLIWithResource", "(", "resource", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "token", ",", "err", ":=", "cli", ".", "GetTokenFromCLI", "(", "resource", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// NewAuthorizerFromCLIWithResource creates an Authorizer configured from Azure CLI 2.0 for local development scenarios.
[ "NewAuthorizerFromCLIWithResource", "creates", "an", "Authorizer", "configured", "from", "Azure", "CLI", "2", ".", "0", "for", "local", "development", "scenarios", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L272-L284
30,507
Azure/go-autorest
autorest/azure/auth/auth.go
GetSettingsFromFile
func GetSettingsFromFile() (FileSettings, error) { s := FileSettings{} fileLocation := os.Getenv("AZURE_AUTH_LOCATION") if fileLocation == "" { return s, errors.New("environment variable AZURE_AUTH_LOCATION is not set") } contents, err := ioutil.ReadFile(fileLocation) if err != nil { return s, err } // Au...
go
func GetSettingsFromFile() (FileSettings, error) { s := FileSettings{} fileLocation := os.Getenv("AZURE_AUTH_LOCATION") if fileLocation == "" { return s, errors.New("environment variable AZURE_AUTH_LOCATION is not set") } contents, err := ioutil.ReadFile(fileLocation) if err != nil { return s, err } // Au...
[ "func", "GetSettingsFromFile", "(", ")", "(", "FileSettings", ",", "error", ")", "{", "s", ":=", "FileSettings", "{", "}", "\n", "fileLocation", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "fileLocation", "==", "\"", "\"", "{", "return...
// GetSettingsFromFile returns the available authentication settings from an Azure CLI authentication file.
[ "GetSettingsFromFile", "returns", "the", "available", "authentication", "settings", "from", "an", "Azure", "CLI", "authentication", "file", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L287-L325
30,508
Azure/go-autorest
autorest/azure/auth/auth.go
setKeyValue
func (settings FileSettings) setKeyValue(key string, val interface{}) { if val != nil { settings.Values[key] = val.(string) } }
go
func (settings FileSettings) setKeyValue(key string, val interface{}) { if val != nil { settings.Values[key] = val.(string) } }
[ "func", "(", "settings", "FileSettings", ")", "setKeyValue", "(", "key", "string", ",", "val", "interface", "{", "}", ")", "{", "if", "val", "!=", "nil", "{", "settings", ".", "Values", "[", "key", "]", "=", "val", ".", "(", "string", ")", "\n", "}...
// adds the specified value to the Values map if it isn't nil
[ "adds", "the", "specified", "value", "to", "the", "Values", "map", "if", "it", "isn", "t", "nil" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L338-L342
30,509
Azure/go-autorest
autorest/azure/auth/auth.go
getAADEndpoint
func (settings FileSettings) getAADEndpoint() string { if v, ok := settings.Values[ActiveDirectoryEndpoint]; ok { return v } return azure.PublicCloud.ActiveDirectoryEndpoint }
go
func (settings FileSettings) getAADEndpoint() string { if v, ok := settings.Values[ActiveDirectoryEndpoint]; ok { return v } return azure.PublicCloud.ActiveDirectoryEndpoint }
[ "func", "(", "settings", "FileSettings", ")", "getAADEndpoint", "(", ")", "string", "{", "if", "v", ",", "ok", ":=", "settings", ".", "Values", "[", "ActiveDirectoryEndpoint", "]", ";", "ok", "{", "return", "v", "\n", "}", "\n", "return", "azure", ".", ...
// returns the specified AAD endpoint or the public cloud endpoint if unspecified
[ "returns", "the", "specified", "AAD", "endpoint", "or", "the", "public", "cloud", "endpoint", "if", "unspecified" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L345-L350
30,510
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalTokenFromClientCredentials
func (settings FileSettings) ServicePrincipalTokenFromClientCredentials(baseURI string) (*adal.ServicePrincipalToken, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) }
go
func (settings FileSettings) ServicePrincipalTokenFromClientCredentials(baseURI string) (*adal.ServicePrincipalToken, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) }
[ "func", "(", "settings", "FileSettings", ")", "ServicePrincipalTokenFromClientCredentials", "(", "baseURI", "string", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "resource", ",", "err", ":=", "settings", ".", "getResourceForToken", ...
// ServicePrincipalTokenFromClientCredentials creates a ServicePrincipalToken from the available client credentials.
[ "ServicePrincipalTokenFromClientCredentials", "creates", "a", "ServicePrincipalToken", "from", "the", "available", "client", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L353-L359
30,511
Azure/go-autorest
autorest/azure/auth/auth.go
ClientCredentialsAuthorizer
func (settings FileSettings) ClientCredentialsAuthorizer(baseURI string) (autorest.Authorizer, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ClientCredentialsAuthorizerWithResource(resource) }
go
func (settings FileSettings) ClientCredentialsAuthorizer(baseURI string) (autorest.Authorizer, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ClientCredentialsAuthorizerWithResource(resource) }
[ "func", "(", "settings", "FileSettings", ")", "ClientCredentialsAuthorizer", "(", "baseURI", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "resource", ",", "err", ":=", "settings", ".", "getResourceForToken", "(", "baseURI", ")", "...
// ClientCredentialsAuthorizer creates an authorizer from the available client credentials.
[ "ClientCredentialsAuthorizer", "creates", "an", "authorizer", "from", "the", "available", "client", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L362-L368
30,512
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalTokenFromClientCredentialsWithResource
func (settings FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource(resource string) (*adal.ServicePrincipalToken, error) { if _, ok := settings.Values[ClientSecret]; !ok { return nil, errors.New("missing client secret") } config, err := adal.NewOAuthConfig(settings.getAADEndpoint(), settings.Value...
go
func (settings FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource(resource string) (*adal.ServicePrincipalToken, error) { if _, ok := settings.Values[ClientSecret]; !ok { return nil, errors.New("missing client secret") } config, err := adal.NewOAuthConfig(settings.getAADEndpoint(), settings.Value...
[ "func", "(", "settings", "FileSettings", ")", "ServicePrincipalTokenFromClientCredentialsWithResource", "(", "resource", "string", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "if", "_", ",", "ok", ":=", "settings", ".", "Values", ...
// ServicePrincipalTokenFromClientCredentialsWithResource creates a ServicePrincipalToken // from the available client credentials and the specified resource.
[ "ServicePrincipalTokenFromClientCredentialsWithResource", "creates", "a", "ServicePrincipalToken", "from", "the", "available", "client", "credentials", "and", "the", "specified", "resource", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L372-L381
30,513
Azure/go-autorest
autorest/azure/auth/auth.go
ClientCredentialsAuthorizerWithResource
func (settings FileSettings) ClientCredentialsAuthorizerWithResource(resource string) (autorest.Authorizer, error) { spToken, err := settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) if err != nil { return nil, err } return autorest.NewBearerAuthorizer(spToken), nil }
go
func (settings FileSettings) ClientCredentialsAuthorizerWithResource(resource string) (autorest.Authorizer, error) { spToken, err := settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) if err != nil { return nil, err } return autorest.NewBearerAuthorizer(spToken), nil }
[ "func", "(", "settings", "FileSettings", ")", "ClientCredentialsAuthorizerWithResource", "(", "resource", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "spToken", ",", "err", ":=", "settings", ".", "ServicePrincipalTokenFromClientCredentia...
// ClientCredentialsAuthorizerWithResource creates an authorizer from the available client credentials and the specified resource.
[ "ClientCredentialsAuthorizerWithResource", "creates", "an", "authorizer", "from", "the", "available", "client", "credentials", "and", "the", "specified", "resource", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L394-L400
30,514
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalTokenFromClientCertificate
func (settings FileSettings) ServicePrincipalTokenFromClientCertificate(baseURI string) (*adal.ServicePrincipalToken, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ServicePrincipalTokenFromClientCertificateWithResource(resource) }
go
func (settings FileSettings) ServicePrincipalTokenFromClientCertificate(baseURI string) (*adal.ServicePrincipalToken, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ServicePrincipalTokenFromClientCertificateWithResource(resource) }
[ "func", "(", "settings", "FileSettings", ")", "ServicePrincipalTokenFromClientCertificate", "(", "baseURI", "string", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "resource", ",", "err", ":=", "settings", ".", "getResourceForToken", ...
// ServicePrincipalTokenFromClientCertificate creates a ServicePrincipalToken from the available certificate credentials.
[ "ServicePrincipalTokenFromClientCertificate", "creates", "a", "ServicePrincipalToken", "from", "the", "available", "certificate", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L403-L409
30,515
Azure/go-autorest
autorest/azure/auth/auth.go
ClientCertificateAuthorizer
func (settings FileSettings) ClientCertificateAuthorizer(baseURI string) (autorest.Authorizer, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ClientCertificateAuthorizerWithResource(resource) }
go
func (settings FileSettings) ClientCertificateAuthorizer(baseURI string) (autorest.Authorizer, error) { resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } return settings.ClientCertificateAuthorizerWithResource(resource) }
[ "func", "(", "settings", "FileSettings", ")", "ClientCertificateAuthorizer", "(", "baseURI", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "resource", ",", "err", ":=", "settings", ".", "getResourceForToken", "(", "baseURI", ")", "...
// ClientCertificateAuthorizer creates an authorizer from the available certificate credentials.
[ "ClientCertificateAuthorizer", "creates", "an", "authorizer", "from", "the", "available", "certificate", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L412-L418
30,516
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalTokenFromClientCertificateWithResource
func (settings FileSettings) ServicePrincipalTokenFromClientCertificateWithResource(resource string) (*adal.ServicePrincipalToken, error) { cfg, err := settings.clientCertificateConfigWithResource(resource) if err != nil { return nil, err } return cfg.ServicePrincipalToken() }
go
func (settings FileSettings) ServicePrincipalTokenFromClientCertificateWithResource(resource string) (*adal.ServicePrincipalToken, error) { cfg, err := settings.clientCertificateConfigWithResource(resource) if err != nil { return nil, err } return cfg.ServicePrincipalToken() }
[ "func", "(", "settings", "FileSettings", ")", "ServicePrincipalTokenFromClientCertificateWithResource", "(", "resource", "string", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "cfg", ",", "err", ":=", "settings", ".", "clientCertifica...
// ServicePrincipalTokenFromClientCertificateWithResource creates a ServicePrincipalToken from the available certificate credentials.
[ "ServicePrincipalTokenFromClientCertificateWithResource", "creates", "a", "ServicePrincipalToken", "from", "the", "available", "certificate", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L421-L427
30,517
Azure/go-autorest
autorest/azure/auth/auth.go
ClientCertificateAuthorizerWithResource
func (settings FileSettings) ClientCertificateAuthorizerWithResource(resource string) (autorest.Authorizer, error) { cfg, err := settings.clientCertificateConfigWithResource(resource) if err != nil { return nil, err } return cfg.Authorizer() }
go
func (settings FileSettings) ClientCertificateAuthorizerWithResource(resource string) (autorest.Authorizer, error) { cfg, err := settings.clientCertificateConfigWithResource(resource) if err != nil { return nil, err } return cfg.Authorizer() }
[ "func", "(", "settings", "FileSettings", ")", "ClientCertificateAuthorizerWithResource", "(", "resource", "string", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "cfg", ",", "err", ":=", "settings", ".", "clientCertificateConfigWithResource", "(",...
// ClientCertificateAuthorizerWithResource creates an authorizer from the available certificate credentials and the specified resource.
[ "ClientCertificateAuthorizerWithResource", "creates", "an", "authorizer", "from", "the", "available", "certificate", "credentials", "and", "the", "specified", "resource", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L430-L436
30,518
Azure/go-autorest
autorest/azure/auth/auth.go
NewClientCredentialsConfig
func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string) ClientCredentialsConfig { return ClientCredentialsConfig{ ClientID: clientID, ClientSecret: clientSecret, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADEndpoint: azure.PublicCloud...
go
func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string) ClientCredentialsConfig { return ClientCredentialsConfig{ ClientID: clientID, ClientSecret: clientSecret, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADEndpoint: azure.PublicCloud...
[ "func", "NewClientCredentialsConfig", "(", "clientID", "string", ",", "clientSecret", "string", ",", "tenantID", "string", ")", "ClientCredentialsConfig", "{", "return", "ClientCredentialsConfig", "{", "ClientID", ":", "clientID", ",", "ClientSecret", ":", "clientSecret...
// NewClientCredentialsConfig creates an AuthorizerConfig object configured to obtain an Authorizer through Client Credentials. // Defaults to Public Cloud and Resource Manager Endpoint.
[ "NewClientCredentialsConfig", "creates", "an", "AuthorizerConfig", "object", "configured", "to", "obtain", "an", "Authorizer", "through", "Client", "Credentials", ".", "Defaults", "to", "Public", "Cloud", "and", "Resource", "Manager", "Endpoint", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L485-L493
30,519
Azure/go-autorest
autorest/azure/auth/auth.go
NewClientCertificateConfig
func NewClientCertificateConfig(certificatePath string, certificatePassword string, clientID string, tenantID string) ClientCertificateConfig { return ClientCertificateConfig{ CertificatePath: certificatePath, CertificatePassword: certificatePassword, ClientID: clientID, TenantID: ten...
go
func NewClientCertificateConfig(certificatePath string, certificatePassword string, clientID string, tenantID string) ClientCertificateConfig { return ClientCertificateConfig{ CertificatePath: certificatePath, CertificatePassword: certificatePassword, ClientID: clientID, TenantID: ten...
[ "func", "NewClientCertificateConfig", "(", "certificatePath", "string", ",", "certificatePassword", "string", ",", "clientID", "string", ",", "tenantID", "string", ")", "ClientCertificateConfig", "{", "return", "ClientCertificateConfig", "{", "CertificatePath", ":", "cert...
// NewClientCertificateConfig creates a ClientCertificateConfig object configured to obtain an Authorizer through client certificate. // Defaults to Public Cloud and Resource Manager Endpoint.
[ "NewClientCertificateConfig", "creates", "a", "ClientCertificateConfig", "object", "configured", "to", "obtain", "an", "Authorizer", "through", "client", "certificate", ".", "Defaults", "to", "Public", "Cloud", "and", "Resource", "Manager", "Endpoint", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L497-L506
30,520
Azure/go-autorest
autorest/azure/auth/auth.go
NewUsernamePasswordConfig
func NewUsernamePasswordConfig(username string, password string, clientID string, tenantID string) UsernamePasswordConfig { return UsernamePasswordConfig{ Username: username, Password: password, ClientID: clientID, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADE...
go
func NewUsernamePasswordConfig(username string, password string, clientID string, tenantID string) UsernamePasswordConfig { return UsernamePasswordConfig{ Username: username, Password: password, ClientID: clientID, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADE...
[ "func", "NewUsernamePasswordConfig", "(", "username", "string", ",", "password", "string", ",", "clientID", "string", ",", "tenantID", "string", ")", "UsernamePasswordConfig", "{", "return", "UsernamePasswordConfig", "{", "Username", ":", "username", ",", "Password", ...
// NewUsernamePasswordConfig creates an UsernamePasswordConfig object configured to obtain an Authorizer through username and password. // Defaults to Public Cloud and Resource Manager Endpoint.
[ "NewUsernamePasswordConfig", "creates", "an", "UsernamePasswordConfig", "object", "configured", "to", "obtain", "an", "Authorizer", "through", "username", "and", "password", ".", "Defaults", "to", "Public", "Cloud", "and", "Resource", "Manager", "Endpoint", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L510-L519
30,521
Azure/go-autorest
autorest/azure/auth/auth.go
NewDeviceFlowConfig
func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig { return DeviceFlowConfig{ ClientID: clientID, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint, } }
go
func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig { return DeviceFlowConfig{ ClientID: clientID, TenantID: tenantID, Resource: azure.PublicCloud.ResourceManagerEndpoint, AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint, } }
[ "func", "NewDeviceFlowConfig", "(", "clientID", "string", ",", "tenantID", "string", ")", "DeviceFlowConfig", "{", "return", "DeviceFlowConfig", "{", "ClientID", ":", "clientID", ",", "TenantID", ":", "tenantID", ",", "Resource", ":", "azure", ".", "PublicCloud", ...
// NewDeviceFlowConfig creates a DeviceFlowConfig object configured to obtain an Authorizer through device flow. // Defaults to Public Cloud and Resource Manager Endpoint.
[ "NewDeviceFlowConfig", "creates", "a", "DeviceFlowConfig", "object", "configured", "to", "obtain", "an", "Authorizer", "through", "device", "flow", ".", "Defaults", "to", "Public", "Cloud", "and", "Resource", "Manager", "Endpoint", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L530-L537
30,522
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalToken
func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) if err != nil { return nil, err } return adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) }
go
func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) if err != nil { return nil, err } return adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) }
[ "func", "(", "ccc", "ClientCredentialsConfig", ")", "ServicePrincipalToken", "(", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "oauthConfig", ",", "err", ":=", "adal", ".", "NewOAuthConfig", "(", "ccc", ".", "AADEndpoint", ",", ...
// ServicePrincipalToken creates a ServicePrincipalToken from client credentials.
[ "ServicePrincipalToken", "creates", "a", "ServicePrincipalToken", "from", "client", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L554-L560
30,523
Azure/go-autorest
autorest/azure/auth/auth.go
Authorizer
func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := ccc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from client credentials: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
go
func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := ccc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from client credentials: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
[ "func", "(", "ccc", "ClientCredentialsConfig", ")", "Authorizer", "(", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "spToken", ",", "err", ":=", "ccc", ".", "ServicePrincipalToken", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retu...
// Authorizer gets the authorizer from client credentials.
[ "Authorizer", "gets", "the", "authorizer", "from", "client", "credentials", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L563-L569
30,524
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalToken
func (ccc ClientCertificateConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) if err != nil { return nil, err } certData, err := ioutil.ReadFile(ccc.CertificatePath) if err != nil { return nil, fmt.Errorf("failed to read...
go
func (ccc ClientCertificateConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) if err != nil { return nil, err } certData, err := ioutil.ReadFile(ccc.CertificatePath) if err != nil { return nil, fmt.Errorf("failed to read...
[ "func", "(", "ccc", "ClientCertificateConfig", ")", "ServicePrincipalToken", "(", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "oauthConfig", ",", "err", ":=", "adal", ".", "NewOAuthConfig", "(", "ccc", ".", "AADEndpoint", ",", ...
// ServicePrincipalToken creates a ServicePrincipalToken from client certificate.
[ "ServicePrincipalToken", "creates", "a", "ServicePrincipalToken", "from", "client", "certificate", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L582-L596
30,525
Azure/go-autorest
autorest/azure/auth/auth.go
Authorizer
func (dfc DeviceFlowConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := dfc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
go
func (dfc DeviceFlowConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := dfc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
[ "func", "(", "dfc", "DeviceFlowConfig", ")", "Authorizer", "(", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "spToken", ",", "err", ":=", "dfc", ".", "ServicePrincipalToken", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// Authorizer gets the authorizer from device flow.
[ "Authorizer", "gets", "the", "authorizer", "from", "device", "flow", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L616-L622
30,526
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalToken
func (dfc DeviceFlowConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(dfc.AADEndpoint, dfc.TenantID) if err != nil { return nil, err } oauthClient := &autorest.Client{} deviceCode, err := adal.InitiateDeviceAuth(oauthClient, *oauthConfig, dfc.ClientID,...
go
func (dfc DeviceFlowConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(dfc.AADEndpoint, dfc.TenantID) if err != nil { return nil, err } oauthClient := &autorest.Client{} deviceCode, err := adal.InitiateDeviceAuth(oauthClient, *oauthConfig, dfc.ClientID,...
[ "func", "(", "dfc", "DeviceFlowConfig", ")", "ServicePrincipalToken", "(", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "oauthConfig", ",", "err", ":=", "adal", ".", "NewOAuthConfig", "(", "dfc", ".", "AADEndpoint", ",", "dfc"...
// ServicePrincipalToken gets the service principal token from device flow.
[ "ServicePrincipalToken", "gets", "the", "service", "principal", "token", "from", "device", "flow", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L625-L641
30,527
Azure/go-autorest
autorest/azure/auth/auth.go
ServicePrincipalToken
func (ups UsernamePasswordConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ups.AADEndpoint, ups.TenantID) if err != nil { return nil, err } return adal.NewServicePrincipalTokenFromUsernamePassword(*oauthConfig, ups.ClientID, ups.Username, ups.Password,...
go
func (ups UsernamePasswordConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ups.AADEndpoint, ups.TenantID) if err != nil { return nil, err } return adal.NewServicePrincipalTokenFromUsernamePassword(*oauthConfig, ups.ClientID, ups.Username, ups.Password,...
[ "func", "(", "ups", "UsernamePasswordConfig", ")", "ServicePrincipalToken", "(", ")", "(", "*", "adal", ".", "ServicePrincipalToken", ",", "error", ")", "{", "oauthConfig", ",", "err", ":=", "adal", ".", "NewOAuthConfig", "(", "ups", ".", "AADEndpoint", ",", ...
// ServicePrincipalToken creates a ServicePrincipalToken from username and password.
[ "ServicePrincipalToken", "creates", "a", "ServicePrincipalToken", "from", "username", "and", "password", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L668-L674
30,528
Azure/go-autorest
autorest/azure/auth/auth.go
Authorizer
func (ups UsernamePasswordConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := ups.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from username and password auth: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
go
func (ups UsernamePasswordConfig) Authorizer() (autorest.Authorizer, error) { spToken, err := ups.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from username and password auth: %v", err) } return autorest.NewBearerAuthorizer(spToken), nil }
[ "func", "(", "ups", "UsernamePasswordConfig", ")", "Authorizer", "(", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "spToken", ",", "err", ":=", "ups", ".", "ServicePrincipalToken", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// Authorizer gets the authorizer from a username and a password.
[ "Authorizer", "gets", "the", "authorizer", "from", "a", "username", "and", "a", "password", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L677-L683
30,529
Azure/go-autorest
autorest/azure/auth/auth.go
Authorizer
func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) { msiEndpoint, err := adal.GetMSIVMEndpoint() if err != nil { return nil, err } var spToken *adal.ServicePrincipalToken if mc.ClientID == "" { spToken, err = adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource) if err != nil { return...
go
func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) { msiEndpoint, err := adal.GetMSIVMEndpoint() if err != nil { return nil, err } var spToken *adal.ServicePrincipalToken if mc.ClientID == "" { spToken, err = adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource) if err != nil { return...
[ "func", "(", "mc", "MSIConfig", ")", "Authorizer", "(", ")", "(", "autorest", ".", "Authorizer", ",", "error", ")", "{", "msiEndpoint", ",", "err", ":=", "adal", ".", "GetMSIVMEndpoint", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// Authorizer gets the authorizer from MSI.
[ "Authorizer", "gets", "the", "authorizer", "from", "MSI", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/auth/auth.go#L692-L712
30,530
Azure/go-autorest
tracing/tracing.go
NewTransport
func NewTransport() *ochttp.Transport { return &ochttp.Transport{ Propagation: &tracecontext.HTTPFormat{}, GetStartOptions: getStartOptions, } }
go
func NewTransport() *ochttp.Transport { return &ochttp.Transport{ Propagation: &tracecontext.HTTPFormat{}, GetStartOptions: getStartOptions, } }
[ "func", "NewTransport", "(", ")", "*", "ochttp", ".", "Transport", "{", "return", "&", "ochttp", ".", "Transport", "{", "Propagation", ":", "&", "tracecontext", ".", "HTTPFormat", "{", "}", ",", "GetStartOptions", ":", "getStartOptions", ",", "}", "\n", "}...
// NewTransport returns a new instance of a tracing-aware RoundTripper.
[ "NewTransport", "returns", "a", "new", "instance", "of", "a", "tracing", "-", "aware", "RoundTripper", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L68-L73
30,531
Azure/go-autorest
tracing/tracing.go
Disable
func Disable() { disableStats() sampler = trace.NeverSample() if traceExporter != nil { trace.UnregisterExporter(traceExporter) } enabled = false }
go
func Disable() { disableStats() sampler = trace.NeverSample() if traceExporter != nil { trace.UnregisterExporter(traceExporter) } enabled = false }
[ "func", "Disable", "(", ")", "{", "disableStats", "(", ")", "\n", "sampler", "=", "trace", ".", "NeverSample", "(", ")", "\n", "if", "traceExporter", "!=", "nil", "{", "trace", ".", "UnregisterExporter", "(", "traceExporter", ")", "\n", "}", "\n", "enabl...
// Disable will disable instrumentation for metrics and traces.
[ "Disable", "will", "disable", "instrumentation", "for", "metrics", "and", "traces", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L90-L97
30,532
Azure/go-autorest
tracing/tracing.go
EnableWithAIForwarding
func EnableWithAIForwarding(agentEndpoint string) (err error) { err = Enable() if err != nil { return err } traceExporter, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agentEndpoint)) if err != nil { return err } trace.RegisterExporter(traceExporter) return }
go
func EnableWithAIForwarding(agentEndpoint string) (err error) { err = Enable() if err != nil { return err } traceExporter, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agentEndpoint)) if err != nil { return err } trace.RegisterExporter(traceExporter) return }
[ "func", "EnableWithAIForwarding", "(", "agentEndpoint", "string", ")", "(", "err", "error", ")", "{", "err", "=", "Enable", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "traceExporter", ",", "err", ":=", "ocagent", ...
// EnableWithAIForwarding will start instrumentation and will connect to app insights forwarder // exporter making the metrics and traces available in app insights.
[ "EnableWithAIForwarding", "will", "start", "instrumentation", "and", "will", "connect", "to", "app", "insights", "forwarder", "exporter", "making", "the", "metrics", "and", "traces", "available", "in", "app", "insights", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L101-L113
30,533
Azure/go-autorest
tracing/tracing.go
initStats
func initStats() (err error) { clientViews := []*view.View{ ochttp.ClientCompletedCount, ochttp.ClientRoundtripLatencyDistribution, ochttp.ClientReceivedBytesDistribution, ochttp.ClientSentBytesDistribution, } for _, cv := range clientViews { vn := fmt.Sprintf("Azure/go-autorest/tracing-%s", cv.Name) vie...
go
func initStats() (err error) { clientViews := []*view.View{ ochttp.ClientCompletedCount, ochttp.ClientRoundtripLatencyDistribution, ochttp.ClientReceivedBytesDistribution, ochttp.ClientSentBytesDistribution, } for _, cv := range clientViews { vn := fmt.Sprintf("Azure/go-autorest/tracing-%s", cv.Name) vie...
[ "func", "initStats", "(", ")", "(", "err", "error", ")", "{", "clientViews", ":=", "[", "]", "*", "view", ".", "View", "{", "ochttp", ".", "ClientCompletedCount", ",", "ochttp", ".", "ClientRoundtripLatencyDistribution", ",", "ochttp", ".", "ClientReceivedByte...
// initStats registers the views for the http metrics
[ "initStats", "registers", "the", "views", "for", "the", "http", "metrics" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L123-L139
30,534
Azure/go-autorest
tracing/tracing.go
StartSpan
func StartSpan(ctx context.Context, name string) context.Context { ctx, _ = trace.StartSpan(ctx, name, trace.WithSampler(sampler)) return ctx }
go
func StartSpan(ctx context.Context, name string) context.Context { ctx, _ = trace.StartSpan(ctx, name, trace.WithSampler(sampler)) return ctx }
[ "func", "StartSpan", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "context", ".", "Context", "{", "ctx", ",", "_", "=", "trace", ".", "StartSpan", "(", "ctx", ",", "name", ",", "trace", ".", "WithSampler", "(", "sampler", ")", "...
// StartSpan starts a trace span
[ "StartSpan", "starts", "a", "trace", "span" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L149-L152
30,535
Azure/go-autorest
tracing/tracing.go
EndSpan
func EndSpan(ctx context.Context, httpStatusCode int, err error) { span := trace.FromContext(ctx) if span == nil { return } if err != nil { span.SetStatus(trace.Status{Message: err.Error(), Code: toTraceStatusCode(httpStatusCode)}) } span.End() }
go
func EndSpan(ctx context.Context, httpStatusCode int, err error) { span := trace.FromContext(ctx) if span == nil { return } if err != nil { span.SetStatus(trace.Status{Message: err.Error(), Code: toTraceStatusCode(httpStatusCode)}) } span.End() }
[ "func", "EndSpan", "(", "ctx", "context", ".", "Context", ",", "httpStatusCode", "int", ",", "err", "error", ")", "{", "span", ":=", "trace", ".", "FromContext", "(", "ctx", ")", "\n\n", "if", "span", "==", "nil", "{", "return", "\n", "}", "\n\n", "i...
// EndSpan ends a previously started span stored in the context
[ "EndSpan", "ends", "a", "previously", "started", "span", "stored", "in", "the", "context" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/tracing/tracing.go#L155-L166
30,536
Azure/go-autorest
autorest/adal/persist.go
SaveToken
func SaveToken(path string, mode os.FileMode, token Token) error { dir := filepath.Dir(path) err := os.MkdirAll(dir, os.ModePerm) if err != nil { return fmt.Errorf("failed to create directory (%s) to store token in: %v", dir, err) } newFile, err := ioutil.TempFile(dir, "token") if err != nil { return fmt.Err...
go
func SaveToken(path string, mode os.FileMode, token Token) error { dir := filepath.Dir(path) err := os.MkdirAll(dir, os.ModePerm) if err != nil { return fmt.Errorf("failed to create directory (%s) to store token in: %v", dir, err) } newFile, err := ioutil.TempFile(dir, "token") if err != nil { return fmt.Err...
[ "func", "SaveToken", "(", "path", "string", ",", "mode", "os", ".", "FileMode", ",", "token", "Token", ")", "error", "{", "dir", ":=", "filepath", ".", "Dir", "(", "path", ")", "\n", "err", ":=", "os", ".", "MkdirAll", "(", "dir", ",", "os", ".", ...
// SaveToken persists an oauth token at the given location on disk. // It moves the new file into place so it can safely be used to replace an existing file // that maybe accessed by multiple processes.
[ "SaveToken", "persists", "an", "oauth", "token", "at", "the", "given", "location", "on", "disk", ".", "It", "moves", "the", "new", "file", "into", "place", "so", "it", "can", "safely", "be", "used", "to", "replace", "an", "existing", "file", "that", "may...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/persist.go#L45-L73
30,537
Azure/go-autorest
autorest/authorization.go
NewAPIKeyAuthorizer
func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer { return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters} }
go
func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer { return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters} }
[ "func", "NewAPIKeyAuthorizer", "(", "headers", "map", "[", "string", "]", "interface", "{", "}", ",", "queryParameters", "map", "[", "string", "]", "interface", "{", "}", ")", "*", "APIKeyAuthorizer", "{", "return", "&", "APIKeyAuthorizer", "{", "headers", "...
// NewAPIKeyAuthorizer creates an ApiKeyAuthorizer with headers.
[ "NewAPIKeyAuthorizer", "creates", "an", "ApiKeyAuthorizer", "with", "headers", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L71-L73
30,538
Azure/go-autorest
autorest/authorization.go
WithAuthorization
func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters)) } }
go
func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters)) } }
[ "func", "(", "aka", "*", "APIKeyAuthorizer", ")", "WithAuthorization", "(", ")", "PrepareDecorator", "{", "return", "func", "(", "p", "Preparer", ")", "Preparer", "{", "return", "DecoratePreparer", "(", "p", ",", "WithHeaders", "(", "aka", ".", "headers", ")...
// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Parameters.
[ "WithAuthorization", "returns", "a", "PrepareDecorator", "that", "adds", "an", "HTTP", "headers", "and", "Query", "Parameters", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L76-L80
30,539
Azure/go-autorest
autorest/authorization.go
WithAuthorization
func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) if err == nil { // the ordering is important here, prefer RefresherWithContext if available if refresher, ok :=...
go
func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) if err == nil { // the ordering is important here, prefer RefresherWithContext if available if refresher, ok :=...
[ "func", "(", "ba", "*", "BearerAuthorizer", ")", "WithAuthorization", "(", ")", "PrepareDecorator", "{", "return", "func", "(", "p", "Preparer", ")", "Preparer", "{", "return", "PreparerFunc", "(", "func", "(", "r", "*", "http", ".", "Request", ")", "(", ...
// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose // value is "Bearer " followed by the token. // // By default, the token will be automatically refreshed through the Refresher interface.
[ "WithAuthorization", "returns", "a", "PrepareDecorator", "that", "adds", "an", "HTTP", "Authorization", "header", "whose", "value", "is", "Bearer", "followed", "by", "the", "token", ".", "By", "default", "the", "token", "will", "be", "automatically", "refreshed", ...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L115-L139
30,540
Azure/go-autorest
autorest/authorization.go
NewBearerAuthorizerCallback
func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { if sender == nil { sender = &http.Client{Transport: tracing.Transport} } return &BearerAuthorizerCallback{sender: sender, callback: callback} }
go
func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { if sender == nil { sender = &http.Client{Transport: tracing.Transport} } return &BearerAuthorizerCallback{sender: sender, callback: callback} }
[ "func", "NewBearerAuthorizerCallback", "(", "sender", "Sender", ",", "callback", "BearerAuthorizerCallbackFunc", ")", "*", "BearerAuthorizerCallback", "{", "if", "sender", "==", "nil", "{", "sender", "=", "&", "http", ".", "Client", "{", "Transport", ":", "tracing...
// NewBearerAuthorizerCallback creates a bearer authorization callback. The callback // is invoked when the HTTP request is submitted.
[ "NewBearerAuthorizerCallback", "creates", "a", "bearer", "authorization", "callback", ".", "The", "callback", "is", "invoked", "when", "the", "HTTP", "request", "is", "submitted", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L152-L157
30,541
Azure/go-autorest
autorest/authorization.go
WithAuthorization
func (bacb *BearerAuthorizerCallback) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) if err == nil { // make a copy of the request and remove the body as it's not // required and avoids ...
go
func (bacb *BearerAuthorizerCallback) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) if err == nil { // make a copy of the request and remove the body as it's not // required and avoids ...
[ "func", "(", "bacb", "*", "BearerAuthorizerCallback", ")", "WithAuthorization", "(", ")", "PrepareDecorator", "{", "return", "func", "(", "p", "Preparer", ")", "Preparer", "{", "return", "PreparerFunc", "(", "func", "(", "r", "*", "http", ".", "Request", ")"...
// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose value // is "Bearer " followed by the token. The BearerAuthorizer is obtained via a user-supplied callback. // // By default, the token will be automatically refreshed through the Refresher interface.
[ "WithAuthorization", "returns", "a", "PrepareDecorator", "that", "adds", "an", "HTTP", "Authorization", "header", "whose", "value", "is", "Bearer", "followed", "by", "the", "token", ".", "The", "BearerAuthorizer", "is", "obtained", "via", "a", "user", "-", "supp...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L163-L194
30,542
Azure/go-autorest
autorest/authorization.go
hasBearerChallenge
func hasBearerChallenge(resp *http.Response) bool { authHeader := resp.Header.Get(bearerChallengeHeader) if len(authHeader) == 0 || strings.Index(authHeader, bearer) < 0 { return false } return true }
go
func hasBearerChallenge(resp *http.Response) bool { authHeader := resp.Header.Get(bearerChallengeHeader) if len(authHeader) == 0 || strings.Index(authHeader, bearer) < 0 { return false } return true }
[ "func", "hasBearerChallenge", "(", "resp", "*", "http", ".", "Response", ")", "bool", "{", "authHeader", ":=", "resp", ".", "Header", ".", "Get", "(", "bearerChallengeHeader", ")", "\n", "if", "len", "(", "authHeader", ")", "==", "0", "||", "strings", "....
// returns true if the HTTP response contains a bearer challenge
[ "returns", "true", "if", "the", "HTTP", "response", "contains", "a", "bearer", "challenge" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L197-L203
30,543
Azure/go-autorest
autorest/authorization.go
WithAuthorization
func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator { headers := map[string]interface{}{ "aeg-sas-key": egta.topicKey, } return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() }
go
func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator { headers := map[string]interface{}{ "aeg-sas-key": egta.topicKey, } return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() }
[ "func", "(", "egta", "EventGridKeyAuthorizer", ")", "WithAuthorization", "(", ")", "PrepareDecorator", "{", "headers", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "egta", ".", "topicKey", ",", "}", "\n", "return", "NewAPIK...
// WithAuthorization returns a PrepareDecorator that adds the aeg-sas-key authentication header.
[ "WithAuthorization", "returns", "a", "PrepareDecorator", "that", "adds", "the", "aeg", "-", "sas", "-", "key", "authentication", "header", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L258-L263
30,544
Azure/go-autorest
autorest/authorization.go
NewBasicAuthorizer
func NewBasicAuthorizer(userName, password string) *BasicAuthorizer { return &BasicAuthorizer{ userName: userName, password: password, } }
go
func NewBasicAuthorizer(userName, password string) *BasicAuthorizer { return &BasicAuthorizer{ userName: userName, password: password, } }
[ "func", "NewBasicAuthorizer", "(", "userName", ",", "password", "string", ")", "*", "BasicAuthorizer", "{", "return", "&", "BasicAuthorizer", "{", "userName", ":", "userName", ",", "password", ":", "password", ",", "}", "\n", "}" ]
// NewBasicAuthorizer creates a new BasicAuthorizer with the specified username and password.
[ "NewBasicAuthorizer", "creates", "a", "new", "BasicAuthorizer", "with", "the", "specified", "username", "and", "password", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/authorization.go#L273-L278
30,545
Azure/go-autorest
autorest/client.go
Do
func (c Client) Do(r *http.Request) (*http.Response, error) { if r.UserAgent() == "" { r, _ = Prepare(r, WithUserAgent(c.UserAgent)) } // NOTE: c.WithInspection() must be last in the list so that it can inspect all preceding operations r, err := Prepare(r, c.WithAuthorization(), c.WithInspection()) if err...
go
func (c Client) Do(r *http.Request) (*http.Response, error) { if r.UserAgent() == "" { r, _ = Prepare(r, WithUserAgent(c.UserAgent)) } // NOTE: c.WithInspection() must be last in the list so that it can inspect all preceding operations r, err := Prepare(r, c.WithAuthorization(), c.WithInspection()) if err...
[ "func", "(", "c", "Client", ")", "Do", "(", "r", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "r", ".", "UserAgent", "(", ")", "==", "\"", "\"", "{", "r", ",", "_", "=", "Prepare", "(", ...
// Do implements the Sender interface by invoking the active Sender after applying authorization. // If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent // is set, apply set the User-Agent header.
[ "Do", "implements", "the", "Sender", "interface", "by", "invoking", "the", "active", "Sender", "after", "applying", "authorization", ".", "If", "Sender", "is", "not", "set", "it", "uses", "a", "new", "instance", "of", "http", ".", "Client", ".", "In", "bot...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/client.go#L215-L246
30,546
Azure/go-autorest
autorest/client.go
sender
func (c Client) sender(renengotiation tls.RenegotiationSupport) Sender { if c.Sender == nil { // Use behaviour compatible with DefaultTransport, but require TLS minimum version. var defaultTransport = http.DefaultTransport.(*http.Transport) transport := tracing.Transport // for non-default values of TLS renego...
go
func (c Client) sender(renengotiation tls.RenegotiationSupport) Sender { if c.Sender == nil { // Use behaviour compatible with DefaultTransport, but require TLS minimum version. var defaultTransport = http.DefaultTransport.(*http.Transport) transport := tracing.Transport // for non-default values of TLS renego...
[ "func", "(", "c", "Client", ")", "sender", "(", "renengotiation", "tls", ".", "RenegotiationSupport", ")", "Sender", "{", "if", "c", ".", "Sender", "==", "nil", "{", "// Use behaviour compatible with DefaultTransport, but require TLS minimum version.", "var", "defaultTr...
// sender returns the Sender to which to send requests.
[ "sender", "returns", "the", "Sender", "to", "which", "to", "send", "requests", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/client.go#L249-L276
30,547
Azure/go-autorest
autorest/client.go
authorizer
func (c Client) authorizer() Authorizer { if c.Authorizer == nil { return NullAuthorizer{} } return c.Authorizer }
go
func (c Client) authorizer() Authorizer { if c.Authorizer == nil { return NullAuthorizer{} } return c.Authorizer }
[ "func", "(", "c", "Client", ")", "authorizer", "(", ")", "Authorizer", "{", "if", "c", ".", "Authorizer", "==", "nil", "{", "return", "NullAuthorizer", "{", "}", "\n", "}", "\n", "return", "c", ".", "Authorizer", "\n", "}" ]
// authorizer returns the Authorizer to use.
[ "authorizer", "returns", "the", "Authorizer", "to", "use", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/client.go#L285-L290
30,548
Azure/go-autorest
autorest/client.go
WithInspection
func (c Client) WithInspection() PrepareDecorator { if c.RequestInspector == nil { return WithNothing() } return c.RequestInspector }
go
func (c Client) WithInspection() PrepareDecorator { if c.RequestInspector == nil { return WithNothing() } return c.RequestInspector }
[ "func", "(", "c", "Client", ")", "WithInspection", "(", ")", "PrepareDecorator", "{", "if", "c", ".", "RequestInspector", "==", "nil", "{", "return", "WithNothing", "(", ")", "\n", "}", "\n", "return", "c", ".", "RequestInspector", "\n", "}" ]
// WithInspection is a convenience method that passes the request to the supplied RequestInspector, // if present, or returns the WithNothing PrepareDecorator otherwise.
[ "WithInspection", "is", "a", "convenience", "method", "that", "passes", "the", "request", "to", "the", "supplied", "RequestInspector", "if", "present", "or", "returns", "the", "WithNothing", "PrepareDecorator", "otherwise", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/client.go#L294-L299
30,549
Azure/go-autorest
autorest/client.go
ByInspecting
func (c Client) ByInspecting() RespondDecorator { if c.ResponseInspector == nil { return ByIgnoring() } return c.ResponseInspector }
go
func (c Client) ByInspecting() RespondDecorator { if c.ResponseInspector == nil { return ByIgnoring() } return c.ResponseInspector }
[ "func", "(", "c", "Client", ")", "ByInspecting", "(", ")", "RespondDecorator", "{", "if", "c", ".", "ResponseInspector", "==", "nil", "{", "return", "ByIgnoring", "(", ")", "\n", "}", "\n", "return", "c", ".", "ResponseInspector", "\n", "}" ]
// ByInspecting is a convenience method that passes the response to the supplied ResponseInspector, // if present, or returns the ByIgnoring RespondDecorator otherwise.
[ "ByInspecting", "is", "a", "convenience", "method", "that", "passes", "the", "response", "to", "the", "supplied", "ResponseInspector", "if", "present", "or", "returns", "the", "ByIgnoring", "RespondDecorator", "otherwise", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/client.go#L303-L308
30,550
Azure/go-autorest
logger/logger.go
ParseLevel
func ParseLevel(s string) (lt LevelType, err error) { switch strings.ToUpper(s) { case logFatal: lt = LogFatal case logPanic: lt = LogPanic case logError: lt = LogError case logWarning: lt = LogWarning case logInfo: lt = LogInfo case logDebug: lt = LogDebug default: err = fmt.Errorf("bad log level...
go
func ParseLevel(s string) (lt LevelType, err error) { switch strings.ToUpper(s) { case logFatal: lt = LogFatal case logPanic: lt = LogPanic case logError: lt = LogError case logWarning: lt = LogWarning case logInfo: lt = LogInfo case logDebug: lt = LogDebug default: err = fmt.Errorf("bad log level...
[ "func", "ParseLevel", "(", "s", "string", ")", "(", "lt", "LevelType", ",", "err", "error", ")", "{", "switch", "strings", ".", "ToUpper", "(", "s", ")", "{", "case", "logFatal", ":", "lt", "=", "LogFatal", "\n", "case", "logPanic", ":", "lt", "=", ...
// ParseLevel converts the specified string into the corresponding LevelType.
[ "ParseLevel", "converts", "the", "specified", "string", "into", "the", "corresponding", "LevelType", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/logger/logger.go#L72-L90
30,551
Azure/go-autorest
logger/logger.go
String
func (lt LevelType) String() string { switch lt { case LogNone: return logNone case LogFatal: return logFatal case LogPanic: return logPanic case LogError: return logError case LogWarning: return logWarning case LogInfo: return logInfo case LogDebug: return logDebug default: return logUnknown ...
go
func (lt LevelType) String() string { switch lt { case LogNone: return logNone case LogFatal: return logFatal case LogPanic: return logPanic case LogError: return logError case LogWarning: return logWarning case LogInfo: return logInfo case LogDebug: return logDebug default: return logUnknown ...
[ "func", "(", "lt", "LevelType", ")", "String", "(", ")", "string", "{", "switch", "lt", "{", "case", "LogNone", ":", "return", "logNone", "\n", "case", "LogFatal", ":", "return", "logFatal", "\n", "case", "LogPanic", ":", "return", "logPanic", "\n", "cas...
// String implements the stringer interface for LevelType.
[ "String", "implements", "the", "stringer", "interface", "for", "LevelType", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/logger/logger.go#L93-L112
30,552
Azure/go-autorest
logger/logger.go
shouldLogBody
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool { ct := header.Get("Content-Type") return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream") }
go
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool { ct := header.Get("Content-Type") return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream") }
[ "func", "(", "fl", "fileLogger", ")", "shouldLogBody", "(", "header", "http", ".", "Header", ",", "body", "io", ".", "ReadCloser", ")", "bool", "{", "ct", ":=", "header", ".", "Get", "(", "\"", "\"", ")", "\n", "return", "fl", ".", "logLevel", ">=", ...
// returns true if the provided body should be included in the log
[ "returns", "true", "if", "the", "provided", "body", "should", "be", "included", "in", "the", "log" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/logger/logger.go#L319-L322
30,553
Azure/go-autorest
logger/logger.go
entryHeader
func entryHeader(level LevelType) string { // this format provides a fixed number of digits so the size of the timestamp is constant return fmt.Sprintf("(%s) %s:", time.Now().Format("2006-01-02T15:04:05.0000000Z07:00"), level.String()) }
go
func entryHeader(level LevelType) string { // this format provides a fixed number of digits so the size of the timestamp is constant return fmt.Sprintf("(%s) %s:", time.Now().Format("2006-01-02T15:04:05.0000000Z07:00"), level.String()) }
[ "func", "entryHeader", "(", "level", "LevelType", ")", "string", "{", "// this format provides a fixed number of digits so the size of the timestamp is constant", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "time", ".", "Now", "(", ")", ".", "Format", "(", ...
// creates standard header for log entries, it contains a timestamp and the log level
[ "creates", "standard", "header", "for", "log", "entries", "it", "contains", "a", "timestamp", "and", "the", "log", "level" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/logger/logger.go#L325-L328
30,554
Azure/go-autorest
autorest/azure/rp.go
DoRetryWithRegistration
func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { return func(s autorest.Sender) autorest.Sender { return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { rr := autorest.NewRetriableRequest(r) for currentAttempt := 0; currentAttempt < client.RetryAttempts...
go
func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { return func(s autorest.Sender) autorest.Sender { return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) { rr := autorest.NewRetriableRequest(r) for currentAttempt := 0; currentAttempt < client.RetryAttempts...
[ "func", "DoRetryWithRegistration", "(", "client", "autorest", ".", "Client", ")", "autorest", ".", "SendDecorator", "{", "return", "func", "(", "s", "autorest", ".", "Sender", ")", "autorest", ".", "Sender", "{", "return", "autorest", ".", "SenderFunc", "(", ...
// DoRetryWithRegistration tries to register the resource provider in case it is unregistered. // It also handles request retries
[ "DoRetryWithRegistration", "tries", "to", "register", "the", "resource", "provider", "in", "case", "it", "is", "unregistered", ".", "It", "also", "handles", "request", "retries" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/azure/rp.go#L30-L70
30,555
Azure/go-autorest
autorest/mocks/helpers.go
NewRequestWithContent
func NewRequestWithContent(c string) *http.Request { r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBody(c)) return r }
go
func NewRequestWithContent(c string) *http.Request { r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBody(c)) return r }
[ "func", "NewRequestWithContent", "(", "c", "string", ")", "*", "http", ".", "Request", "{", "r", ",", "_", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "NewBody", "(", "c", ")", ")", "\n", "return", "r", "\n", "}" ]
// NewRequestWithContent instantiates a new request using the passed string for the body content.
[ "NewRequestWithContent", "instantiates", "a", "new", "request", "using", "the", "passed", "string", "for", "the", "body", "content", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L58-L61
30,556
Azure/go-autorest
autorest/mocks/helpers.go
NewRequestWithCloseBodyContent
func NewRequestWithCloseBodyContent(c string) *http.Request { r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBodyClose(c)) return r }
go
func NewRequestWithCloseBodyContent(c string) *http.Request { r, _ := http.NewRequest("GET", "https://microsoft.com/a/b/c/", NewBodyClose(c)) return r }
[ "func", "NewRequestWithCloseBodyContent", "(", "c", "string", ")", "*", "http", ".", "Request", "{", "r", ",", "_", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "NewBodyClose", "(", "c", ")", ")", "\n", "return", "r", "\n",...
// NewRequestWithCloseBodyContent instantiates a new request using the passed string for the body content.
[ "NewRequestWithCloseBodyContent", "instantiates", "a", "new", "request", "using", "the", "passed", "string", "for", "the", "body", "content", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L69-L72
30,557
Azure/go-autorest
autorest/mocks/helpers.go
NewRequestWithParams
func NewRequestWithParams(method, u string, body io.Reader) *http.Request { r, err := http.NewRequest(method, u, body) if err != nil { panic(fmt.Sprintf("mocks: ERROR (%v) parsing testing URL %s", err, u)) } return r }
go
func NewRequestWithParams(method, u string, body io.Reader) *http.Request { r, err := http.NewRequest(method, u, body) if err != nil { panic(fmt.Sprintf("mocks: ERROR (%v) parsing testing URL %s", err, u)) } return r }
[ "func", "NewRequestWithParams", "(", "method", ",", "u", "string", ",", "body", "io", ".", "Reader", ")", "*", "http", ".", "Request", "{", "r", ",", "err", ":=", "http", ".", "NewRequest", "(", "method", ",", "u", ",", "body", ")", "\n", "if", "er...
// NewRequestWithParams instantiates a new request using the provided parameters.
[ "NewRequestWithParams", "instantiates", "a", "new", "request", "using", "the", "provided", "parameters", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L80-L86
30,558
Azure/go-autorest
autorest/mocks/helpers.go
NewResponseWithContent
func NewResponseWithContent(c string) *http.Response { return &http.Response{ Status: "200 OK", StatusCode: 200, Proto: "HTTP/1.0", ProtoMajor: 1, ProtoMinor: 0, Body: NewBody(c), Request: NewRequest(), } }
go
func NewResponseWithContent(c string) *http.Response { return &http.Response{ Status: "200 OK", StatusCode: 200, Proto: "HTTP/1.0", ProtoMajor: 1, ProtoMinor: 0, Body: NewBody(c), Request: NewRequest(), } }
[ "func", "NewResponseWithContent", "(", "c", "string", ")", "*", "http", ".", "Response", "{", "return", "&", "http", ".", "Response", "{", "Status", ":", "\"", "\"", ",", "StatusCode", ":", "200", ",", "Proto", ":", "\"", "\"", ",", "ProtoMajor", ":", ...
// NewResponseWithContent instantiates a new response with the passed string as the body content.
[ "NewResponseWithContent", "instantiates", "a", "new", "response", "with", "the", "passed", "string", "as", "the", "body", "content", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L94-L104
30,559
Azure/go-autorest
autorest/mocks/helpers.go
NewResponseWithStatus
func NewResponseWithStatus(s string, c int) *http.Response { resp := NewResponse() resp.Status = s resp.StatusCode = c return resp }
go
func NewResponseWithStatus(s string, c int) *http.Response { resp := NewResponse() resp.Status = s resp.StatusCode = c return resp }
[ "func", "NewResponseWithStatus", "(", "s", "string", ",", "c", "int", ")", "*", "http", ".", "Response", "{", "resp", ":=", "NewResponse", "(", ")", "\n", "resp", ".", "Status", "=", "s", "\n", "resp", ".", "StatusCode", "=", "c", "\n", "return", "re...
// NewResponseWithStatus instantiates a new response using the passed string and integer as the // status and status code.
[ "NewResponseWithStatus", "instantiates", "a", "new", "response", "using", "the", "passed", "string", "and", "integer", "as", "the", "status", "and", "status", "code", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L108-L113
30,560
Azure/go-autorest
autorest/mocks/helpers.go
NewResponseWithBodyAndStatus
func NewResponseWithBodyAndStatus(body *Body, c int, s string) *http.Response { resp := NewResponse() resp.Body = body resp.ContentLength = body.Length() resp.Status = s resp.StatusCode = c return resp }
go
func NewResponseWithBodyAndStatus(body *Body, c int, s string) *http.Response { resp := NewResponse() resp.Body = body resp.ContentLength = body.Length() resp.Status = s resp.StatusCode = c return resp }
[ "func", "NewResponseWithBodyAndStatus", "(", "body", "*", "Body", ",", "c", "int", ",", "s", "string", ")", "*", "http", ".", "Response", "{", "resp", ":=", "NewResponse", "(", ")", "\n", "resp", ".", "Body", "=", "body", "\n", "resp", ".", "ContentLen...
// NewResponseWithBodyAndStatus instantiates a new response using the specified mock body, // status and status code
[ "NewResponseWithBodyAndStatus", "instantiates", "a", "new", "response", "using", "the", "specified", "mock", "body", "status", "and", "status", "code" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L117-L124
30,561
Azure/go-autorest
autorest/mocks/helpers.go
SetResponseHeader
func SetResponseHeader(resp *http.Response, h string, v string) { if resp.Header == nil { resp.Header = make(http.Header) } resp.Header.Set(h, v) }
go
func SetResponseHeader(resp *http.Response, h string, v string) { if resp.Header == nil { resp.Header = make(http.Header) } resp.Header.Set(h, v) }
[ "func", "SetResponseHeader", "(", "resp", "*", "http", ".", "Response", ",", "h", "string", ",", "v", "string", ")", "{", "if", "resp", ".", "Header", "==", "nil", "{", "resp", ".", "Header", "=", "make", "(", "http", ".", "Header", ")", "\n", "}",...
// SetResponseHeader adds a header to the passed response.
[ "SetResponseHeader", "adds", "a", "header", "to", "the", "passed", "response", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L127-L132
30,562
Azure/go-autorest
autorest/mocks/helpers.go
SetResponseHeaderValues
func SetResponseHeaderValues(resp *http.Response, h string, values []string) { if resp.Header == nil { resp.Header = make(http.Header) } for _, v := range values { resp.Header.Add(h, v) } }
go
func SetResponseHeaderValues(resp *http.Response, h string, values []string) { if resp.Header == nil { resp.Header = make(http.Header) } for _, v := range values { resp.Header.Add(h, v) } }
[ "func", "SetResponseHeaderValues", "(", "resp", "*", "http", ".", "Response", ",", "h", "string", ",", "values", "[", "]", "string", ")", "{", "if", "resp", ".", "Header", "==", "nil", "{", "resp", ".", "Header", "=", "make", "(", "http", ".", "Heade...
// SetResponseHeaderValues adds a header containing all the passed string values.
[ "SetResponseHeaderValues", "adds", "a", "header", "containing", "all", "the", "passed", "string", "values", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L135-L142
30,563
Azure/go-autorest
autorest/mocks/helpers.go
SetAcceptedHeaders
func SetAcceptedHeaders(resp *http.Response) { SetLocationHeader(resp, TestURL) SetRetryHeader(resp, TestDelay) }
go
func SetAcceptedHeaders(resp *http.Response) { SetLocationHeader(resp, TestURL) SetRetryHeader(resp, TestDelay) }
[ "func", "SetAcceptedHeaders", "(", "resp", "*", "http", ".", "Response", ")", "{", "SetLocationHeader", "(", "resp", ",", "TestURL", ")", "\n", "SetRetryHeader", "(", "resp", ",", "TestDelay", ")", "\n", "}" ]
// SetAcceptedHeaders adds the headers usually associated with a 202 Accepted response.
[ "SetAcceptedHeaders", "adds", "the", "headers", "usually", "associated", "with", "a", "202", "Accepted", "response", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L145-L148
30,564
Azure/go-autorest
autorest/mocks/helpers.go
SetLocationHeader
func SetLocationHeader(resp *http.Response, location string) { SetResponseHeader(resp, http.CanonicalHeaderKey(headerLocation), location) }
go
func SetLocationHeader(resp *http.Response, location string) { SetResponseHeader(resp, http.CanonicalHeaderKey(headerLocation), location) }
[ "func", "SetLocationHeader", "(", "resp", "*", "http", ".", "Response", ",", "location", "string", ")", "{", "SetResponseHeader", "(", "resp", ",", "http", ".", "CanonicalHeaderKey", "(", "headerLocation", ")", ",", "location", ")", "\n", "}" ]
// SetLocationHeader adds the Location header.
[ "SetLocationHeader", "adds", "the", "Location", "header", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L151-L153
30,565
Azure/go-autorest
autorest/mocks/helpers.go
SetRetryHeader
func SetRetryHeader(resp *http.Response, delay time.Duration) { SetResponseHeader(resp, http.CanonicalHeaderKey(headerRetryAfter), fmt.Sprintf("%v", delay.Seconds())) }
go
func SetRetryHeader(resp *http.Response, delay time.Duration) { SetResponseHeader(resp, http.CanonicalHeaderKey(headerRetryAfter), fmt.Sprintf("%v", delay.Seconds())) }
[ "func", "SetRetryHeader", "(", "resp", "*", "http", ".", "Response", ",", "delay", "time", ".", "Duration", ")", "{", "SetResponseHeader", "(", "resp", ",", "http", ".", "CanonicalHeaderKey", "(", "headerRetryAfter", ")", ",", "fmt", ".", "Sprintf", "(", "...
// SetRetryHeader adds the Retry-After header.
[ "SetRetryHeader", "adds", "the", "Retry", "-", "After", "header", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/helpers.go#L156-L158
30,566
Azure/go-autorest
autorest/utility.go
NewDecoder
func NewDecoder(encodedAs EncodedAs, r io.Reader) Decoder { if encodedAs == EncodedAsJSON { return json.NewDecoder(r) } else if encodedAs == EncodedAsXML { return xml.NewDecoder(r) } return nil }
go
func NewDecoder(encodedAs EncodedAs, r io.Reader) Decoder { if encodedAs == EncodedAsJSON { return json.NewDecoder(r) } else if encodedAs == EncodedAsXML { return xml.NewDecoder(r) } return nil }
[ "func", "NewDecoder", "(", "encodedAs", "EncodedAs", ",", "r", "io", ".", "Reader", ")", "Decoder", "{", "if", "encodedAs", "==", "EncodedAsJSON", "{", "return", "json", ".", "NewDecoder", "(", "r", ")", "\n", "}", "else", "if", "encodedAs", "==", "Encod...
// NewDecoder creates a new decoder appropriate to the passed encoding. // encodedAs specifies the type of encoding and r supplies the io.Reader containing the // encoded data.
[ "NewDecoder", "creates", "a", "new", "decoder", "appropriate", "to", "the", "passed", "encoding", ".", "encodedAs", "specifies", "the", "type", "of", "encoding", "and", "r", "supplies", "the", "io", ".", "Reader", "containing", "the", "encoded", "data", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/utility.go#L51-L58
30,567
Azure/go-autorest
autorest/utility.go
CopyAndDecode
func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffer, error) { b := bytes.Buffer{} return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v) }
go
func CopyAndDecode(encodedAs EncodedAs, r io.Reader, v interface{}) (bytes.Buffer, error) { b := bytes.Buffer{} return b, NewDecoder(encodedAs, io.TeeReader(r, &b)).Decode(v) }
[ "func", "CopyAndDecode", "(", "encodedAs", "EncodedAs", ",", "r", "io", ".", "Reader", ",", "v", "interface", "{", "}", ")", "(", "bytes", ".", "Buffer", ",", "error", ")", "{", "b", ":=", "bytes", ".", "Buffer", "{", "}", "\n", "return", "b", ",",...
// CopyAndDecode decodes the data from the passed io.Reader while making a copy. Having a copy // is especially useful if there is a chance the data will fail to decode. // encodedAs specifies the expected encoding, r provides the io.Reader to the data, and v // is the decoding destination.
[ "CopyAndDecode", "decodes", "the", "data", "from", "the", "passed", "io", ".", "Reader", "while", "making", "a", "copy", ".", "Having", "a", "copy", "is", "especially", "useful", "if", "there", "is", "a", "chance", "the", "data", "will", "fail", "to", "d...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/utility.go#L64-L67
30,568
Azure/go-autorest
autorest/utility.go
TeeReadCloser
func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser { return &teeReadCloser{rc, io.TeeReader(rc, w)} }
go
func TeeReadCloser(rc io.ReadCloser, w io.Writer) io.ReadCloser { return &teeReadCloser{rc, io.TeeReader(rc, w)} }
[ "func", "TeeReadCloser", "(", "rc", "io", ".", "ReadCloser", ",", "w", "io", ".", "Writer", ")", "io", ".", "ReadCloser", "{", "return", "&", "teeReadCloser", "{", "rc", ",", "io", ".", "TeeReader", "(", "rc", ",", "w", ")", "}", "\n", "}" ]
// TeeReadCloser returns a ReadCloser that writes to w what it reads from rc. // It utilizes io.TeeReader to copy the data read and has the same behavior when reading. // Further, when it is closed, it ensures that rc is closed as well.
[ "TeeReadCloser", "returns", "a", "ReadCloser", "that", "writes", "to", "w", "what", "it", "reads", "from", "rc", ".", "It", "utilizes", "io", ".", "TeeReader", "to", "copy", "the", "data", "read", "and", "has", "the", "same", "behavior", "when", "reading",...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/utility.go#L72-L74
30,569
Azure/go-autorest
autorest/utility.go
Encode
func Encode(location string, v interface{}, sep ...string) string { s := String(v, sep...) switch strings.ToLower(location) { case "path": return pathEscape(s) case "query": return queryEscape(s) default: return s } }
go
func Encode(location string, v interface{}, sep ...string) string { s := String(v, sep...) switch strings.ToLower(location) { case "path": return pathEscape(s) case "query": return queryEscape(s) default: return s } }
[ "func", "Encode", "(", "location", "string", ",", "v", "interface", "{", "}", ",", "sep", "...", "string", ")", "string", "{", "s", ":=", "String", "(", "v", ",", "sep", "...", ")", "\n", "switch", "strings", ".", "ToLower", "(", "location", ")", "...
// Encode method encodes url path and query parameters.
[ "Encode", "method", "encodes", "url", "path", "and", "query", "parameters", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/utility.go#L178-L188
30,570
Azure/go-autorest
autorest/utility.go
IsTokenRefreshError
func IsTokenRefreshError(err error) bool { if _, ok := err.(adal.TokenRefreshError); ok { return true } if de, ok := err.(DetailedError); ok { return IsTokenRefreshError(de.Original) } return false }
go
func IsTokenRefreshError(err error) bool { if _, ok := err.(adal.TokenRefreshError); ok { return true } if de, ok := err.(DetailedError); ok { return IsTokenRefreshError(de.Original) } return false }
[ "func", "IsTokenRefreshError", "(", "err", "error", ")", "bool", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "adal", ".", "TokenRefreshError", ")", ";", "ok", "{", "return", "true", "\n", "}", "\n", "if", "de", ",", "ok", ":=", "err", ".", ...
// IsTokenRefreshError returns true if the specified error implements the TokenRefreshError // interface. If err is a DetailedError it will walk the chain of Original errors.
[ "IsTokenRefreshError", "returns", "true", "if", "the", "specified", "error", "implements", "the", "TokenRefreshError", "interface", ".", "If", "err", "is", "a", "DetailedError", "it", "will", "walk", "the", "chain", "of", "Original", "errors", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/utility.go#L211-L219
30,571
Azure/go-autorest
autorest/adal/token.go
Expires
func (t Token) Expires() time.Time { s, err := t.ExpiresOn.Float64() if err != nil { s = -3600 } expiration := date.NewUnixTimeFromSeconds(s) return time.Time(expiration).UTC() }
go
func (t Token) Expires() time.Time { s, err := t.ExpiresOn.Float64() if err != nil { s = -3600 } expiration := date.NewUnixTimeFromSeconds(s) return time.Time(expiration).UTC() }
[ "func", "(", "t", "Token", ")", "Expires", "(", ")", "time", ".", "Time", "{", "s", ",", "err", ":=", "t", ".", "ExpiresOn", ".", "Float64", "(", ")", "\n", "if", "err", "!=", "nil", "{", "s", "=", "-", "3600", "\n", "}", "\n\n", "expiration", ...
// Expires returns the time.Time when the Token expires.
[ "Expires", "returns", "the", "time", ".", "Time", "when", "the", "Token", "expires", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L126-L135
30,572
Azure/go-autorest
autorest/adal/token.go
WillExpireIn
func (t Token) WillExpireIn(d time.Duration) bool { return !t.Expires().After(time.Now().Add(d)) }
go
func (t Token) WillExpireIn(d time.Duration) bool { return !t.Expires().After(time.Now().Add(d)) }
[ "func", "(", "t", "Token", ")", "WillExpireIn", "(", "d", "time", ".", "Duration", ")", "bool", "{", "return", "!", "t", ".", "Expires", "(", ")", ".", "After", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "d", ")", ")", "\n", "}" ]
// WillExpireIn returns true if the Token will expire after the passed time.Duration interval // from now, false otherwise.
[ "WillExpireIn", "returns", "true", "if", "the", "Token", "will", "expire", "after", "the", "passed", "time", ".", "Duration", "interval", "from", "now", "false", "otherwise", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L144-L146
30,573
Azure/go-autorest
autorest/adal/token.go
SetAuthenticationValues
func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") }
go
func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") }
[ "func", "(", "noSecret", "*", "ServicePrincipalNoSecret", ")", "SetAuthenticationValues", "(", "spt", "*", "ServicePrincipalToken", ",", "v", "*", "url", ".", "Values", ")", "error", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret // It only returns an error for the ServicePrincipalNoSecret type
[ "SetAuthenticationValues", "is", "a", "method", "of", "the", "interface", "ServicePrincipalSecret", "It", "only", "returns", "an", "error", "for", "the", "ServicePrincipalNoSecret", "type" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L166-L168
30,574
Azure/go-autorest
autorest/adal/token.go
SetAuthenticationValues
func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { v.Set("client_secret", tokenSecret.ClientSecret) return nil }
go
func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { v.Set("client_secret", tokenSecret.ClientSecret) return nil }
[ "func", "(", "tokenSecret", "*", "ServicePrincipalTokenSecret", ")", "SetAuthenticationValues", "(", "spt", "*", "ServicePrincipalToken", ",", "v", "*", "url", ".", "Values", ")", "error", "{", "v", ".", "Set", "(", "\"", "\"", ",", "tokenSecret", ".", "Clie...
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. // It will populate the form submitted during oAuth Token Acquisition using the client_secret.
[ "SetAuthenticationValues", "is", "a", "method", "of", "the", "interface", "ServicePrincipalSecret", ".", "It", "will", "populate", "the", "form", "submitted", "during", "oAuth", "Token", "Acquisition", "using", "the", "client_secret", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L187-L190
30,575
Azure/go-autorest
autorest/adal/token.go
SignJwt
func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { hasher := sha1.New() _, err := hasher.Write(secret.Certificate.Raw) if err != nil { return "", err } thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) // The jti (JWT ID) claim provides a uniq...
go
func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { hasher := sha1.New() _, err := hasher.Write(secret.Certificate.Raw) if err != nil { return "", err } thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) // The jti (JWT ID) claim provides a uniq...
[ "func", "(", "secret", "*", "ServicePrincipalCertificateSecret", ")", "SignJwt", "(", "spt", "*", "ServicePrincipalToken", ")", "(", "string", ",", "error", ")", "{", "hasher", ":=", "sha1", ".", "New", "(", ")", "\n", "_", ",", "err", ":=", "hasher", "....
// SignJwt returns the JWT signed with the certificate's private key.
[ "SignJwt", "returns", "the", "JWT", "signed", "with", "the", "certificate", "s", "private", "key", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L211-L242
30,576
Azure/go-autorest
autorest/adal/token.go
SetAuthenticationValues
func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { jwt, err := secret.SignJwt(spt) if err != nil { return err } v.Set("client_assertion", jwt) v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") return...
go
func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { jwt, err := secret.SignJwt(spt) if err != nil { return err } v.Set("client_assertion", jwt) v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") return...
[ "func", "(", "secret", "*", "ServicePrincipalCertificateSecret", ")", "SetAuthenticationValues", "(", "spt", "*", "ServicePrincipalToken", ",", "v", "*", "url", ".", "Values", ")", "error", "{", "jwt", ",", "err", ":=", "secret", ".", "SignJwt", "(", "spt", ...
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. // It will populate the form submitted during oAuth Token Acquisition using a JWT signed with a certificate.
[ "SetAuthenticationValues", "is", "a", "method", "of", "the", "interface", "ServicePrincipalSecret", ".", "It", "will", "populate", "the", "form", "submitted", "during", "oAuth", "Token", "Acquisition", "using", "a", "JWT", "signed", "with", "a", "certificate", "."...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L246-L255
30,577
Azure/go-autorest
autorest/adal/token.go
MarshalTokenJSON
func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { return json.Marshal(spt.inner.Token) }
go
func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { return json.Marshal(spt.inner.Token) }
[ "func", "(", "spt", "ServicePrincipalToken", ")", "MarshalTokenJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "json", ".", "Marshal", "(", "spt", ".", "inner", ".", "Token", ")", "\n", "}" ]
// MarshalTokenJSON returns the marshalled inner token.
[ "MarshalTokenJSON", "returns", "the", "marshalled", "inner", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L345-L347
30,578
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenWithSecret
func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(id, "id"); err !=...
go
func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(id, "id"); err !=...
[ "func", "NewServicePrincipalTokenWithSecret", "(", "oauthConfig", "OAuthConfig", ",", "id", "string", ",", "resource", "string", ",", "secret", "ServicePrincipalSecret", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "ServicePrincipalToken", ",", "error...
// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation.
[ "NewServicePrincipalTokenWithSecret", "create", "a", "ServicePrincipalToken", "using", "the", "supplied", "ServicePrincipalSecret", "implementation", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L417-L445
30,579
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromManualToken
func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(clientID, "clientID"); e...
go
func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(clientID, "clientID"); e...
[ "func", "NewServicePrincipalTokenFromManualToken", "(", "oauthConfig", "OAuthConfig", ",", "clientID", "string", ",", "resource", "string", ",", "token", "Token", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "ServicePrincipalToken", ",", "error", ")...
// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token
[ "NewServicePrincipalTokenFromManualToken", "creates", "a", "ServicePrincipalToken", "using", "the", "supplied", "token" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L448-L474
30,580
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalToken
func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(clientID, "clientID"); err != nil { ...
go
func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringParam(clientID, "clientID"); err != nil { ...
[ "func", "NewServicePrincipalToken", "(", "oauthConfig", "OAuthConfig", ",", "clientID", "string", ",", "secret", "string", ",", "resource", "string", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "ServicePrincipalToken", ",", "error", ")", "{", "...
// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal // credentials scoped to the named resource.
[ "NewServicePrincipalToken", "creates", "a", "ServicePrincipalToken", "from", "the", "supplied", "Service", "Principal", "credentials", "scoped", "to", "the", "named", "resource", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L510-L532
30,581
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromCertificate
func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err :...
go
func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err :...
[ "func", "NewServicePrincipalTokenFromCertificate", "(", "oauthConfig", "OAuthConfig", ",", "clientID", "string", ",", "certificate", "*", "x509", ".", "Certificate", ",", "privateKey", "*", "rsa", ".", "PrivateKey", ",", "resource", "string", ",", "callbacks", "..."...
// NewServicePrincipalTokenFromCertificate creates a ServicePrincipalToken from the supplied pkcs12 bytes.
[ "NewServicePrincipalTokenFromCertificate", "creates", "a", "ServicePrincipalToken", "from", "the", "supplied", "pkcs12", "bytes", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L535-L561
30,582
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromUsernamePassword
func NewServicePrincipalTokenFromUsernamePassword(oauthConfig OAuthConfig, clientID string, username string, password string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringPara...
go
func NewServicePrincipalTokenFromUsernamePassword(oauthConfig OAuthConfig, clientID string, username string, password string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, err } if err := validateStringPara...
[ "func", "NewServicePrincipalTokenFromUsernamePassword", "(", "oauthConfig", "OAuthConfig", ",", "clientID", "string", ",", "username", "string", ",", "password", "string", ",", "resource", "string", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "Serv...
// NewServicePrincipalTokenFromUsernamePassword creates a ServicePrincipalToken from the username and password.
[ "NewServicePrincipalTokenFromUsernamePassword", "creates", "a", "ServicePrincipalToken", "from", "the", "username", "and", "password", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L564-L590
30,583
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromAuthorizationCode
func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clientID string, clientSecret string, authorizationCode string, redirectURI string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, e...
go
func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clientID string, clientSecret string, authorizationCode string, redirectURI string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { if err := validateOAuthConfig(oauthConfig); err != nil { return nil, e...
[ "func", "NewServicePrincipalTokenFromAuthorizationCode", "(", "oauthConfig", "OAuthConfig", ",", "clientID", "string", ",", "clientSecret", "string", ",", "authorizationCode", "string", ",", "redirectURI", "string", ",", "resource", "string", ",", "callbacks", "...", "T...
// NewServicePrincipalTokenFromAuthorizationCode creates a ServicePrincipalToken from the
[ "NewServicePrincipalTokenFromAuthorizationCode", "creates", "a", "ServicePrincipalToken", "from", "the" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L593-L625
30,584
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromMSI
func NewServicePrincipalTokenFromMSI(msiEndpoint, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { return newServicePrincipalTokenFromMSI(msiEndpoint, resource, nil, callbacks...) }
go
func NewServicePrincipalTokenFromMSI(msiEndpoint, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { return newServicePrincipalTokenFromMSI(msiEndpoint, resource, nil, callbacks...) }
[ "func", "NewServicePrincipalTokenFromMSI", "(", "msiEndpoint", ",", "resource", "string", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "ServicePrincipalToken", ",", "error", ")", "{", "return", "newServicePrincipalTokenFromMSI", "(", "msiEndpoint", ",...
// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. // It will use the system assigned identity when creating the token.
[ "NewServicePrincipalTokenFromMSI", "creates", "a", "ServicePrincipalToken", "via", "the", "MSI", "VM", "Extension", ".", "It", "will", "use", "the", "system", "assigned", "identity", "when", "creating", "the", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L634-L636
30,585
Azure/go-autorest
autorest/adal/token.go
NewServicePrincipalTokenFromMSIWithUserAssignedID
func NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, resource string, userAssignedID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { return newServicePrincipalTokenFromMSI(msiEndpoint, resource, &userAssignedID, callbacks...) }
go
func NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, resource string, userAssignedID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { return newServicePrincipalTokenFromMSI(msiEndpoint, resource, &userAssignedID, callbacks...) }
[ "func", "NewServicePrincipalTokenFromMSIWithUserAssignedID", "(", "msiEndpoint", ",", "resource", "string", ",", "userAssignedID", "string", ",", "callbacks", "...", "TokenRefreshCallback", ")", "(", "*", "ServicePrincipalToken", ",", "error", ")", "{", "return", "newSe...
// NewServicePrincipalTokenFromMSIWithUserAssignedID creates a ServicePrincipalToken via the MSI VM Extension. // It will use the specified user assigned identity when creating the token.
[ "NewServicePrincipalTokenFromMSIWithUserAssignedID", "creates", "a", "ServicePrincipalToken", "via", "the", "MSI", "VM", "Extension", ".", "It", "will", "use", "the", "specified", "user", "assigned", "identity", "when", "creating", "the", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L640-L642
30,586
Azure/go-autorest
autorest/adal/token.go
InvokeRefreshCallbacks
func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { if spt.refreshCallbacks != nil { for _, callback := range spt.refreshCallbacks { err := callback(spt.inner.Token) if err != nil { return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) } } } retu...
go
func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { if spt.refreshCallbacks != nil { for _, callback := range spt.refreshCallbacks { err := callback(spt.inner.Token) if err != nil { return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) } } } retu...
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "InvokeRefreshCallbacks", "(", "token", "Token", ")", "error", "{", "if", "spt", ".", "refreshCallbacks", "!=", "nil", "{", "for", "_", ",", "callback", ":=", "range", "spt", ".", "refreshCallbacks", "{"...
// InvokeRefreshCallbacks calls any TokenRefreshCallbacks that were added to the SPT during initialization
[ "InvokeRefreshCallbacks", "calls", "any", "TokenRefreshCallbacks", "that", "were", "added", "to", "the", "SPT", "during", "initialization" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L735-L745
30,587
Azure/go-autorest
autorest/adal/token.go
RefreshWithContext
func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() return spt.refreshInternal(ctx, spt.inner.Resource) }
go
func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() return spt.refreshInternal(ctx, spt.inner.Resource) }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "RefreshWithContext", "(", "ctx", "context", ".", "Context", ")", "error", "{", "spt", ".", "refreshLock", ".", "Lock", "(", ")", "\n", "defer", "spt", ".", "refreshLock", ".", "Unlock", "(", ")", "\...
// RefreshWithContext obtains a fresh token for the Service Principal. // This method is not safe for concurrent use and should be syncrhonized.
[ "RefreshWithContext", "obtains", "a", "fresh", "token", "for", "the", "Service", "Principal", ".", "This", "method", "is", "not", "safe", "for", "concurrent", "use", "and", "should", "be", "syncrhonized", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L755-L759
30,588
Azure/go-autorest
autorest/adal/token.go
RefreshExchange
func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { return spt.RefreshExchangeWithContext(context.Background(), resource) }
go
func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { return spt.RefreshExchangeWithContext(context.Background(), resource) }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "RefreshExchange", "(", "resource", "string", ")", "error", "{", "return", "spt", ".", "RefreshExchangeWithContext", "(", "context", ".", "Background", "(", ")", ",", "resource", ")", "\n", "}" ]
// RefreshExchange refreshes the token, but for a different resource. // This method is not safe for concurrent use and should be syncrhonized.
[ "RefreshExchange", "refreshes", "the", "token", "but", "for", "a", "different", "resource", ".", "This", "method", "is", "not", "safe", "for", "concurrent", "use", "and", "should", "be", "syncrhonized", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L763-L765
30,589
Azure/go-autorest
autorest/adal/token.go
RefreshExchangeWithContext
func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() return spt.refreshInternal(ctx, resource) }
go
func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { spt.refreshLock.Lock() defer spt.refreshLock.Unlock() return spt.refreshInternal(ctx, resource) }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "RefreshExchangeWithContext", "(", "ctx", "context", ".", "Context", ",", "resource", "string", ")", "error", "{", "spt", ".", "refreshLock", ".", "Lock", "(", ")", "\n", "defer", "spt", ".", "refreshLoc...
// RefreshExchangeWithContext refreshes the token, but for a different resource. // This method is not safe for concurrent use and should be syncrhonized.
[ "RefreshExchangeWithContext", "refreshes", "the", "token", "but", "for", "a", "different", "resource", ".", "This", "method", "is", "not", "safe", "for", "concurrent", "use", "and", "should", "be", "syncrhonized", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L769-L773
30,590
Azure/go-autorest
autorest/adal/token.go
retryForIMDS
func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) { // copied from client.go due to circular dependency retries := []int{ http.StatusRequestTimeout, // 408 http.StatusTooManyRequests, // 429 http.StatusInternalServerError, // 500 http.StatusBadGatew...
go
func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) { // copied from client.go due to circular dependency retries := []int{ http.StatusRequestTimeout, // 408 http.StatusTooManyRequests, // 429 http.StatusInternalServerError, // 500 http.StatusBadGatew...
[ "func", "retryForIMDS", "(", "sender", "Sender", ",", "req", "*", "http", ".", "Request", ",", "maxAttempts", "int", ")", "(", "resp", "*", "http", ".", "Response", ",", "err", "error", ")", "{", "// copied from client.go due to circular dependency", "retries", ...
// retry logic specific to retrieving a token from the IMDS endpoint
[ "retry", "logic", "specific", "to", "retrieving", "a", "token", "from", "the", "IMDS", "endpoint" ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L879-L936
30,591
Azure/go-autorest
autorest/adal/token.go
isTemporaryNetworkError
func isTemporaryNetworkError(err error) bool { if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { return true } return false }
go
func isTemporaryNetworkError(err error) bool { if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { return true } return false }
[ "func", "isTemporaryNetworkError", "(", "err", "error", ")", "bool", "{", "if", "netErr", ",", "ok", ":=", "err", ".", "(", "net", ".", "Error", ")", ";", "!", "ok", "||", "(", "ok", "&&", "netErr", ".", "Temporary", "(", ")", ")", "{", "return", ...
// returns true if the specified error is a temporary network error or false if it's not. // if the error doesn't implement the net.Error interface the return value is true.
[ "returns", "true", "if", "the", "specified", "error", "is", "a", "temporary", "network", "error", "or", "false", "if", "it", "s", "not", ".", "if", "the", "error", "doesn", "t", "implement", "the", "net", ".", "Error", "interface", "the", "return", "valu...
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L940-L945
30,592
Azure/go-autorest
autorest/adal/token.go
SetRefreshWithin
func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { spt.inner.RefreshWithin = d return }
go
func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { spt.inner.RefreshWithin = d return }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "SetRefreshWithin", "(", "d", "time", ".", "Duration", ")", "{", "spt", ".", "inner", ".", "RefreshWithin", "=", "d", "\n", "return", "\n", "}" ]
// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will // refresh the token.
[ "SetRefreshWithin", "sets", "the", "interval", "within", "which", "if", "the", "token", "will", "expire", "EnsureFresh", "will", "refresh", "the", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L964-L967
30,593
Azure/go-autorest
autorest/adal/token.go
OAuthToken
func (spt *ServicePrincipalToken) OAuthToken() string { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() return spt.inner.Token.OAuthToken() }
go
func (spt *ServicePrincipalToken) OAuthToken() string { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() return spt.inner.Token.OAuthToken() }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "OAuthToken", "(", ")", "string", "{", "spt", ".", "refreshLock", ".", "RLock", "(", ")", "\n", "defer", "spt", ".", "refreshLock", ".", "RUnlock", "(", ")", "\n", "return", "spt", ".", "inner", "....
// OAuthToken implements the OAuthTokenProvider interface. It returns the current access token.
[ "OAuthToken", "implements", "the", "OAuthTokenProvider", "interface", ".", "It", "returns", "the", "current", "access", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L974-L978
30,594
Azure/go-autorest
autorest/adal/token.go
Token
func (spt *ServicePrincipalToken) Token() Token { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() return spt.inner.Token }
go
func (spt *ServicePrincipalToken) Token() Token { spt.refreshLock.RLock() defer spt.refreshLock.RUnlock() return spt.inner.Token }
[ "func", "(", "spt", "*", "ServicePrincipalToken", ")", "Token", "(", ")", "Token", "{", "spt", ".", "refreshLock", ".", "RLock", "(", ")", "\n", "defer", "spt", ".", "refreshLock", ".", "RUnlock", "(", ")", "\n", "return", "spt", ".", "inner", ".", "...
// Token returns a copy of the current token.
[ "Token", "returns", "a", "copy", "of", "the", "current", "token", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/adal/token.go#L981-L985
30,595
Azure/go-autorest
autorest/mocks/mocks.go
Read
func (body *Body) Read(b []byte) (n int, err error) { if !body.IsOpen() { return 0, fmt.Errorf("ERROR: Body has been closed") } if len(body.b) == 0 { return 0, io.EOF } n = copy(b, body.b) body.b = body.b[n:] return n, nil }
go
func (body *Body) Read(b []byte) (n int, err error) { if !body.IsOpen() { return 0, fmt.Errorf("ERROR: Body has been closed") } if len(body.b) == 0 { return 0, io.EOF } n = copy(b, body.b) body.b = body.b[n:] return n, nil }
[ "func", "(", "body", "*", "Body", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "!", "body", ".", "IsOpen", "(", ")", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")",...
// Read reads into the passed byte slice and returns the bytes read.
[ "Read", "reads", "into", "the", "passed", "byte", "slice", "and", "returns", "the", "bytes", "read", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/mocks.go#L46-L56
30,596
Azure/go-autorest
autorest/mocks/mocks.go
Close
func (body *Body) Close() error { if body.isOpen { body.isOpen = false body.closeAttempts++ } return nil }
go
func (body *Body) Close() error { if body.isOpen { body.isOpen = false body.closeAttempts++ } return nil }
[ "func", "(", "body", "*", "Body", ")", "Close", "(", ")", "error", "{", "if", "body", ".", "isOpen", "{", "body", ".", "isOpen", "=", "false", "\n", "body", ".", "closeAttempts", "++", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close closes the body.
[ "Close", "closes", "the", "body", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/mocks.go#L59-L65
30,597
Azure/go-autorest
autorest/mocks/mocks.go
Length
func (body *Body) Length() int64 { if body == nil { return 0 } return int64(len(body.b)) }
go
func (body *Body) Length() int64 { if body == nil { return 0 } return int64(len(body.b)) }
[ "func", "(", "body", "*", "Body", ")", "Length", "(", ")", "int64", "{", "if", "body", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "int64", "(", "len", "(", "body", ".", "b", ")", ")", "\n", "}" ]
// Length returns the number of bytes in the body.
[ "Length", "returns", "the", "number", "of", "bytes", "in", "the", "body", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/mocks.go#L84-L89
30,598
Azure/go-autorest
autorest/mocks/mocks.go
Do
func (c *Sender) Do(r *http.Request) (resp *http.Response, err error) { c.attempts++ if len(c.responses) > 0 { resp = c.responses[0].r if resp != nil { if b, ok := resp.Body.(*Body); ok { b.reset() } } else { err = c.responses[0].e } time.Sleep(c.responses[0].d) c.repeatResponse[0]-- if c....
go
func (c *Sender) Do(r *http.Request) (resp *http.Response, err error) { c.attempts++ if len(c.responses) > 0 { resp = c.responses[0].r if resp != nil { if b, ok := resp.Body.(*Body); ok { b.reset() } } else { err = c.responses[0].e } time.Sleep(c.responses[0].d) c.repeatResponse[0]-- if c....
[ "func", "(", "c", "*", "Sender", ")", "Do", "(", "r", "*", "http", ".", "Request", ")", "(", "resp", "*", "http", ".", "Response", ",", "err", "error", ")", "{", "c", ".", "attempts", "++", "\n\n", "if", "len", "(", "c", ".", "responses", ")", ...
// Do accepts the passed request and, based on settings, emits a response and possible error.
[ "Do", "accepts", "the", "passed", "request", "and", "based", "on", "settings", "emits", "a", "response", "and", "possible", "error", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/mocks.go#L114-L150
30,599
Azure/go-autorest
autorest/mocks/mocks.go
AppendResponseWithDelay
func (c *Sender) AppendResponseWithDelay(resp *http.Response, delay time.Duration) { c.AppendAndRepeatResponseWithDelay(resp, delay, 1) }
go
func (c *Sender) AppendResponseWithDelay(resp *http.Response, delay time.Duration) { c.AppendAndRepeatResponseWithDelay(resp, delay, 1) }
[ "func", "(", "c", "*", "Sender", ")", "AppendResponseWithDelay", "(", "resp", "*", "http", ".", "Response", ",", "delay", "time", ".", "Duration", ")", "{", "c", ".", "AppendAndRepeatResponseWithDelay", "(", "resp", ",", "delay", ",", "1", ")", "\n", "}"...
// AppendResponseWithDelay adds the passed http.Response to the response stack with the specified delay.
[ "AppendResponseWithDelay", "adds", "the", "passed", "http", ".", "Response", "to", "the", "response", "stack", "with", "the", "specified", "delay", "." ]
da8db3a19ec5aba5d01f6032407abf1bb1cc15d3
https://github.com/Azure/go-autorest/blob/da8db3a19ec5aba5d01f6032407abf1bb1cc15d3/autorest/mocks/mocks.go#L158-L160