powerplatform_api

package
v0.3.0-preview Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClientBase

type ApiClientBase struct {
	Config   common.ProviderConfig
	BaseAuth AuthInterface
	Auth     AuthBaseOperationInterface
}

func (*ApiClientBase) ExecuteBase

func (client *ApiClientBase) ExecuteBase(ctx context.Context, token, method string, url string, body interface{}, acceptableStatusCodes []int, responseObj interface{}) (*ApiHttpResponse, error)

func (*ApiClientBase) GetConfig

func (client *ApiClientBase) GetConfig() common.ProviderConfig

func (*ApiClientBase) InitializeBase

func (client *ApiClientBase) InitializeBase(ctx context.Context) (string, error)

func (*ApiClientBase) SetAuth

func (client *ApiClientBase) SetAuth(auth AuthBaseOperationInterface)

type ApiClientInterface

type ApiClientInterface interface {
	SetAuth(auth AuthBaseOperationInterface)
	GetConfig() common.ProviderConfig

	InitializeBase(ctx context.Context) (string, error)
	ExecuteBase(ctx context.Context, token, method string, url string, body interface{}, acceptableStatusCodes []int, responseObj interface{}) (*ApiHttpResponse, error)
}

type ApiHttpResponse

type ApiHttpResponse struct {
	Response    *http.Response
	BodyAsBytes []byte
}

func (*ApiHttpResponse) GetHeader

func (apiResponse *ApiHttpResponse) GetHeader(name string) string

func (*ApiHttpResponse) MarshallTo

func (apiResponse *ApiHttpResponse) MarshallTo(obj interface{}) error

func (*ApiHttpResponse) ValidateStatusCode

func (ApiHttpResponse *ApiHttpResponse) ValidateStatusCode(expectedStatusCode int) error

type AuthBase

type AuthBase struct {
	Config      common.ProviderConfig
	Token       string
	TokenExpiry time.Time
}

func (*AuthBase) AuthClientSecret

func (client *AuthBase) AuthClientSecret(ctx context.Context, scopes []string, tenantId, applicationId, clientSecret string) (string, time.Time, error)

func (*AuthBase) GetToken

func (client *AuthBase) GetToken() (string, error)

func (*AuthBase) GetTokenExpiry

func (client *AuthBase) GetTokenExpiry() time.Time

func (*AuthBase) IsTokenExpiredOrEmpty

func (client *AuthBase) IsTokenExpiredOrEmpty() bool

func (*AuthBase) SetToken

func (client *AuthBase) SetToken(token string)

func (*AuthBase) SetTokenExpiry

func (client *AuthBase) SetTokenExpiry(tokenExpiry time.Time)

type AuthBaseOperationInterface

type AuthBaseOperationInterface interface {
	AuthenticateUserPass(ctx context.Context, tenantId, username, password string) (string, error)
	AuthenticateClientSecret(ctx context.Context, tenantId, applicationid, secret string) (string, error)
}

type AuthInterface

type AuthInterface interface {
	IsTokenExpiredOrEmpty() bool

	GetToken() (string, error)
	SetToken(string)

	SetTokenExpiry(time.Time)
	GetTokenExpiry() time.Time

	AuthClientSecret(ctx context.Context, scopes []string, tenantId, applicationId, clientSecret string) (string, time.Time, error)
}

type BapiClientInterface

type BapiClientInterface interface {
	GetBase() ApiClientInterface
	SetDataverseClient(dataverseClient DataverseClientInterface)
	Execute(ctx context.Context, method string, url string, body interface{}, acceptableStatusCodes []int, responseObj interface{}) (*ApiHttpResponse, error)

	GetEnvironments(ctx context.Context) ([]models.EnvironmentDto, error)
	GetEnvironment(ctx context.Context, environmentId string) (*models.EnvironmentDto, error)
	CreateEnvironment(ctx context.Context, environment models.EnvironmentCreateDto) (*models.EnvironmentDto, error)
	UpdateEnvironment(ctx context.Context, environmentId string, environment models.EnvironmentDto) (*models.EnvironmentDto, error)
	DeleteEnvironment(ctx context.Context, environmentId string) error

	GetPowerApps(ctx context.Context, environmentId string) ([]models.PowerAppBapi, error)

	GetConnectors(ctx context.Context) ([]models.ConnectorDto, error)
	//GetPolicies(ctx context.Context) ([]models.DlpPolicyModel, error)
	GetPolicy(ctx context.Context, name string) (*models.DlpPolicyModel, error)
	DeletePolicy(ctx context.Context, name string) error
	UpdatePolicy(ctx context.Context, name string, policyToUpdate models.DlpPolicyModel) (*models.DlpPolicyModel, error)
	CreatePolicy(ctx context.Context, policyToCreate models.DlpPolicyModel) (*models.DlpPolicyModel, error)
}

type DataverseClientInterface

type DataverseClientInterface interface {
	Initialize(ctx context.Context, environmentUrl string) (string, error)
	SetBapiClient(bapiClient BapiClientInterface)
	Execute(ctx context.Context, environmentUrl, method string, url string, body interface{}, acceptableStatusCodes []int, responseObj interface{}) (*ApiHttpResponse, error)

	GetTableData(ctx context.Context, environmentId, tableName, odataQuery string, responseObj interface{}) error

	GetSolutions(ctx context.Context, environmentId string) ([]models.SolutionDto, error)
	CreateSolution(ctx context.Context, environmentId string, solutionToCreate models.ImportSolutionDto, content []byte, settings []byte) (*models.SolutionDto, error)
	GetSolution(ctx context.Context, environmentId string, solutionName string) (*models.SolutionDto, error)
	DeleteSolution(ctx context.Context, environmentId string, solutionName string) error

	GetDefaultCurrencyForEnvironment(ctx context.Context, environmentId string) (*models.TransactionCurrencyDto, error)
}

type PowerPlatformClientApiInterface

type PowerPlatformClientApiInterface interface {
	GetBase() ApiClientInterface
	Execute(ctx context.Context, method string, url string, body interface{}, acceptableStatusCodes []int, responseObj interface{}) (*ApiHttpResponse, error)

	GetBillingPolicies(ctx context.Context) ([]models.BillingPolicyDto, error)
}

type TokeExpiredError

type TokeExpiredError struct {
	Message string
}

func (*TokeExpiredError) Error

func (e *TokeExpiredError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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