Skip to content

Commit

Permalink
Client initialization option set cloud config (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo authored Jul 7, 2022
1 parent 5325d88 commit a606bb2
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

type ClientBuilder struct {
credential azcore.TokenCredential
opt *arm.ClientOptions
}

func NewClientBuilder() (*ClientBuilder, error) {
Expand Down Expand Up @@ -54,41 +55,41 @@ func NewClientBuilder() (*ClientBuilder, error) {

return &ClientBuilder{
credential: cred,
}, nil
}

var clientOpt = &arm.ClientOptions{
ClientOptions: policy.ClientOptions{
Telemetry: policy.TelemetryOptions{
ApplicationID: "aztfy",
Disabled: false,
opt: &arm.ClientOptions{
ClientOptions: policy.ClientOptions{
Cloud: cloudCfg,
Telemetry: policy.TelemetryOptions{
ApplicationID: "aztfy",
Disabled: false,
},
Logging: policy.LogOptions{
IncludeBody: true,
},
},
},
Logging: policy.LogOptions{
IncludeBody: true,
},
},
}, nil
}

func (b *ClientBuilder) NewResourceGroupClient(subscriptionId string) (*armresources.ResourceGroupsClient, error) {
return armresources.NewResourceGroupsClient(
subscriptionId,
b.credential,
clientOpt,
b.opt,
)
}

func (b *ClientBuilder) NewKeyvaultKeysClient(subscriptionId string) (*armkeyvault.KeysClient, error) {
return armkeyvault.NewKeysClient(
subscriptionId,
b.credential,
clientOpt,
b.opt,
)
}

func (b *ClientBuilder) NewKeyvaultSecretsClient(subscriptionId string) (*armkeyvault.SecretsClient, error) {
return armkeyvault.NewSecretsClient(
subscriptionId,
b.credential,
clientOpt,
b.opt,
)
}

0 comments on commit a606bb2

Please sign in to comment.