provider

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2024 License: MPL-2.0 Imports: 38 Imported by: 0

Documentation

Overview

REF: https://learn.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=go#on-behalf-of-provider

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(version string) func() provider.Provider

Types

type M365Provider

type M365Provider struct {
	// contains filtered or unexported fields
}

M365Provider defines the provider implementation.

func (*M365Provider) Configure

Configure sets up the Microsoft365 provider with the given configuration. It processes the provider schema, retrieves values from the configuration or environment variables, sets up authentication, and initializes the Microsoft Graph clients.

The function supports various authentication methods, proxy settings, and national cloud deployments. It performs the following main steps:

  1. Extracts and validates the configuration data.
  2. Sets up logging and context with relevant fields.
  3. Determines cloud-specific constants and endpoints.
  4. Configures the Entra ID client options.
  5. Obtains credentials based on the specified authentication method.
  6. Creates and configures the Microsoft Graph clients (stable and beta).

If any errors occur during these steps, appropriate diagnostics are added to the response.

func (*M365Provider) DataSources

func (p *M365Provider) DataSources(ctx context.Context) []func() datasource.DataSource

DataSources returns a slice of functions that each return a datasource.DataSource. This function is a method of the M365Provider type and takes a context.Context as an argument. The returned slice is intended to hold the Microsoft 365 provider datasources.

Parameters:

  • ctx: The context for controlling cancellation and timeout.

Returns:

[]func() datasource.DataSource: A slice of functions, each returning a datasource.DataSource.

func (*M365Provider) Metadata

func (*M365Provider) Resources

func (p *M365Provider) Resources(ctx context.Context) []func() resource.Resource

Resources returns a slice of functions that each return a resource.Resource. This function is a method of the M365Provider type and takes a context.Context as an argument. The returned slice is intended to hold the Microsoft 365 provider resources.

Parameters:

  • ctx: The context for controlling cancellation and timeout.

Returns:

[]func() resource.Resource: A slice of functions, each returning a resource.Resource.

Resources returns a slice of functions that each return a resource.Resource.

func (*M365Provider) Schema

type M365ProviderModel

type M365ProviderModel struct {
	TenantID                  types.String `tfsdk:"tenant_id"`
	AuthMethod                types.String `tfsdk:"auth_method"`
	ClientID                  types.String `tfsdk:"client_id"`
	ClientSecret              types.String `tfsdk:"client_secret"`
	ClientCertificate         types.String `tfsdk:"client_certificate"`
	ClientCertificatePassword types.String `tfsdk:"client_certificate_password"`
	Username                  types.String `tfsdk:"username"`
	Password                  types.String `tfsdk:"password"`
	RedirectURL               types.String `tfsdk:"redirect_url"`
	UseProxy                  types.Bool   `tfsdk:"use_proxy"`
	ProxyURL                  types.String `tfsdk:"proxy_url"`
	Cloud                     types.String `tfsdk:"cloud"`
	EnableChaos               types.Bool   `tfsdk:"enable_chaos"`
	TelemetryOptout           types.Bool   `tfsdk:"telemetry_optout"`
	DebugMode                 types.Bool   `tfsdk:"debug_mode"`
}

M365ProviderModel describes the provider data model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL