Skip to content

hashicorp/vault-msgraph-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vault-msgraph-sdk

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/.

Generate

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/.

Example Usage

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
}

About

Autogenerated Go SDK for Azure

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages