in client/client.go [40:64]
func NewRemotePDPClient(endpoint, scope string, cred azcore.TokenCredential, clientOptions *azcore.ClientOptions) (*remotePDPClient, error) {
if strings.TrimSpace(endpoint) == "" {
return nil, fmt.Errorf("endpoint: %s is not valid, need a valid endpoint in creating client", endpoint)
}
if strings.TrimSpace(scope) == "" {
return nil, fmt.Errorf("scope: %s is not valid, need a valid scope in creating client", scope)
}
if cred == nil {
return nil, fmt.Errorf("need TokenCredential in creating client")
}
authPolicy := runtime.NewBearerTokenPolicy(cred, []string{scope}, nil)
pipeline := runtime.NewPipeline(
modulename,
version,
runtime.PipelineOptions{
PerCall: []policy.Policy{},
PerRetry: []policy.Policy{authPolicy},
},
clientOptions,
)
return &remotePDPClient{endpoint, pipeline}, nil
}