This is an autogenerated Go SDK for Azure using kiota with the APIs that HashiCorp Vault needs.
It is mostly a drop-in replacement for https://github.com/microsoftgraph/msgraph-sdk-go/.
To generate or regenerate the SDK:
rm *.yml
make generate
If you need to add more APIs, either add them to the APIS
line at the top of the Makefile
or specify them on the command-line:
make generate APIS="Applications.yml Mail.yml"
Each API's SDK will be put into the corresponding subdirectory, e.g., Applications.yml
will be put in applications/
.
import (
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
msgraphsdk "github.com/hashicorp/vault-msgraph-sdk/applications"
mscore "github.com/microsoftgraph/msgraph-sdk-go-core"
"github.com/hashicorp/vault-msgraph-sdk/applications/applications"
auth "github.com/microsoftgraph/msgraph-sdk-go-core/authentication"
)
func newClient(graphURI string, creds azcore.TokenCredential, scopes []string) (*msgraphsdkgo.ApiClient, error) {
// ...
authProvider, err := auth.NewAzureIdentityAuthenticationProviderWithScopes(creds, scopes)
if err != nil {
return nil, err
}
adapter, err := mscore.NewGraphRequestAdapterBase(authProvider, mscore.GraphClientOptions{})
if err != nil {
return nil, err
}
adapter.SetBaseUrl(fmt.Sprintf("%s/v1.0", graphURI))
client := msgraphsdk.NewApiClient(adapter)
return client, nil
}