tfimportables

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tfimportables importable_factory.go This module creates a list of importable instances so each can be instantiated once and shared among other callers.

Adding importables Add a case to the switch statement where the key is the name of the resource as it should be represented in terraform then call the requisite client method if needed. Be sure the client exists in the clients package to avoid comiler errors. Finally, add the importable to the map of importables so it can be fetched by referencing the terraform name via the terraform naming convention

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSOneLoginUserData added in v0.0.5

type AWSOneLoginUserData struct {
	Username string `json:"name,omitempty"`
}

type AWSUserData added in v0.0.5

type AWSUserData struct {
	Path string `json:"path,omitempty"`
	Name string `json:"name,omitempty"`
}

the underlying data that represents the resource from the remote in terraform. add fields here so they can be unmarshalled from tfstate json into the struct and handled by the importer

type AWSUserQuerier added in v0.0.5

type AWSUserQuerier interface {
	ListUsers(input *iam.ListUsersInput) (*iam.ListUsersOutput, error)
}

type AWSUsersImportable added in v0.0.5

type AWSUsersImportable struct {
	Service AWSUserQuerier
}

func (AWSUsersImportable) HCLShape added in v0.0.5

func (i AWSUsersImportable) HCLShape() interface{}

func (AWSUsersImportable) ImportFromRemote added in v0.0.5

