openapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const OpenAPIPluginConfigurationFileName = "terraform-provider-openapi.yaml"

OpenAPIPluginConfigurationFileName defines the file name used for the OpenAPI plugin configuration

Variables

This section is empty.

Functions

func APIProvider

func APIProvider() (*schema.Provider, error)

APIProvider returns a terraform.ResourceProvider.

Types

type PluginConfigSchema added in v0.1.1

type PluginConfigSchema interface {
	// Validate performs a check to confirm that the schema content is correct
	Validate() error
	// GetServiceConfig returns the service configuration for a given provider name
	GetServiceConfig(providerName string) (ServiceConfiguration, error)
	// GetAllServiceConfigurations returns all the service configuration
	GetAllServiceConfigurations() (ServiceConfigurations, error)
	// GetVersion returns the plugin configuration version
	GetVersion() (string, error)
	// Marshal serializes the value provided into a YAML document
	Marshal() ([]byte, error)
}

PluginConfigSchema defines the interface/expected behaviour for PluginConfigSchema implementations.

type PluginConfigSchemaV1 added in v0.1.1

type PluginConfigSchemaV1 struct {
	Version  string                      `yaml:"version"`
	Services map[string]*ServiceConfigV1 `yaml:"services"`
}

PluginConfigSchemaV1 defines PluginConfigSchema version 1 Configuration example: version: '1' services:

monitor:
  swagger-url: http://monitor-api.com/swagger.json
  insecure_skip_verify: true
cdn:
  swagger-url: https://cdn-api.com/swagger.json
vm:
  swagger-url: http://vm-api.com/swagger.json

func NewPluginConfigSchemaV1 added in v0.1.1

func NewPluginConfigSchemaV1(services map[string]*ServiceConfigV1) *PluginConfigSchemaV1

NewPluginConfigSchemaV1 creates a new PluginConfigSchemaV1 that implements PluginConfigSchema interface

func (*PluginConfigSchemaV1) GetAllServiceConfigurations added in v0.1.2

func (p *PluginConfigSchemaV1) GetAllServiceConfigurations() (ServiceConfigurations, error)

GetAllServiceConfigurations returns all the service configuration

func (*PluginConfigSchemaV1) GetServiceConfig added in v0.1.1

func (p *PluginConfigSchemaV1) GetServiceConfig(providerName string) (ServiceConfiguration, error)

GetServiceConfig returns the configuration for the given provider name

func (*PluginConfigSchemaV1) GetVersion added in v0.1.2

func (p *PluginConfigSchemaV1) GetVersion() (string, error)

GetVersion returns the plugin configuration version

func (*PluginConfigSchemaV1) Marshal added in v0.1.2

func (p *PluginConfigSchemaV1) Marshal() ([]byte, error)

Marshal serializes the value provided into a YAML document

func (*PluginConfigSchemaV1) Validate added in v0.1.1

func (p *PluginConfigSchemaV1) Validate() error

Validate makes sure that schema data is correct

type PluginConfiguration added in v0.1.1

type PluginConfiguration struct {
	// ProviderName defines the <provider_name> (should match the provider name of the terraform provider binary; terraform-provider-<provider_name>)
	ProviderName string
	// Configuration defines the reader that contains the plugin's external configuration (located at ~/.terraform.d/plugins)
	// If the plugin configuration file is not present the OTF_VAR_<provider_name>_SWAGGER_URL environment variable will
	// be required when invoking the openapi provider.
	// If at runtime both the OTF_VAR_<provider_name>_SWAGGER_URL as well as the plugin configuration file are present
	// the former takes preference. This allows the user to override the url specified in the configuration file with
	// the value provided in the OTF_VAR_<provider_name>_SWAGGER_URL
	Configuration io.Reader
}

PluginConfiguration defines the OpenAPI plugin's configuration

func NewPluginConfiguration added in v0.1.1

func NewPluginConfiguration(providerName string) (*PluginConfiguration, error)

NewPluginConfiguration creates a new PluginConfiguration

type ServiceConfigV1 added in v0.1.1

type ServiceConfigV1 struct {
	// SwaggerURL defines where the swagger is located
	SwaggerURL string `yaml:"swagger-url"`
	// InsecureSkipVerify defines whether the internal http client used to fetch the swagger file should verify the server cert
	// or not. This should only be used purposefully if the server is using a self-signed cert and only if the server is trusted
	InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
}

ServiceConfigV1 defines configuration for the service provider

func NewServiceConfigV1 added in v0.1.2

func NewServiceConfigV1(swaggerURL string, insecureSkipVerifyEnabled bool) *ServiceConfigV1

NewServiceConfigV1 creates a new instance of NewServiceConfigV1 struct with the values provided

func NewServiceConfigV1WithDefaults added in v0.1.2

func NewServiceConfigV1WithDefaults(swaggerURL string) *ServiceConfigV1

NewServiceConfigV1WithDefaults creates a new ServiceConfigV1 with the swaggerURL passed in and default configuration for the rest of the struct fields

func (*ServiceConfigV1) GetSwaggerURL added in v0.1.1

func (s *ServiceConfigV1) GetSwaggerURL() string

GetSwaggerURL returns the URL where the service swagger doc is exposed

func (*ServiceConfigV1) IsInsecureSkipVerifyEnabled added in v0.1.1

func (s *ServiceConfigV1) IsInsecureSkipVerifyEnabled() bool

IsInsecureSkipVerifyEnabled returns true if the given provider's service configuration has InsecureSkipVerify enabled; false otherwise

type ServiceConfiguration added in v0.1.1

type ServiceConfiguration interface {
	// GetSwaggerURL returns the URL where the service swagger doc is exposed
	GetSwaggerURL() string
	// IsInsecureSkipVerifyEnabled returns true if the given provider's service configuration has InsecureSkipVerify enabled; false
	// otherwise
	IsInsecureSkipVerifyEnabled() bool
}

ServiceConfiguration defines the interface/expected behaviour for ServiceConfiguration implementations.

type ServiceConfigurations added in v0.1.2

type ServiceConfigurations map[string]ServiceConfiguration

ServiceConfigurations contains the map with all service configurations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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