func (i AWSUsersImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (aws api) and creates their Terraform ResourceDefinitions

type AppConfigurationData added in v0.0.3

type AppConfigurationData struct {
	RedirectURI                   *string `json:"redirect_uri,omitempty"`
	RefreshTokenExpirationMinutes *string `json:"refresh_token_expiration_minutes,omitempty"`
	LoginURL                      *string `json:"login_url,omitempty"`
	OidcApplicationType           *string `json:"oidc_application_type,omitempty"`
	TokenEndpointAuthMethod       *string `json:"token_endpoint_auth_method,omitempty"`
	AccessTokenExpirationMinutes  *string `json:"access_token_expiration_minutes,omitempty"`
	ProviderArn                   *string `json:"provider_arn,omitempty"`
	SignatureAlgorithm            *string `json:"signature_algorithm,omitempty"`
}

AppConfiguration is the contract for configuration.

type AppData added in v0.0.3

type AppData struct {
	AllowAssumedSignin *bool                `json:"allow_assumed_signin,omitempty"`
	ConnectorID        *int32               `json:"connector_id,omitempty"`
	Description        *string              `json:"description,omitempty"`
	Name               *string              `json:"name,omitempty"`
	Notes              *string              `json:"notes,omitempty"`
	Visible            *bool                `json:"visible,omitempty"`
	Configuration      AppConfigurationData `json:"configuration,omitempty"`
	Provisioning       AppProvisioningData  `json:"provisioning,omitempty"`
	Parameters         []AppParametersData  `json:"parameters,omitempty"`
	Rules              []AppRuleData        `json:"rules,omitempty"`
}

the underlying data that represents the resource from the remote in terraform. add fields here so they can be unmarshalled from tfstate json into the struct and handled by the importer

type AppParametersData added in v0.0.3

type AppParametersData struct {
	ID                        *int32  `json:"id,omitempty"`
	Label                     *string `json:"label,omitempty"`
	UserAttributeMappings     *string `json:"user_attribute_mappings,omitempty"`
	UserAttributeMacros       *string `json:"user_attribute_macros,omitempty"`
	AttributesTransformations *string `json:"attributes_transformations,omitempty"`
	SkipIfBlank               *bool   `json:"skip_if_blank,omitempty"`
	Values                    *string `json:"values,omitempty,omitempty"`
	DefaultValues             *string `json:"default_values,omitempty"`
	ParamKeyName              *string `json:"param_key_name,omitempty"`
	ProvisionedEntitlements   *bool   `json:"provisioned_entitlements,omitempty"`
	SafeEntitlementsEnabled   *bool   `json:"safe_entitlements_enabled,omitempty"`
	IncludeInSamlAssertion    *bool   `json:"include_in_saml_assertion,omitempty"`
}

AppParameters is the contract for parameters.

type AppProvisioningData added in v0.0.3

type AppProvisioningData struct {
	Enabled *bool `json:"enabled,omitempty"`
}

AppProvisioning is the contract for provisioning.

type AppQuerier

type AppQuerier interface {
	Query(query *apps.AppsQuery) ([]apps.App, error)
	GetOne(id int32) (*apps.App, error)
}

type AppRuleActionsData added in v0.0.3

type AppRuleActionsData struct {
	Action     *string  `json:"action,omitempty"`
	Value      []string `json:"value,omitempty"`
	Expression *string  `json:"expression,omitempty"`
}

type AppRuleConditionsData added in v0.0.3

type AppRuleConditionsData struct {
	Source   *string `json:"source,omitempty"`
	Operator *string `json:"operator,omitempty"`
	Value    *string `json:"value,omitempty"`
}

type AppRuleData added in v0.0.3

type AppRuleData struct {
	Name       *string                 `json:"name,omitempty"`
	Match      *string                 `json:"match,omitempty"`
	Enabled    *bool                   `json:"enabled,omitempty"`
	Conditions []AppRuleConditionsData `json:"conditions,omitempty"`
	Actions    []AppRuleActionsData    `json:"actions,omitempty"`
}

Define our own version of the app rules to refine what fields get written to main.tf plan

type Condition added in v0.1.8

type Condition struct {
	Source   *string `json:"source,omitempty"`
	Operator *string `json:"operator,omitempty"`
	Value    *string `json:"value,omitempty"`
}

type Importable

type Importable interface {
	ImportFromRemote(searchId *string) []ResourceDefinition // transforms resources from remote to an array ResourceDefinitions to be inserted into an HCL file
	HCLShape() interface{}                                  // dictates what fields on tfstate should be represented in HCL files
}

type ImportableList added in v0.0.5

type ImportableList struct {
	Clients *clients.Clients
	// contains filtered or unexported fields
}

ImportableList is the list of created importables referenced by a map where the key is the name used to identify it in terraform

func New added in v0.0.5

func New(clients *clients.Clients) *ImportableList

func (*ImportableList) GetImportable added in v0.0.5

func (imf *ImportableList) GetImportable(importableType string) Importable

type OktaAppData added in v0.1.8

type OktaAppData struct {
	Embedded      interface{}                    `json:"_embedded,omitempty"`
	Links         interface{}                    `json:"_links,omitempty"`
	Accessibility *okta.ApplicationAccessibility `json:"accessibility,omitempty"`
	Created       *time.Time                     `json:"created,omitempty"`
	Credentials   *okta.ApplicationCredentials   `json:"credentials,omitempty"`
	Features      []string                       `json:"features,omitempty"`
	Id            string                         `json:"id,omitempty"`
	Label         string                         `json:"label,omitempty"`
	LastUpdated   *time.Time                     `json:"lastUpdated,omitempty"`
	Licensing     *okta.ApplicationLicensing     `json:"licensing,omitempty"`
	Name          string                         `json:"name,omitempty"`
	Profile       interface{}                    `json:"profile,omitempty"`
	Settings      *okta.ApplicationSettings      `json:"settings,omitempty"`
	SignOnMode    string                         `json:"signOnMode,omitempty"`
	Status        string                         `json:"status,omitempty"`
	Visibility    *okta.ApplicationVisibility    `json:"visibility,omitempty"`
}

TODO what fields do we need to snag for saml / oidc ?

type OktaAppQuerier added in v0.1.8

type OktaAppQuerier interface {
	ListApplications(context.Context, *query.Params) ([]okta.App, *okta.Response, error)
}

type OktaAppsImportable added in v0.1.8

type OktaAppsImportable struct {
	Service OktaAppQuerier
}

func (OktaAppsImportable) HCLShape added in v0.1.8

func (i OktaAppsImportable) HCLShape() interface{}

func (OktaAppsImportable) ImportFromRemote added in v0.1.8

func (i OktaAppsImportable) ImportFromRemote(searchId *string) []ResourceDefinition

type OneloginAppsImportable

type OneloginAppsImportable struct {
	AppType string
	Service AppQuerier
}

func (OneloginAppsImportable) HCLShape added in v0.0.3

func (i OneloginAppsImportable) HCLShape() interface{}

func (OneloginAppsImportable) ImportFromRemote

func (i OneloginAppsImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type OneloginRolesImportable added in v0.1.6

type OneloginRolesImportable struct {
	Service RoleQuerier
}

func (OneloginRolesImportable) HCLShape added in v0.1.6

func (i OneloginRolesImportable) HCLShape() interface{}

func (OneloginRolesImportable) ImportFromRemote added in v0.1.6

func (i OneloginRolesImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type OneloginSmartHookEnvVarsImportable added in v0.1.8

type OneloginSmartHookEnvVarsImportable struct {
	Service SmartHookEnvVarQuerier
}

func (OneloginSmartHookEnvVarsImportable) HCLShape added in v0.1.8

func (i OneloginSmartHookEnvVarsImportable) HCLShape() interface{}

func (OneloginSmartHookEnvVarsImportable) ImportFromRemote added in v0.1.8

func (i OneloginSmartHookEnvVarsImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type OneloginSmartHooksImportable added in v0.1.8

type OneloginSmartHooksImportable struct {
	Service SmartHookQuerier
}

func (OneloginSmartHooksImportable) HCLShape added in v0.1.8

func (i OneloginSmartHooksImportable) HCLShape() interface{}

func (OneloginSmartHooksImportable) ImportFromRemote added in v0.1.8

func (i OneloginSmartHooksImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type OneloginUserMappingsImportable added in v0.0.2

type OneloginUserMappingsImportable struct {
	Service UserMappingQuerier
}

func (OneloginUserMappingsImportable) HCLShape added in v0.0.3

func (i OneloginUserMappingsImportable) HCLShape() interface{}

func (OneloginUserMappingsImportable) ImportFromRemote added in v0.0.2

func (i OneloginUserMappingsImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type OneloginUsersImportable added in v0.0.5

type OneloginUsersImportable struct {
	Service UserQuerier
}

func (OneloginUsersImportable) HCLShape added in v0.0.5

func (i OneloginUsersImportable) HCLShape() interface{}

func (OneloginUsersImportable) ImportFromRemote added in v0.0.5

func (i OneloginUsersImportable) ImportFromRemote(searchId *string) []ResourceDefinition

Interface requirement to be an Importable. Calls out to remote (onelogin api) and creates their Terraform ResourceDefinitions

type Options added in v0.1.8

type Options struct {
	RiskEnabled          *bool `json:"risk_enabled,omitempty"`
	MFADeviceInfoEnabled *bool `json:"mfa_device_info_enabled,omitempty"`
	LocationEnabled      *bool `json:"location_enabled,omitempty"`
}

SmartHookOptions represents the options to be associated with a SmartHook

type ResourceDefinition

type ResourceDefinition struct {
	Provider string // Name of provider Terraform will use to do import
	Name     string // Name of the resource as defined in HCL
	Type     string // Type of resource e.g. aws_iam_user
	ImportID string // ID used by Terraform provider to download the resource
}

ResourceDefinition represents basic information about the resource to be imported so it can be used in HCL file and set up terraform import command

type Role added in v0.1.6

type Role struct {
	Name   *string `json:"name,omitempty"`
	Admins []int32 `json:"admins,omitempty"`
	Apps   []int32 `json:"apps,omitempty"`
	Users  []int32 `json:"users,omitempty"`
}

type RoleQuerier added in v0.1.6

type RoleQuerier interface {
	Query(query *roles.RoleQuery) ([]roles.Role, error)
	GetOne(id int32) (*roles.Role, error)
}

type SmartHook added in v0.1.8

type SmartHook struct {
	ID             *string           `json:"id,omitempty"`
	Type           *string           `json:"type,omitempty"`
	Disabled       *bool             `json:"disabled,omitempty"`
	Timeout        *int32            `json:"timeout,omitempty"`
	EnvVars        []string          `json:"env_vars"`
	Runtime        *string           `json:"runtime,omitempty"`
	ContextVersion *string           `json:"context_version,omitempty"`
	Retries        *int32            `json:"retries,omitempty"`
	Options        *Options          `json:"options,omitempty"`
	Packages       map[string]string `json:"packages,omitempty"`
	Function       *string           `json:"function,omitempty"`
	Status         *string           `json:"status,omitempty"`
	Conditions     []Condition       `json:"conditions,omitempty"`
}

SmartHook represents a OneLogin SmartHook with associated resource data

type SmartHookEnvVarQuerier added in v0.1.8

type SmartHookEnvVarQuerier interface {
	Query(query *smarthookenvs.SmartHookEnvVarQuery) ([]smarthookenvs.EnvVar, error)
	GetOne(id string) (*smarthookenvs.EnvVar, error)
}

type SmartHookQuerier added in v0.1.8

type SmartHookQuerier interface {
	Query(query *smarthooks.SmartHookQuery) ([]smarthooks.SmartHook, error)
	GetOne(id string) (*smarthooks.SmartHook, error)
}

type UserData added in v0.0.5

type UserData struct {
	Firstname            *string `json:"firstname,omitempty"`
	Lastname             *string `json:"lastname,omitempty"`
	Username             *string `json:"username,omitempty"`
	Email                *string `json:"email,omitempty"`
	DistinguishedName    *string `json:"distinguished_name,omitempty"`
	Samaccountname       *string `json:"samaccountname,omitempty"`
	UserPrincipalName    *string `json:"userprincipalname,omitempty"`
	MemberOf             *string `json:"member_of,omitempty"`
	Phone                *string `json:"phone,omitemepty"`
	Title                *string `json:"title,omitempty"`
	Company              *string `json:"company,omitempty"`
	Department           *string `json:"department,omitempty"`
	Comment              *string `json:"comment,omitempty"`
	State                *int32  `json:"state,omitempty"`
	Status               *int32  `json:"status,omitempty"`
	InvalidLoginAttempts *int32  `json:"invalid_login_attempts,omitempty"`
	GroupID              *int32  `json:"group_id,omitempty"`
	DirectoryID          *int32  `json:"directory_id,omitempty"`
	TrustedIDPID         *int32  `json:"trusted_idp_id,omitempty"`
	ManagerADID          *int32  `json:"manager_ad_id,omitempty"`
	ManagerUserID        *int32  `json:"manager_user_id,omitempty"`
	ExternalID           *int32  `json:"external_id,omitempty"`
}

the underlying data that represents the resource from the remote in terraform. add fields here so they can be unmarshalled from tfstate json into the struct and handled by the importer

type UserMappingActionsData added in v0.0.3

type UserMappingActionsData struct {
	Action *string  `json:"action,omitempty"`
	Value  []string `json:"value,omitempty"`
}

UserMappingActions is the contract for User Mapping Actions.

type UserMappingConditionsData added in v0.0.3

type UserMappingConditionsData struct {
	Source   *string `json:"source,omitempty"`
	Operator *string `json:"operator,omitempty"`
	Value    *string `json:"value,omitempty"`
}

UserMappingConditions is the contract for User Mapping Conditions.

type UserMappingData added in v0.0.3

type UserMappingData struct {
	Name       *string                     `json:"name,omitempty"`
	Match      *string                     `json:"match,omitempty"`
	Position   *int32                      `json:"position,omitempty"`
	Enabled    *bool                       `json:"enabled,omitempty"`
	Conditions []UserMappingConditionsData `json:"conditions,omitempty"` // we managed to get lucky thus far but if multiple resources have the same field and theyre different types this will be a problem
	Actions    []UserMappingActionsData    `json:"actions,omitempty"`
}

the underlying data that represents the resource from the remote in terraform. add fields here so they can be unmarshalled from tfstate json into the struct and handled by the importer

type UserMappingQuerier added in v0.0.2

type UserMappingQuerier interface {
	Query(query *usermappings.UserMappingsQuery) ([]usermappings.UserMapping, error)
	GetOne(id int32) (*usermappings.UserMapping, error)
}

type UserQuerier added in v0.0.5

type UserQuerier interface {
	Query(query *users.UserQuery) ([]users.User, error)
	GetOne(id int32) (*users.User, error)
}

Jump to

Keyboard shortcuts

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