diff --git a/client/application.go b/client/application.go index 3417f57..5f534bd 100644 --- a/client/application.go +++ b/client/application.go @@ -10,6 +10,7 @@ type ProviderSettings struct { AWS *AwsProviderSettings `json:"aws"` } +// DataSources data sources for application type DataSources struct { Disabled *[]string `json:"disabled"` Enabled *[]string `json:"enabled"` diff --git a/client/application_permissions.go b/client/application_permissions.go index 381d245..e27a3ad 100644 --- a/client/application_permissions.go +++ b/client/application_permissions.go @@ -1,11 +1,13 @@ package client +// ApplicationPermissions application permissions type ApplicationPermissions struct { Execute []string `json:"EXECUTE"` Read []string `json:"READ"` Write []string `json:"WRITE"` } +// NewApplicationPermissions new application permissions func NewApplicationPermissions() *ApplicationPermissions { return &ApplicationPermissions{} } diff --git a/client/application_service.go b/client/application_service.go index 90bbe4a..2b4b067 100644 --- a/client/application_service.go +++ b/client/application_service.go @@ -126,7 +126,7 @@ func (service *ApplicationService) DeleteApplication(app *Application) error { func (service *ApplicationService) sendTask(app *Application, jobType string, taskDescription string) error { task := Task{ Job: &[]*Job{ - &Job{ + { Type: jobType, Application: app, User: service.Config.Auth.UserEmail, diff --git a/client/canary_analysis_config.go b/client/canary_analysis_config.go index 6168d33..9156cf7 100644 --- a/client/canary_analysis_config.go +++ b/client/canary_analysis_config.go @@ -1,10 +1,12 @@ package client +// CanaryAnalysisConfigScoreThreadholds thresholds type CanaryAnalysisConfigScoreThreadholds struct { Marginal string `json:"marginal"` Pass string `json:"pass"` } +// CanaryAnalysisConfig config type CanaryAnalysisConfig struct { CanaryAnalysisIntervalMins string `json:"canaryAnalysisIntervalMins"` CanaryConfigId string `json:"canaryConfigId"` @@ -17,6 +19,7 @@ type CanaryAnalysisConfig struct { StorageAccountName string `json:"storageAccountName"` } +// NewCanaryAnalysisConfig new config func NewCanaryAnalysisConfig() *CanaryAnalysisConfig { return &CanaryAnalysisConfig{ ScoreThresholds: CanaryAnalysisConfigScoreThreadholds{}, diff --git a/client/canary_analysis_config_scope.go b/client/canary_analysis_config_scope.go index af611be..1ef629b 100644 --- a/client/canary_analysis_config_scope.go +++ b/client/canary_analysis_config_scope.go @@ -1,5 +1,6 @@ package client +// CanaryAnalysisConfigScope canary analysis type CanaryAnalysisConfigScope struct { ControlLocation string `json:"controlLocation,omitempty"` ControlScope string `json:"controlScope,omitempty"` diff --git a/client/canary_analysis_stage.go b/client/canary_analysis_stage.go index 9a71535..59ed2c3 100644 --- a/client/canary_analysis_stage.go +++ b/client/canary_analysis_stage.go @@ -4,12 +4,14 @@ import ( "github.com/mitchellh/mapstructure" ) +// CanaryAnalysisStageType stage type var CanaryAnalysisStageType StageType = "kayentaCanary" func init() { stageFactories[CanaryAnalysisStageType] = parseCanaryAnalysisStage } +// CanaryAnalysisStage canary analysis stage type CanaryAnalysisStage struct { BaseStage `mapstructure:",squash"` @@ -18,6 +20,7 @@ type CanaryAnalysisStage struct { Deployments *[]*DeploymentCluster `json:"deployments,omitempty"` } +// NewCanaryAnalysisStage new canary analysis stage func NewCanaryAnalysisStage() *CanaryAnalysisStage { return &CanaryAnalysisStage{ BaseStage: *newBaseStage(CanaryAnalysisStageType), diff --git a/client/canary_config.go b/client/canary_config.go index e28283c..065d4ed 100644 --- a/client/canary_config.go +++ b/client/canary_config.go @@ -1,5 +1,6 @@ package client +// CanaryConfig canary config type CanaryConfig struct { Id string `json:"id,omitempty"` Name string `json:"name"` @@ -12,6 +13,7 @@ type CanaryConfig struct { Judge *CanaryConfigJudge `json:"judge"` } +// NewCanaryConfig new config func NewCanaryConfig(judge *CanaryConfigJudge, name string, application string) *CanaryConfig { return &CanaryConfig{ Name: name, @@ -24,10 +26,12 @@ func NewCanaryConfig(judge *CanaryConfigJudge, name string, application string) } } +// AddGroup add group func (config *CanaryConfig) AddGroup(group string, weight float64) { config.Classifier.GroupWeights[group] = weight } +// AddMetric add metric func (config *CanaryConfig) AddMetric(metric *CanaryConfigMetric) { config.Metrics = append(config.Metrics, metric) } diff --git a/client/canary_config_classifier.go b/client/canary_config_classifier.go index 584477f..4e87fd3 100644 --- a/client/canary_config_classifier.go +++ b/client/canary_config_classifier.go @@ -1,9 +1,11 @@ package client +// CanaryConfigClassifier classifier type CanaryConfigClassifier struct { GroupWeights map[string]float64 `json:"groupWeights"` } +// NewCanaryConfigClassifier new classifier func NewCanaryConfigClassifier() *CanaryConfigClassifier { return &CanaryConfigClassifier{ GroupWeights: map[string]float64{}, diff --git a/client/canary_config_judge.go b/client/canary_config_judge.go index 4346c26..f7df4af 100644 --- a/client/canary_config_judge.go +++ b/client/canary_config_judge.go @@ -1,10 +1,12 @@ package client +// CanaryConfigJudge judge type CanaryConfigJudge struct { Name string `json:"name"` JudgeConfigurations map[string]interface{} `json:"judgeConfigurations"` } +// NewCanaryConfigJudge new judge func NewCanaryConfigJudge(name string) *CanaryConfigJudge { return &CanaryConfigJudge{ Name: name, diff --git a/client/canary_config_metric.go b/client/canary_config_metric.go index fda5f09..0af4b3d 100644 --- a/client/canary_config_metric.go +++ b/client/canary_config_metric.go @@ -1,5 +1,6 @@ package client +// CanaryConfigMetric config metric type CanaryConfigMetric struct { // AnalysisConfigurations interface `json:"analysisConfigurations"` Name string `json:"name"` @@ -8,6 +9,7 @@ type CanaryConfigMetric struct { ScopeName string `json:"scopeName"` } +// NewCanaryConfigMetric new config metric func NewCanaryConfigMetric( group string, name string, metricQuery *CanaryConfigMetricQuery, ) *CanaryConfigMetric { diff --git a/client/canary_config_metric_query.go b/client/canary_config_metric_query.go index 5c7476f..3432321 100644 --- a/client/canary_config_metric_query.go +++ b/client/canary_config_metric_query.go @@ -1,11 +1,13 @@ package client +// CanaryConfigMetricQuery metric query type CanaryConfigMetricQuery struct { Type string `json:"type"` ServiceType string `json:"serviceType"` MetricName string `json:"metricName"` } +// NewCanaryConfigMetricQuery new metric query func NewCanaryConfigMetricQuery(metric string, serviceType string, metricType string) *CanaryConfigMetricQuery { return &CanaryConfigMetricQuery{ Type: metricType, diff --git a/client/canary_config_service.go b/client/canary_config_service.go index e3aa60b..bc9f76a 100644 --- a/client/canary_config_service.go +++ b/client/canary_config_service.go @@ -5,16 +5,20 @@ import ( "fmt" ) +// ErrCanaryConfigNotFound config not found var ErrCanaryConfigNotFound = errors.New("Could not find canary config") +// CreateCanaryConfigResponse canary config response type CreateCanaryConfigResponse struct { CanaryConfigId string `json:"canaryConfigId"` } +// CanaryConfigService config service type CanaryConfigService struct { *Client } +// GetCanaryConfigs get configs func (service *CanaryConfigService) GetCanaryConfigs() (*[]*CanaryConfig, error) { path := "/v2/canaryConfig" req, err := service.NewRequest("GET", path) @@ -31,6 +35,7 @@ func (service *CanaryConfigService) GetCanaryConfigs() (*[]*CanaryConfig, error) return &configs, nil } +// GetCanaryConfig get config by id func (service *CanaryConfigService) GetCanaryConfig(id string) (*CanaryConfig, error) { path := fmt.Sprintf("/v2/canaryConfig/%s", id) req, err := service.NewRequest("GET", path) @@ -44,7 +49,7 @@ func (service *CanaryConfigService) GetCanaryConfig(id string) (*CanaryConfig, e } // CreateCanaryConfig create an canary config -func (service *CanaryConfigService) CreateCanaryConfig(config *CanaryConfig) (configId string, err error) { +func (service *CanaryConfigService) CreateCanaryConfig(config *CanaryConfig) (configID string, err error) { path := "/v2/canaryConfig" req, err := service.NewRequestWithBody("POST", path, config) if err != nil { @@ -56,6 +61,7 @@ func (service *CanaryConfigService) CreateCanaryConfig(config *CanaryConfig) (co return response.CanaryConfigId, err } +// UpdateCanaryConfig update config func (service *CanaryConfigService) UpdateCanaryConfig(config *CanaryConfig) error { path := fmt.Sprintf("/v2/canaryConfig/%s", config.Id) req, err := service.NewRequestWithBody("PUT", path, config) @@ -67,8 +73,9 @@ func (service *CanaryConfigService) UpdateCanaryConfig(config *CanaryConfig) err return err } -func (service *CanaryConfigService) DeleteCanaryConfig(configId string) error { - path := fmt.Sprintf("/v2/canaryConfig/%s", configId) +// DeleteCanaryConfig deleete config +func (service *CanaryConfigService) DeleteCanaryConfig(configID string) error { + path := fmt.Sprintf("/v2/canaryConfig/%s", configID) req, err := service.NewRequest("DELETE", path) if err != nil { return err diff --git a/client/check_preconditions_stage.go b/client/check_preconditions_stage.go index 1c5a341..1e4c4e1 100644 --- a/client/check_preconditions_stage.go +++ b/client/check_preconditions_stage.go @@ -14,12 +14,14 @@ func init() { stageFactories[CheckPreconditionsStageType] = parseCheckPreconditionsStage } +// CheckPreconditionsStage preconditions stage type CheckPreconditionsStage struct { BaseStage `mapstructure:",squash"` Preconditions []Precondition `json:"preconditions"` } +// NewCheckPreconditionsStage new stage func NewCheckPreconditionsStage() *CheckPreconditionsStage { return &CheckPreconditionsStage{ BaseStage: *newBaseStage(CheckPreconditionsStageType), diff --git a/client/check_preconditions_stage_test.go b/client/check_preconditions_stage_test.go index b717b53..5f232a2 100644 --- a/client/check_preconditions_stage_test.go +++ b/client/check_preconditions_stage_test.go @@ -44,16 +44,16 @@ func TestCheckPreconditionsStageSerialize(t *testing.T) { t.Fatal(err) } result := string(b) - if result != checkPreconditionsJson { + if result != checkPreconditionsJSON { dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(checkPreconditionsJson, result, true) + diffs := dmp.DiffMain(checkPreconditionsJSON, result, true) t.Fatalf("Check Preconditions not as expected: %s", dmp.DiffPrettyText(diffs)) } } func TestCheckPreconditionsStageDeserialize(t *testing.T) { var stageMap map[string]interface{} - err := json.Unmarshal([]byte(checkPreconditionsJson), &stageMap) + err := json.Unmarshal([]byte(checkPreconditionsJSON), &stageMap) if err != nil { t.Fatal(err) } @@ -67,7 +67,7 @@ func TestCheckPreconditionsStageDeserialize(t *testing.T) { } } -var checkPreconditionsJson = `{ +var checkPreconditionsJSON = `{ "name": "Check Preconditions", "refId": "", "type": "checkPreconditions", diff --git a/client/client.go b/client/client.go index 414375a..f0cb364 100644 --- a/client/client.go +++ b/client/client.go @@ -23,6 +23,7 @@ type Config struct { Auth *Auth } +// NewConfig new config func NewConfig() *Config { return &Config{ Auth: NewAuth(), @@ -40,7 +41,7 @@ func NewClient(config *Config) *Client { var httpClient *http.Client if config.Auth.Enabled { - httpClient = newTlsHttpClient(config) + httpClient = newTLSHTTPClient(config) } else { httpClient = http.DefaultClient } @@ -51,7 +52,7 @@ func NewClient(config *Config) *Client { } } -func newTlsHttpClient(config *Config) *http.Client { +func newTLSHTTPClient(config *Config) *http.Client { homeDir, err := os.UserHomeDir() if err != nil { log.Fatal("[ERROR]", err) diff --git a/client/client_auth.go b/client/client_auth.go index d62e27e..2688f29 100644 --- a/client/client_auth.go +++ b/client/client_auth.go @@ -9,6 +9,7 @@ type Auth struct { Insecure bool } +// NewAuth new auth func NewAuth() *Auth { return &Auth{ Enabled: true, diff --git a/client/delete_manifest_mode.go b/client/delete_manifest_mode.go index 2d02eac..7f06021 100644 --- a/client/delete_manifest_mode.go +++ b/client/delete_manifest_mode.go @@ -1,34 +1,39 @@ package client import ( - "errors" "fmt" ) +// DeleteManifestMode delete manfiest mode type DeleteManifestMode int const ( + // DeleteManifestModeUnknown unknown DeleteManifestModeUnknown DeleteManifestMode = iota + // DeleteManifestModeStatic static DeleteManifestModeStatic ) -func (t DeleteManifestMode) String() string { - return [...]string{"unknown", "static"}[t] +func (m DeleteManifestMode) String() string { + return [...]string{"unknown", "static"}[m] } +// ParseDeleteManifestMode mode func ParseDeleteManifestMode(s string) (DeleteManifestMode, error) { switch s { default: - return DeleteManifestModeUnknown, errors.New(fmt.Sprintf("Unknown Mode %s", s)) + return DeleteManifestModeUnknown, fmt.Errorf("Unknown Mode %s", s) case "static": return DeleteManifestModeStatic, nil } } +// MarshalText marshal text func (m DeleteManifestMode) MarshalText() ([]byte, error) { return []byte(m.String()), nil } +// UnmarshalText unmarshal text func (m *DeleteManifestMode) UnmarshalText(text []byte) error { mode, err := ParseDeleteManifestMode(string(text)) if err != nil { diff --git a/client/delete_manifest_options.go b/client/delete_manifest_options.go index 1795e59..7e44c1d 100644 --- a/client/delete_manifest_options.go +++ b/client/delete_manifest_options.go @@ -1,9 +1,11 @@ package client +// DeleteManifestOptions options type DeleteManifestOptions struct { Cascading bool `json:"cascading"` } +// NewDeleteManifestOptions new options func NewDeleteManifestOptions() *DeleteManifestOptions { return &DeleteManifestOptions{ Cascading: true, diff --git a/client/delete_manifest_stage.go b/client/delete_manifest_stage.go index 451df5f..9a2a232 100644 --- a/client/delete_manifest_stage.go +++ b/client/delete_manifest_stage.go @@ -13,6 +13,7 @@ func init() { stageFactories[DeleteManifestStageType] = parseDeleteManifestStage } +// DeleteManifestStage stage type DeleteManifestStage struct { BaseStage `mapstructure:",squash"` @@ -25,6 +26,7 @@ type DeleteManifestStage struct { Options *DeleteManifestOptions `json:"options"` } +// NewDeleteManifestStage new stage func NewDeleteManifestStage() *DeleteManifestStage { return &DeleteManifestStage{ BaseStage: *newBaseStage(DeleteManifestStageType), diff --git a/client/deploy_manifest_source.go b/client/deploy_manifest_source.go index c0d2557..a306ad7 100644 --- a/client/deploy_manifest_source.go +++ b/client/deploy_manifest_source.go @@ -2,11 +2,15 @@ package client import "log" +// DeployManifestSource source type DeployManifestSource int const ( + // DeployManifestSourceUnknown unknown DeployManifestSourceUnknown DeployManifestSource = iota + // DeployManifestSourceText text DeployManifestSourceText + // DeployManifestSourceArtifact artifact DeployManifestSourceArtifact ) @@ -14,6 +18,7 @@ func (t DeployManifestSource) String() string { return [...]string{"UNKNOWN", "text", "artifact"}[t] } +// ParseDeployManifestSource parse func ParseDeployManifestSource(s string) (DeployManifestSource, error) { switch s { default: @@ -26,10 +31,12 @@ func ParseDeployManifestSource(s string) (DeployManifestSource, error) { } } +// MarshalText marshal func (t DeployManifestSource) MarshalText() ([]byte, error) { return []byte(t.String()), nil } +// UnmarshalText unmarshal func (t *DeployManifestSource) UnmarshalText(text []byte) error { source, err := ParseDeployManifestSource(string(text)) if err != nil { diff --git a/client/deploy_manifest_stage_test.go b/client/deploy_manifest_stage_test.go index 2a7a4c2..bc78075 100644 --- a/client/deploy_manifest_stage_test.go +++ b/client/deploy_manifest_stage_test.go @@ -32,16 +32,16 @@ func TestDeployManifestStageSerialize(t *testing.T) { t.Fatal(err) } result := string(b) - if result != deployManifestJson { + if result != deployManifestJSON { dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(deployManifestJson, result, true) + diffs := dmp.DiffMain(deployManifestJSON, result, true) t.Fatalf("Deploy Manifest not as expected: %s", dmp.DiffPrettyText(diffs)) } } func TestDeployManifestStageDeserialize(t *testing.T) { var stageMap map[string]interface{} - err := json.Unmarshal([]byte(deployManifestJson), &stageMap) + err := json.Unmarshal([]byte(deployManifestJSON), &stageMap) if err != nil { t.Fatal(err) } @@ -88,7 +88,7 @@ spec: var anotherManifestYaml = `another: 1 ` -var deployManifestJson = `{ +var deployManifestJSON = `{ "name": "New Deploy Manifest", "refId": "", "type": "deployManifest", diff --git a/client/deployment_cluster.go b/client/deployment_cluster.go index 5d9c4bc..f40d8df 100644 --- a/client/deployment_cluster.go +++ b/client/deployment_cluster.go @@ -1,8 +1,10 @@ package client +// DeployStageCluster cluster // TODO deprecated remove type DeployStageCluster DeploymentCluster +// NewDeployStageCluster new cluster func NewDeployStageCluster() *DeploymentCluster { println("[DEPRECATED] DeployStageCluster will be removed in a future version. Use DeploymentCluster") return NewDeploymentCluster() @@ -52,6 +54,7 @@ type DeploymentCluster struct { Base64UserData string `json:"base64UserData"` } +// NewDeploymentCluster new cluster func NewDeploymentCluster() *DeploymentCluster { return &DeploymentCluster{ DelayBeforeDisableSec: 0, diff --git a/client/disable_manifest_stage.go b/client/disable_manifest_stage.go index d4cb66a..fa1d031 100644 --- a/client/disable_manifest_stage.go +++ b/client/disable_manifest_stage.go @@ -11,6 +11,7 @@ func init() { stageFactories[DisableManifestStageType] = parseDisableManifestStage } +// DisableManifestStage stage type DisableManifestStage struct { BaseStage `mapstructure:",squash"` @@ -27,6 +28,7 @@ type DisableManifestStage struct { Mode string `json:"mode"` } +// NewDisableManifestStage new stage func NewDisableManifestStage() *DisableManifestStage { return &DisableManifestStage{ BaseStage: *newBaseStage(DisableManifestStageType), diff --git a/client/enable_manifest_stage.go b/client/enable_manifest_stage.go index dec1e25..b9c747c 100644 --- a/client/enable_manifest_stage.go +++ b/client/enable_manifest_stage.go @@ -11,6 +11,7 @@ func init() { stageFactories[EnableManifestStageType] = parseEnableManifestStage } +// EnableManifestStage stage type EnableManifestStage struct { BaseStage `mapstructure:",squash"` @@ -24,6 +25,7 @@ type EnableManifestStage struct { Mode string `json:"mode"` } +// NewEnableManifestStage new stage func NewEnableManifestStage() *EnableManifestStage { return &EnableManifestStage{ BaseStage: *newBaseStage(EnableManifestStageType), diff --git a/client/enable_server_group.go b/client/enable_server_group.go index d6b6f95..37bac89 100644 --- a/client/enable_server_group.go +++ b/client/enable_server_group.go @@ -7,12 +7,15 @@ import ( "github.com/ghodss/yaml" ) +// EnableServerGroups groups type EnableServerGroups []string +// NewEnableServerGroups new groups func NewEnableServerGroups() *EnableServerGroups { return &EnableServerGroups{} } +// MarshalJSON marshal func (s EnableServerGroups) MarshalJSON() ([]byte, error) { var jsonManifests []string for _, manifest := range s { @@ -26,6 +29,7 @@ func (s EnableServerGroups) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("[%s]", jsonManifestsString)), nil } +// ParseEnableServerGroups parse groups func ParseEnableServerGroups(manifestInterface []interface{}) (*EnableServerGroups, error) { manifests := NewEnableServerGroups() for _, manifest := range manifestInterface { diff --git a/client/manifest.go b/client/manifest.go index 88a2235..8d282c4 100644 --- a/client/manifest.go +++ b/client/manifest.go @@ -6,8 +6,10 @@ import ( "github.com/ghodss/yaml" ) +// Manifest manifest type Manifest string +// MarshalJSON marshal func (s Manifest) MarshalJSON() ([]byte, error) { jsonManifest, err := yaml.YAMLToJSON([]byte(s)) if err != nil { @@ -16,6 +18,7 @@ func (s Manifest) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("%s", jsonManifest)), nil } +// ParseManifest parse func ParseManifest(manifestInterface interface{}) (Manifest, error) { manifest, err := yaml.Marshal(manifestInterface) if err != nil { diff --git a/client/manifests.go b/client/manifests.go index a3cdc26..c909ad6 100644 --- a/client/manifests.go +++ b/client/manifests.go @@ -5,12 +5,15 @@ import ( "strings" ) +// Manifests manifests type Manifests []Manifest +// NewManifests new manifests func NewManifests() *Manifests { return &Manifests{} } +// MarshalJSON marshal func (s Manifests) MarshalJSON() ([]byte, error) { var jsonManifests []string for _, manifest := range s { @@ -24,6 +27,7 @@ func (s Manifests) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("[%s]", jsonManifestsString)), nil } +// ParseManifests parse func ParseManifests(manifestInterface []interface{}) (*Manifests, error) { manifests := NewManifests() for _, m := range manifestInterface { diff --git a/client/notification.go b/client/notification.go index 88b74ee..6818906 100644 --- a/client/notification.go +++ b/client/notification.go @@ -19,6 +19,7 @@ type Notification struct { Message Message `json:"message"` } +// NewNotification new notification func NewNotification() *Notification { return &Notification{} } diff --git a/client/pipeline_parameter.go b/client/pipeline_parameter.go index 357edd9..fd379c8 100644 --- a/client/pipeline_parameter.go +++ b/client/pipeline_parameter.go @@ -7,10 +7,12 @@ import ( // ErrParameterNotFound parameter not found var ErrParameterNotFound = errors.New("could not find parameter") +// PipelineParameterOption option type PipelineParameterOption struct { Value string `json:"value"` } +// PipelineParameter parameter type PipelineParameter struct { ID string `json:"id"` Default string `json:"default"` diff --git a/client/pipeline_service_test.go b/client/pipeline_service_test.go index 3e592fe..44bb7f1 100644 --- a/client/pipeline_service_test.go +++ b/client/pipeline_service_test.go @@ -83,16 +83,16 @@ func TestCreateUpdateDeletePipeline(t *testing.T) { NewBakeStage(), } pipeline.ParameterConfig = &[]*PipelineParameter{ - &PipelineParameter{Name: "new parameter"}, - &PipelineParameter{Name: "descriptive parameter", Description: "This is a very descriptive parameter."}, - &PipelineParameter{ + {Name: "new parameter"}, + {Name: "descriptive parameter", Description: "This is a very descriptive parameter."}, + { Name: "Options parameter", Default: "mosdef", Description: "Setting parameter via options.", HasOptions: true, Label: "mosdef label", Options: &[]*PipelineParameterOption{ - &PipelineParameterOption{Value: "something"}, + {Value: "something"}, }, Required: true, }, diff --git a/client/precondition.go b/client/precondition.go index ac3edad..e8f86e0 100644 --- a/client/precondition.go +++ b/client/precondition.go @@ -7,15 +7,18 @@ import ( "github.com/mitchellh/mapstructure" ) +// Precondition precondition type Precondition interface { GetType() PreconditionType } +// BasePrecondition base type BasePrecondition struct { FailPipeline bool `json:"failPipeline"` Type PreconditionType `json:"type"` } +// NewBasePrecondition new base func NewBasePrecondition(t PreconditionType) *BasePrecondition { return &BasePrecondition{ FailPipeline: true, @@ -23,10 +26,12 @@ func NewBasePrecondition(t PreconditionType) *BasePrecondition { } } +// GetType get type func (p *BasePrecondition) GetType() PreconditionType { return p.Type } +// ParsePreconditions parse func ParsePreconditions(toParse []interface{}) ([]Precondition, error) { preconditions := []Precondition{} @@ -52,6 +57,7 @@ func ParsePreconditions(toParse []interface{}) ([]Precondition, error) { return preconditions, nil } +// ParsePrecondition parse func ParsePrecondition(i map[string]interface{}, t PreconditionType) (Precondition, error) { preconditionFunc, ok := preconditionFactory[t] if !ok { diff --git a/client/precondition_cluster_size.go b/client/precondition_cluster_size.go index f4746d9..d1182a4 100644 --- a/client/precondition_cluster_size.go +++ b/client/precondition_cluster_size.go @@ -4,25 +4,28 @@ import ( "github.com/mitchellh/mapstructure" ) -// PreconditionClusterSizeType +// PreconditionClusterSizeType type var PreconditionClusterSizeType PreconditionType = "clusterSize" func init() { preconditionFactory[PreconditionClusterSizeType] = parsePreconditionClusterSize } +// PreconditionClusterSizeContext context type PreconditionClusterSizeContext struct { Credentials string `json:"credentials"` Expected int `json:"expected"` Regions []string `json:"regions"` } +// PreconditionClusterSize size type PreconditionClusterSize struct { BasePrecondition `mapstructure:",squash"` Context PreconditionClusterSizeContext `json:"context"` } +// NewPreconditionClusterSize new size func NewPreconditionClusterSize() *PreconditionClusterSize { return &PreconditionClusterSize{ BasePrecondition: *NewBasePrecondition(PreconditionClusterSizeType), diff --git a/client/precondition_expression.go b/client/precondition_expression.go index 30012b4..1ef57e3 100644 --- a/client/precondition_expression.go +++ b/client/precondition_expression.go @@ -4,23 +4,26 @@ import ( "github.com/mitchellh/mapstructure" ) -// PreconditionExpressionType +// PreconditionExpressionType type var PreconditionExpressionType PreconditionType = "expression" func init() { preconditionFactory[PreconditionExpressionType] = parsePreconditionExpression } +// PreconditionExpressionContext context type PreconditionExpressionContext struct { Expression string `json:"expression"` } +// PreconditionExpression expression type PreconditionExpression struct { BasePrecondition `mapstructure:",squash"` Context PreconditionExpressionContext `json:"context"` } +// NewPreconditionExpression new expression func NewPreconditionExpression() *PreconditionExpression { return &PreconditionExpression{ BasePrecondition: *NewBasePrecondition(PreconditionExpressionType), diff --git a/client/precondition_stage_status.go b/client/precondition_stage_status.go index d286699..43a926f 100644 --- a/client/precondition_stage_status.go +++ b/client/precondition_stage_status.go @@ -2,24 +2,27 @@ package client import "github.com/mitchellh/mapstructure" -// PreconditionStageStatusType +// PreconditionStageStatusType type var PreconditionStageStatusType PreconditionType = "stageStatus" func init() { preconditionFactory[PreconditionStageStatusType] = parsePreconditionStageStatus } +// PreconditionStageStatusContext context type PreconditionStageStatusContext struct { StageName string `json:"stageName"` StageStatus string `json:"stageStatus"` } +// PreconditionStageStatus status type PreconditionStageStatus struct { BasePrecondition `mapstructure:",squash"` Context PreconditionStageStatusContext `json:"context"` } +// NewPreconditionStageStatus new status func NewPreconditionStageStatus() *PreconditionStageStatus { return &PreconditionStageStatus{ BasePrecondition: *NewBasePrecondition(PreconditionStageStatusType), diff --git a/client/relationships.go b/client/relationships.go index e7da031..20fbf74 100644 --- a/client/relationships.go +++ b/client/relationships.go @@ -1,10 +1,12 @@ package client +// Relationships relationships type Relationships struct { LoadBalancers *[]string `json:"loadBalancers"` SecurityGroups *[]string `json:"securityGroups"` } +// NewRelationships new relationships func NewRelationships() *Relationships { return &Relationships{ LoadBalancers: &[]string{}, diff --git a/client/rollback.go b/client/rollback.go index 2ea68f3..1aafd69 100644 --- a/client/rollback.go +++ b/client/rollback.go @@ -1,9 +1,11 @@ package client +// Rollback rollback type Rollback struct { OnFailure bool `json:"onFailure"` } +// NewRollback new rollback func NewRollback() *Rollback { return &Rollback{ OnFailure: false, diff --git a/client/run_job_manifest_stage_test.go b/client/run_job_manifest_stage_test.go index 357394b..e0c63ee 100644 --- a/client/run_job_manifest_stage_test.go +++ b/client/run_job_manifest_stage_test.go @@ -35,16 +35,16 @@ func TestRunJobManifestStageSerialize(t *testing.T) { t.Fatal(err) } result := string(b) - if result != runJobManifestJson { + if result != runJobManifestJSON { dmp := diffmatchpatch.New() - diffs := dmp.DiffMain(runJobManifestJson, result, true) + diffs := dmp.DiffMain(runJobManifestJSON, result, true) t.Fatalf("Run Job Manifest not as expected: %s", dmp.DiffPrettyText(diffs)) } } func TestRunJobManifestStageDeserialize(t *testing.T) { var stageMap map[string]interface{} - err := json.Unmarshal([]byte(runJobManifestJson), &stageMap) + err := json.Unmarshal([]byte(runJobManifestJSON), &stageMap) if err != nil { t.Fatal(err) } @@ -73,7 +73,7 @@ spec: name: halyard ` -var runJobManifestJson = `{ +var runJobManifestJSON = `{ "name": "Run Job (Manifest)", "refId": "", "type": "runJobManifest", diff --git a/client/scale_manifest_source.go b/client/scale_manifest_source.go index bde250d..04d0505 100644 --- a/client/scale_manifest_source.go +++ b/client/scale_manifest_source.go @@ -2,10 +2,13 @@ package client import "log" +// ScaleManifestSource source type ScaleManifestSource int const ( + // ScaleManifestSourceUnknown unknown ScaleManifestSourceUnknown ScaleManifestSource = iota + // ScaleManifestSourceText text ScaleManifestSourceText ) @@ -13,6 +16,7 @@ func (t ScaleManifestSource) String() string { return [...]string{"UNKNOWN", "text"}[t] } +// ParseScaleManifestSource parse func ParseScaleManifestSource(s string) (ScaleManifestSource, error) { switch s { default: @@ -23,10 +27,12 @@ func ParseScaleManifestSource(s string) (ScaleManifestSource, error) { } } +// MarshalText marshal func (t ScaleManifestSource) MarshalText() ([]byte, error) { return []byte(t.String()), nil } +// UnmarshalText unmarshal func (t *ScaleManifestSource) UnmarshalText(text []byte) error { source, err := ParseScaleManifestSource(string(text)) if err != nil { diff --git a/client/scale_manifest_stage.go b/client/scale_manifest_stage.go index 4be86f4..6903486 100644 --- a/client/scale_manifest_stage.go +++ b/client/scale_manifest_stage.go @@ -11,6 +11,7 @@ func init() { stageFactories[ScaleManifestStageType] = parseScaleManifestStage } +// ScaleManifestStage stage type ScaleManifestStage struct { BaseStage `mapstructure:",squash"` @@ -28,6 +29,7 @@ type ScaleManifestStage struct { Replicas string `json:"replicas"` } +// NewScaleManifestStage new stage func NewScaleManifestStage() *ScaleManifestStage { return &ScaleManifestStage{ BaseStage: *newBaseStage(ScaleManifestStageType), diff --git a/client/scale_manifests.go b/client/scale_manifests.go index 4740a06..f8ba387 100644 --- a/client/scale_manifests.go +++ b/client/scale_manifests.go @@ -7,12 +7,15 @@ import ( "github.com/ghodss/yaml" ) +// ScaleManifests scale type ScaleManifests []string +// NewScaleManifests new scale func NewScaleManifests() *ScaleManifests { return &ScaleManifests{} } +// MarshalJSON marshal func (s ScaleManifests) MarshalJSON() ([]byte, error) { var jsonManifests []string for _, manifest := range s { @@ -26,6 +29,7 @@ func (s ScaleManifests) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("[%s]", jsonManifestsString)), nil } +// ParseScaleManifests parse func ParseScaleManifests(manifestInterface []interface{}) (*ScaleManifests, error) { manifests := NewScaleManifests() for _, manifest := range manifestInterface { diff --git a/client/spinnaker_error.go b/client/spinnaker_error.go index 9093000..6d8ec5a 100644 --- a/client/spinnaker_error.go +++ b/client/spinnaker_error.go @@ -16,6 +16,7 @@ type SpinnakerError struct { Body string `json:"body"` } +// UnmarshalJSON unmarshal func (e *SpinnakerError) UnmarshalJSON(bytes []byte) error { var errorMap map[string]interface{} if err := json.Unmarshal(bytes, &errorMap); err != nil { @@ -56,8 +57,7 @@ func (e *SpinnakerError) UnmarshalJSON(bytes []byte) error { return nil } -// For error interface -func (r *SpinnakerError) Error() string { - return fmt.Sprintf("%d %v: %v%v\n%v", r.Status, r.ErrorMsg, r.Message, - r.Body, r.Exception) +func (e *SpinnakerError) Error() string { + return fmt.Sprintf("%d %v: %v%v\n%v", e.Status, e.ErrorMsg, e.Message, + e.Body, e.Exception) } diff --git a/client/traffic_management.go b/client/traffic_management.go index bd939b8..dcba427 100644 --- a/client/traffic_management.go +++ b/client/traffic_management.go @@ -1,10 +1,12 @@ package client +// TrafficManagement traffic type TrafficManagement struct { Enabled bool `json:"enabled"` Options *TrafficManagementOptions `json:"options"` } +// NewTrafficManagement new traffic func NewTrafficManagement() *TrafficManagement { return &TrafficManagement{ Enabled: false, diff --git a/client/traffic_management_options.go b/client/traffic_management_options.go index 8955bcb..cd14b18 100644 --- a/client/traffic_management_options.go +++ b/client/traffic_management_options.go @@ -1,5 +1,6 @@ package client +// TrafficManagementOptions options type TrafficManagementOptions struct { EnableTraffic bool `json:"enableTraffic"` Namespace string `json:"namespace,omitempty"` @@ -7,6 +8,7 @@ type TrafficManagementOptions struct { Strategy string `json:"strategy,omitempty"` } +// NewTrafficManagementOptions new options func NewTrafficManagementOptions() *TrafficManagementOptions { return &TrafficManagementOptions{ EnableTraffic: false, diff --git a/client/trigger.go b/client/trigger.go index 9824f41..494ecb7 100644 --- a/client/trigger.go +++ b/client/trigger.go @@ -25,8 +25,8 @@ func (p *Pipeline) GetTrigger(triggerID string) (Trigger, error) { } // AppendTrigger append trigger -func (pipeline *Pipeline) AppendTrigger(trigger Trigger) { - pipeline.Triggers = append(pipeline.Triggers, trigger) +func (p *Pipeline) AppendTrigger(trigger Trigger) { + p.Triggers = append(p.Triggers, trigger) } // UpdateTrigger in pipeline diff --git a/client/trigger_docker.go b/client/trigger_docker.go index 86745a7..6c70803 100644 --- a/client/trigger_docker.go +++ b/client/trigger_docker.go @@ -9,7 +9,7 @@ func init() { triggerFactories[DockerTriggerType] = parseDockerTrigger } -// Docker Trigger for Pipeline +// DockerTrigger for Pipeline type DockerTrigger struct { baseTrigger `mapstructure:",squash"` @@ -20,6 +20,7 @@ type DockerTrigger struct { Tag string `json:"tag"` } +// NewDockerTrigger new trigger func NewDockerTrigger() *DockerTrigger { return &DockerTrigger{ baseTrigger: *newBaseTrigger(DockerTriggerType), diff --git a/client/trigger_jenkins.go b/client/trigger_jenkins.go index 8a1c109..ad14fcf 100644 --- a/client/trigger_jenkins.go +++ b/client/trigger_jenkins.go @@ -9,7 +9,7 @@ func init() { triggerFactories[JenkinsTriggerType] = parseJenkinsTrigger } -// Jenkins Trigger for Pipeline +// JenkinsTrigger for Pipeline type JenkinsTrigger struct { baseTrigger `mapstructure:",squash"` @@ -18,6 +18,7 @@ type JenkinsTrigger struct { PropertyFile string `json:"propertyFile"` } +// NewJenkinsTrigger new trigger func NewJenkinsTrigger() *JenkinsTrigger { return &JenkinsTrigger{ baseTrigger: *newBaseTrigger(JenkinsTriggerType), diff --git a/client/trigger_pipeline.go b/client/trigger_pipeline.go index e9462c0..0dc9675 100644 --- a/client/trigger_pipeline.go +++ b/client/trigger_pipeline.go @@ -9,7 +9,7 @@ func init() { triggerFactories[PipelineTriggerType] = parsePipelineTrigger } -// Pipeline Trigger for Pipeline +// PipelineTrigger for Pipeline type PipelineTrigger struct { baseTrigger `mapstructure:",squash"` @@ -18,6 +18,7 @@ type PipelineTrigger struct { Status []string `json:"status"` } +// NewPipelineTrigger new trigger func NewPipelineTrigger() *PipelineTrigger { return &PipelineTrigger{ baseTrigger: *newBaseTrigger(PipelineTriggerType), diff --git a/client/undo_rollout_manifest.go b/client/undo_rollout_manifest.go index edc1a67..1de694f 100644 --- a/client/undo_rollout_manifest.go +++ b/client/undo_rollout_manifest.go @@ -7,12 +7,15 @@ import ( "github.com/ghodss/yaml" ) +// UndoRolloutManifests undo manifests type UndoRolloutManifests []string +// NewUndoRolloutManifests new manifests func NewUndoRolloutManifests() *UndoRolloutManifests { return &UndoRolloutManifests{} } +// MarshalJSON marshal func (s UndoRolloutManifests) MarshalJSON() ([]byte, error) { var jsonManifests []string for _, manifest := range s { @@ -26,6 +29,7 @@ func (s UndoRolloutManifests) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("[%s]", jsonManifestsString)), nil } +// ParseUndoRolloutManifests parse func ParseUndoRolloutManifests(manifestInterface []interface{}) (*UndoRolloutManifests, error) { manifests := NewUndoRolloutManifests() for _, manifest := range manifestInterface { diff --git a/client/undo_rollout_manifest_stage.go b/client/undo_rollout_manifest_stage.go index cd1f141..59e7728 100644 --- a/client/undo_rollout_manifest_stage.go +++ b/client/undo_rollout_manifest_stage.go @@ -11,6 +11,7 @@ func init() { stageFactories[UndoRolloutManifestStageType] = parseUndoRolloutManifestStage } +// UndoRolloutManifestStage undo stage type UndoRolloutManifestStage struct { BaseStage `mapstructure:",squash"` @@ -22,6 +23,7 @@ type UndoRolloutManifestStage struct { NumRevisionsBack int `json:"numRevisionsBack"` } +// NewUndoRolloutManifestStage new stage func NewUndoRolloutManifestStage() *UndoRolloutManifestStage { return &UndoRolloutManifestStage{ BaseStage: *newBaseStage(UndoRolloutManifestStageType), diff --git a/provider/application_provider_settings.go b/provider/application_provider_settings.go index 3bd13cc..927771d 100644 --- a/provider/application_provider_settings.go +++ b/provider/application_provider_settings.go @@ -45,7 +45,7 @@ func fromClientProviderSettings(settings *client.ProviderSettings) *[]providerSe } return &[]providerSettings{ - providerSettings{ + { AWS: &[]awsProviderSettings{ {UseAmiBlockDeviceMappings: settings.AWS.UseAmiBlockDeviceMappings}, }, diff --git a/provider/application_resource.go b/provider/application_resource.go index 4986c4f..59acb26 100644 --- a/provider/application_resource.go +++ b/provider/application_resource.go @@ -31,7 +31,7 @@ func applicationResource() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "accounts": &schema.Schema{ + "accounts": { Type: schema.TypeList, Description: "Accounts", Computed: true, @@ -39,7 +39,7 @@ func applicationResource() *schema.Resource { Type: schema.TypeString, }, }, - "cloud_providers": &schema.Schema{ + "cloud_providers": { Type: schema.TypeList, Description: "Cloud Providers", Optional: true, @@ -47,7 +47,7 @@ func applicationResource() *schema.Resource { Type: schema.TypeString, }, }, - "email": &schema.Schema{ + "email": { Type: schema.TypeString, Description: "Email Address", Required: true, @@ -59,13 +59,13 @@ func applicationResource() *schema.Resource { return }, }, - "enable_restart_running_executions": &schema.Schema{ + "enable_restart_running_executions": { Type: schema.TypeBool, Description: "Enable restarting running pipelines", Optional: true, Default: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Description: "Application Name", Required: true, @@ -82,31 +82,31 @@ func applicationResource() *schema.Resource { return }, }, - "instance_port": &schema.Schema{ + "instance_port": { Type: schema.TypeInt, Optional: true, }, - "permissions": &schema.Schema{ + "permissions": { Type: schema.TypeList, MaxItems: 1, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "execute": &schema.Schema{ + "execute": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "read": &schema.Schema{ + "read": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "write": &schema.Schema{ + "write": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ @@ -116,31 +116,31 @@ func applicationResource() *schema.Resource { }, }, }, - "platform_health_only": &schema.Schema{ + "platform_health_only": { Type: schema.TypeBool, Description: "Consider only cloud provider health when executing tasks", Optional: true, Default: true, }, - "platform_health_only_show_override": &schema.Schema{ + "platform_health_only_show_override": { Type: schema.TypeBool, Description: "Show health override option for each operation", Optional: true, Default: false, }, - "provider_settings": &schema.Schema{ + "provider_settings": { Type: schema.TypeList, MaxItems: 1, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "aws": &schema.Schema{ + "aws": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "use_ami_block_device_mappings": &schema.Schema{ + "use_ami_block_device_mappings": { Description: "Prefer AMI Block Device Mappings", Type: schema.TypeBool, Optional: true, @@ -152,17 +152,17 @@ func applicationResource() *schema.Resource { }, }, }, - "repo_project_key": &schema.Schema{ + "repo_project_key": { Type: schema.TypeString, Description: "Repository project key", Optional: true, }, - "repo_slug": &schema.Schema{ + "repo_slug": { Type: schema.TypeString, Description: "Repository slug", Optional: true, }, - "repo_type": &schema.Schema{ + "repo_type": { Type: schema.TypeString, Description: "Repository type", Optional: true, diff --git a/provider/availibility_zones_resource.go b/provider/availibility_zones_resource.go index fabb32d..3be04e4 100644 --- a/provider/availibility_zones_resource.go +++ b/provider/availibility_zones_resource.go @@ -7,147 +7,147 @@ import ( func availabilityZonesResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "us_east_1": &schema.Schema{ + "us_east_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "us_east_2": &schema.Schema{ + "us_east_2": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "us_west_1": &schema.Schema{ + "us_west_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "us_west_2": &schema.Schema{ + "us_west_2": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_south_1": &schema.Schema{ + "ap_south_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_northeast_3": &schema.Schema{ + "ap_northeast_3": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_northeast_2": &schema.Schema{ + "ap_northeast_2": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_southeast_1": &schema.Schema{ + "ap_southeast_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_southeast_2": &schema.Schema{ + "ap_southeast_2": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ap_northeast_1": &schema.Schema{ + "ap_northeast_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "ca_central_1": &schema.Schema{ + "ca_central_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "cn_north_1": &schema.Schema{ + "cn_north_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "cn_northwest_1": &schema.Schema{ + "cn_northwest_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "eu_central_1": &schema.Schema{ + "eu_central_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "eu_west_1": &schema.Schema{ + "eu_west_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "eu_west_2": &schema.Schema{ + "eu_west_2": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "eu_west_3": &schema.Schema{ + "eu_west_3": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "eu_north_1": &schema.Schema{ + "eu_north_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "sa_east_1": &schema.Schema{ + "sa_east_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "us_gov_east_1": &schema.Schema{ + "us_gov_east_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "us_gov_west_1": &schema.Schema{ + "us_gov_west_1": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ diff --git a/provider/canary_config_classifier_resource.go b/provider/canary_config_classifier_resource.go index 2e31527..7353b70 100644 --- a/provider/canary_config_classifier_resource.go +++ b/provider/canary_config_classifier_resource.go @@ -7,7 +7,7 @@ import ( func canaryConfigClassifierResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "group_weights": &schema.Schema{ + "group_weights": { Type: schema.TypeMap, Required: true, }, diff --git a/provider/canary_config_data_source.go b/provider/canary_config_data_source.go index 80742b5..4671278 100644 --- a/provider/canary_config_data_source.go +++ b/provider/canary_config_data_source.go @@ -12,12 +12,12 @@ func canaryConfigDataSource() *schema.Resource { Read: canaryConfigDataSourceRead, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Description: "Canary Config Name", Required: true, }, - "applications": &schema.Schema{ + "applications": { Type: schema.TypeList, Description: "Applications", Optional: true, @@ -25,32 +25,32 @@ func canaryConfigDataSource() *schema.Resource { Type: schema.TypeString, }, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Description: "Canary Config Description", Optional: true, }, - "metric": &schema.Schema{ + "metric": { Type: schema.TypeList, Description: "Canary Metrics", Optional: true, Elem: canaryConfigMetricResource(), }, - "config_version": &schema.Schema{ + "config_version": { Type: schema.TypeString, Description: "Canary Config Version", Optional: true, Default: "1", }, // Templates map[string]interface{} `mapstructure:"templates"` - "classifier": &schema.Schema{ + "classifier": { Type: schema.TypeList, Description: "Canary Classifier", MaxItems: 1, Optional: true, Elem: canaryConfigClassifierResource(), }, - "judge": &schema.Schema{ + "judge": { Type: schema.TypeList, Description: "Canary Judge", MaxItems: 1, diff --git a/provider/canary_config_judge_resource.go b/provider/canary_config_judge_resource.go index ded0974..d4d5c26 100644 --- a/provider/canary_config_judge_resource.go +++ b/provider/canary_config_judge_resource.go @@ -7,7 +7,7 @@ import ( func canaryConfigJudgeResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, diff --git a/provider/canary_config_metric_query_resource.go b/provider/canary_config_metric_query_resource.go index 08f5840..b65d3fb 100644 --- a/provider/canary_config_metric_query_resource.go +++ b/provider/canary_config_metric_query_resource.go @@ -7,15 +7,15 @@ import ( func canaryConfigMetricQueryResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, }, - "service_type": &schema.Schema{ + "service_type": { Type: schema.TypeString, Required: true, }, - "metric_name": &schema.Schema{ + "metric_name": { Type: schema.TypeString, Required: true, }, diff --git a/provider/canary_config_metric_resource.go b/provider/canary_config_metric_resource.go index 14a1a36..798f5ee 100644 --- a/provider/canary_config_metric_resource.go +++ b/provider/canary_config_metric_resource.go @@ -7,24 +7,24 @@ import ( func canaryConfigMetricResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "query": &schema.Schema{ + "query": { Type: schema.TypeList, MaxItems: 1, Required: true, Elem: canaryConfigMetricQueryResource(), }, - "groups": &schema.Schema{ + "groups": { Type: schema.TypeList, Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "scope_name": &schema.Schema{ + "scope_name": { Type: schema.TypeString, Optional: true, Default: "default", diff --git a/provider/canary_config_resource.go b/provider/canary_config_resource.go index fea959b..3fc5583 100644 --- a/provider/canary_config_resource.go +++ b/provider/canary_config_resource.go @@ -19,12 +19,12 @@ func canaryConfigResource() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Description: "Canary Config Name", Required: true, }, - "applications": &schema.Schema{ + "applications": { Type: schema.TypeList, Description: "Applications", Required: true, @@ -32,32 +32,32 @@ func canaryConfigResource() *schema.Resource { Type: schema.TypeString, }, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Description: "Canary Config Description", Optional: true, }, - "metric": &schema.Schema{ + "metric": { Type: schema.TypeList, Description: "Canary Metrics", Required: true, Elem: canaryConfigMetricResource(), }, - "config_version": &schema.Schema{ + "config_version": { Type: schema.TypeString, Description: "Canary Config Version", Optional: true, Default: "1", }, // Templates map[string]interface{} `mapstructure:"templates"` - "classifier": &schema.Schema{ + "classifier": { Type: schema.TypeList, Description: "Canary Classifier", MaxItems: 1, Required: true, Elem: canaryConfigClassifierResource(), }, - "judge": &schema.Schema{ + "judge": { Type: schema.TypeList, Description: "Canary Judge", MaxItems: 1, diff --git a/provider/capacity_resource.go b/provider/capacity_resource.go index ff7f61e..ef738d1 100644 --- a/provider/capacity_resource.go +++ b/provider/capacity_resource.go @@ -7,15 +7,15 @@ import ( func capacityResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "desired": &schema.Schema{ + "desired": { Type: schema.TypeString, Optional: true, }, - "max": &schema.Schema{ + "max": { Type: schema.TypeString, Optional: true, }, - "min": &schema.Schema{ + "min": { Type: schema.TypeString, Optional: true, }, diff --git a/provider/cluster_resource.go b/provider/cluster_resource.go index 6fbb4bf..003b296 100644 --- a/provider/cluster_resource.go +++ b/provider/cluster_resource.go @@ -7,52 +7,52 @@ import ( func clusterResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeMap, Required: true, }, - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Required: true, }, - "availability_zones": &schema.Schema{ + "availability_zones": { Type: schema.TypeList, Description: "Availability zones to deploy cluster", MaxItems: 1, Required: true, Elem: availabilityZonesResource(), }, - "capacity": &schema.Schema{ + "capacity": { Type: schema.TypeList, Description: "Capacity for cluster", MaxItems: 1, Optional: true, Elem: capacityResource(), }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Required: true, }, - "cooldown": &schema.Schema{ + "cooldown": { Type: schema.TypeInt, Optional: true, Default: 10, }, - "copy_source_custom_block_device_mappings": &schema.Schema{ + "copy_source_custom_block_device_mappings": { Type: schema.TypeBool, Optional: true, Default: false, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Optional: true, }, - "ebs_optimized": &schema.Schema{ + "ebs_optimized": { Type: schema.TypeBool, Optional: true, Default: false, }, - "enabled_metrics": &schema.Schema{ + "enabled_metrics": { Type: schema.TypeList, Description: "Metrics to be enabled for cluster", Optional: true, @@ -60,44 +60,44 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "free_form_details": &schema.Schema{ + "free_form_details": { Type: schema.TypeString, Description: "Detail is a string of free-form alphanumeric characters and hyphens to describe any other variables.", Optional: true, }, - "health_check_grace_period": &schema.Schema{ + "health_check_grace_period": { Type: schema.TypeString, Description: "Health check grace period for cluster", Optional: true, Default: "300", }, - "health_check_type": &schema.Schema{ + "health_check_type": { Type: schema.TypeString, Description: "Type of health check for cluster (ELB, EC2)", Required: true, }, - "iam_role": &schema.Schema{ + "iam_role": { Type: schema.TypeString, Description: "IAM instance profile", Optional: true, }, - "instance_monitoring": &schema.Schema{ + "instance_monitoring": { Type: schema.TypeBool, Description: "Instance Monitoring whether to enable detailed monitoring of instances. Group metrics must be disabled to update an ASG with Instance Monitoring set to false.", Optional: true, Default: false, }, - "instance_type": &schema.Schema{ + "instance_type": { Type: schema.TypeString, Description: "Instance Type for cluster", Required: true, }, - "key_pair": &schema.Schema{ + "key_pair": { Type: schema.TypeString, Description: "Key pair name for cluster", Required: true, }, - "load_balancers": &schema.Schema{ + "load_balancers": { Type: schema.TypeList, Description: "Load balancer to attach to cluster", Optional: true, @@ -105,7 +105,7 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "security_groups": &schema.Schema{ + "security_groups": { Type: schema.TypeList, Description: "Security Groups to attach to cluster", Optional: true, @@ -113,7 +113,7 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "spel_load_balancers": &schema.Schema{ + "spel_load_balancers": { Type: schema.TypeList, Description: "spel load balancers to attach to cluster", Optional: true, @@ -121,7 +121,7 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "spel_target_groups": &schema.Schema{ + "spel_target_groups": { Type: schema.TypeList, Description: "spel target groups to attach to cluster", Optional: true, @@ -129,34 +129,34 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "stack": &schema.Schema{ + "stack": { Type: schema.TypeString, Description: "stack name for cluster", Optional: true, }, - "strategy": &schema.Schema{ + "strategy": { Type: schema.TypeString, Description: "strategy for deploy (redblack, etc)", Required: true, }, - "subnet_type": &schema.Schema{ + "subnet_type": { Type: schema.TypeString, Description: "subnet to deploy cluster", Required: true, }, - "suspended_processes": &schema.Schema{ + "suspended_processes": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeMap, Description: "tags to put on cluster", Optional: true, }, - "target_groups": &schema.Schema{ + "target_groups": { Type: schema.TypeList, Description: "target groups to attach to cluster", Optional: true, @@ -164,13 +164,13 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "target_healthy_deploy_percentage": &schema.Schema{ + "target_healthy_deploy_percentage": { Type: schema.TypeInt, Description: "Consider deployment successful when percent of instances are healthy", Optional: true, Default: 100, }, - "termination_policies": &schema.Schema{ + "termination_policies": { Type: schema.TypeList, Description: "Termination policy names for cluster", Optional: true, @@ -178,13 +178,13 @@ func clusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "use_ami_block_device_mappings": &schema.Schema{ + "use_ami_block_device_mappings": { Type: schema.TypeBool, Description: "Use the block device mappings from the selected AMI when deploying a new server group", Optional: true, Default: false, }, - "use_source_capacity": &schema.Schema{ + "use_source_capacity": { Type: schema.TypeBool, Description: "Spinnaker will use the current capacity of the existing server group when deploying a new server group.\nThis setting is intended to support a server group with auto-scaling enabled, where the bounds and desired capacity are controlled by an external process.\nIn the event that there is no existing server group, the deploy will fail.", Optional: true, diff --git a/provider/deploy_stage_cluster_resource.go b/provider/deploy_stage_cluster_resource.go index 44f181f..61af138 100644 --- a/provider/deploy_stage_cluster_resource.go +++ b/provider/deploy_stage_cluster_resource.go @@ -7,59 +7,59 @@ import ( func pipelineDeployStageClusterResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "Account to deploy cluster", Required: true, }, - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Description: "Application to deploy cluster", Required: true, }, - "availability_zones": &schema.Schema{ + "availability_zones": { Type: schema.TypeList, Description: "Availability zones to deploy cluster", MaxItems: 1, Required: true, Elem: availabilityZonesResource(), }, - "capacity": &schema.Schema{ + "capacity": { Type: schema.TypeList, Description: "Capacity for cluster", MaxItems: 1, Optional: true, Elem: capacityResource(), }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud Provider to deploy cluster", Required: true, }, - "cooldown": &schema.Schema{ + "cooldown": { Type: schema.TypeInt, Description: "Cooldown to deploy cluster", Optional: true, Default: 10, }, - "copy_source_custom_block_device_mappings": &schema.Schema{ + "copy_source_custom_block_device_mappings": { Type: schema.TypeBool, Description: "Spinnaker will use the block device mappings of the existing server group when deploying a new server group.\nIn the event that there is no existing server group, the defaults for the selected instance type will be used.", Optional: true, Default: false, }, - "dirty": &schema.Schema{ + "dirty": { Type: schema.TypeMap, Description: "", Optional: true, }, - "ebs_optimized": &schema.Schema{ + "ebs_optimized": { Type: schema.TypeBool, Description: "", Optional: true, Default: false, }, - "enabled_metrics": &schema.Schema{ + "enabled_metrics": { Type: schema.TypeList, Description: "Metrics to be enabled for cluster", Optional: true, @@ -67,50 +67,50 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "free_form_details": &schema.Schema{ + "free_form_details": { Type: schema.TypeString, Description: "Detail is a string of free-form alphanumeric characters and hyphens to describe any other variables.", Optional: true, }, - "health_check_grace_period": &schema.Schema{ + "health_check_grace_period": { Type: schema.TypeString, Description: "Health check grace period for cluster", Optional: true, Default: "300", }, - "health_check_type": &schema.Schema{ + "health_check_type": { Type: schema.TypeString, Description: "Type of health check for cluster (ELB, EC2)", Required: true, }, - "iam_role": &schema.Schema{ + "iam_role": { Type: schema.TypeString, Description: "IAM instance profile", Optional: true, }, - "instance_monitoring": &schema.Schema{ + "instance_monitoring": { Type: schema.TypeBool, Description: "Instance Monitoring whether to enable detailed monitoring of instances. Group metrics must be disabled to update an ASG with Instance Monitoring set to false.", Optional: true, Default: false, }, - "instance_type": &schema.Schema{ + "instance_type": { Type: schema.TypeString, Description: "Instance Type for cluster", Required: true, }, - "key_pair": &schema.Schema{ + "key_pair": { Type: schema.TypeString, Description: "Key pair name for cluster", Required: true, }, - "max_remaining_asgs": &schema.Schema{ + "max_remaining_asgs": { Type: schema.TypeInt, Description: "Max amount of asgs to run", Optional: true, Default: 2, }, - "load_balancers": &schema.Schema{ + "load_balancers": { Type: schema.TypeList, Description: "Load balancer to attach to cluster", Optional: true, @@ -118,19 +118,19 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "moniker": &schema.Schema{ + "moniker": { Type: schema.TypeList, Description: "Name to attach to cluster", Optional: true, MaxItems: 1, Elem: monikerResource(), }, - "provider": &schema.Schema{ + "provider": { Type: schema.TypeString, Description: "Provider to deploy cluster", Required: true, }, - "security_groups": &schema.Schema{ + "security_groups": { Type: schema.TypeList, Description: "Security Groups to attach to cluster", Optional: true, @@ -138,12 +138,12 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "security_groups_expression": &schema.Schema{ + "security_groups_expression": { Type: schema.TypeString, Description: "Security Group expression -- will override other sg inputs", Optional: true, }, - "spel_load_balancers": &schema.Schema{ + "spel_load_balancers": { Type: schema.TypeList, Description: "spel load balancers to attach to cluster", Optional: true, @@ -151,7 +151,7 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "spel_target_groups": &schema.Schema{ + "spel_target_groups": { Type: schema.TypeList, Description: "spel target groups to attach to cluster", Optional: true, @@ -159,39 +159,39 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "spot_price": &schema.Schema{ + "spot_price": { Type: schema.TypeString, Description: "spot price for cluster", Optional: true, }, - "stack": &schema.Schema{ + "stack": { Type: schema.TypeString, Description: "stack name for cluster", Optional: true, }, - "strategy": &schema.Schema{ + "strategy": { Type: schema.TypeString, Description: "strategy for deploy (redblack, etc)", Required: true, }, - "subnet_type": &schema.Schema{ + "subnet_type": { Type: schema.TypeString, Description: "subnet to deploy cluster", Required: true, }, - "suspended_processes": &schema.Schema{ + "suspended_processes": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeMap, Description: "tags to put on cluster", Optional: true, }, - "target_groups": &schema.Schema{ + "target_groups": { Type: schema.TypeList, Description: "target groups to attach to cluster", Optional: true, @@ -199,13 +199,13 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "target_healthy_deploy_percentage": &schema.Schema{ + "target_healthy_deploy_percentage": { Type: schema.TypeInt, Description: "Consider deployment successful when percent of instances are healthy", Optional: true, Default: 100, }, - "termination_policies": &schema.Schema{ + "termination_policies": { Type: schema.TypeList, Description: "Termination policy names for cluster", Optional: true, @@ -213,19 +213,19 @@ func pipelineDeployStageClusterResource() *schema.Resource { Type: schema.TypeString, }, }, - "use_ami_block_device_mappings": &schema.Schema{ + "use_ami_block_device_mappings": { Type: schema.TypeBool, Description: "Use the block device mappings from the selected AMI when deploying a new server group", Optional: true, Default: false, }, - "use_source_capacity": &schema.Schema{ + "use_source_capacity": { Type: schema.TypeBool, Description: "Spinnaker will use the current capacity of the existing server group when deploying a new server group.\nThis setting is intended to support a server group with auto-scaling enabled, where the bounds and desired capacity are controlled by an external process.\nIn the event that there is no existing server group, the deploy will fail.", Optional: true, Default: false, }, - "user_data": &schema.Schema{ + "user_data": { Type: schema.TypeString, Description: "UserData is a base64 encoded string.", Optional: true, diff --git a/provider/manual_judgement_notification_resource.go b/provider/manual_judgement_notification_resource.go index ab1f6e8..368a2ec 100644 --- a/provider/manual_judgement_notification_resource.go +++ b/provider/manual_judgement_notification_resource.go @@ -7,7 +7,7 @@ import ( func manualJudementNotificationResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Description: "Address of the notification (slack channel, email, etc)", Required: true, @@ -19,38 +19,38 @@ func manualJudementNotificationResource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "manual_judgment_continue": &schema.Schema{ + "manual_judgment_continue": { Type: schema.TypeString, Optional: true, }, - "manual_judgment_stop": &schema.Schema{ + "manual_judgment_stop": { Type: schema.TypeString, Optional: true, }, }, }, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Description: "Type of notification (slack, email, etc)", Required: true, }, - "when": &schema.Schema{ + "when": { Type: schema.TypeList, Description: "When to send notification (started, completed, failed)", Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "manual_judgment": &schema.Schema{ + "manual_judgment": { Type: schema.TypeBool, Optional: true, }, - "manual_judgment_continue": &schema.Schema{ + "manual_judgment_continue": { Type: schema.TypeBool, Optional: true, }, - "manual_judgment_stop": &schema.Schema{ + "manual_judgment_stop": { Type: schema.TypeBool, Optional: true, }, diff --git a/provider/moniker_resource.go b/provider/moniker_resource.go index 56364fd..3ebb06b 100644 --- a/provider/moniker_resource.go +++ b/provider/moniker_resource.go @@ -7,23 +7,23 @@ import ( func monikerResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "app": &schema.Schema{ + "app": { Type: schema.TypeString, Optional: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Optional: true, }, - "detail": &schema.Schema{ + "detail": { Type: schema.TypeString, Optional: true, }, - "sequence": &schema.Schema{ + "sequence": { Type: schema.TypeString, Optional: true, }, - "stack": &schema.Schema{ + "stack": { Type: schema.TypeString, Optional: true, }, diff --git a/provider/notification_resource.go b/provider/notification_resource.go index ee5f9dc..c618a8a 100644 --- a/provider/notification_resource.go +++ b/provider/notification_resource.go @@ -7,7 +7,7 @@ import ( func notificationResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Description: "Address of the notification (slack channel, email, etc)", Required: true, @@ -19,42 +19,42 @@ func notificationResource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "complete": &schema.Schema{ + "complete": { Type: schema.TypeString, Optional: true, }, - "failed": &schema.Schema{ + "failed": { Type: schema.TypeString, Optional: true, }, - "starting": &schema.Schema{ + "starting": { Type: schema.TypeString, Optional: true, }, }, }, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Description: "Type of notification (slack, email, etc)", Required: true, }, - "when": &schema.Schema{ + "when": { Type: schema.TypeList, Description: "When to send notification (started, completed, failed)", Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "complete": &schema.Schema{ + "complete": { Type: schema.TypeBool, Optional: true, }, - "failed": &schema.Schema{ + "failed": { Type: schema.TypeBool, Optional: true, }, - "starting": &schema.Schema{ + "starting": { Type: schema.TypeBool, Optional: true, }, diff --git a/provider/pipeline_bake_manifest_stage_resource.go b/provider/pipeline_bake_manifest_stage_resource.go index 3722b11..9917ee8 100644 --- a/provider/pipeline_bake_manifest_stage_resource.go +++ b/provider/pipeline_bake_manifest_stage_resource.go @@ -26,26 +26,26 @@ func pipelineBakeManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "evaluate_override_expressions": &schema.Schema{ + "evaluate_override_expressions": { Type: schema.TypeBool, Description: "", Optional: true, }, - "input_artifact": &schema.Schema{ + "input_artifact": { Type: schema.TypeList, Description: "", Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Optional: true, }, - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, - "artifact": &schema.Schema{ + "artifact": { Type: schema.TypeList, MaxItems: 1, Optional: true, @@ -54,32 +54,32 @@ func pipelineBakeManifestStageResource() *schema.Resource { }, }, }, - "namespace": &schema.Schema{ + "namespace": { Type: schema.TypeString, Description: "", Optional: true, }, - "output_name": &schema.Schema{ + "output_name": { Type: schema.TypeString, Description: "", Optional: true, }, - "overrides": &schema.Schema{ + "overrides": { Type: schema.TypeMap, Description: "", Optional: true, }, - "raw_overrides": &schema.Schema{ + "raw_overrides": { Type: schema.TypeBool, Description: "", Optional: true, }, - "template_renderer": &schema.Schema{ + "template_renderer": { Type: schema.TypeString, Description: "", Required: true, }, - "kustomize_file_path": &schema.Schema{ + "kustomize_file_path": { Type: schema.TypeString, Description: "Path to kustomization file (if using kustomize engine)", Optional: true, diff --git a/provider/pipeline_bake_stage_resource.go b/provider/pipeline_bake_stage_resource.go index d13e0f9..9d0d46b 100644 --- a/provider/pipeline_bake_stage_resource.go +++ b/provider/pipeline_bake_stage_resource.go @@ -26,60 +26,60 @@ func pipelineBakeStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "ami_name": &schema.Schema{ + "ami_name": { Type: schema.TypeString, Description: "Name of the ami output. Default = $package-$arch-$ami_suffix-$store_type", Optional: true, }, - "ami_suffix": &schema.Schema{ + "ami_suffix": { Type: schema.TypeString, Description: "Suffix of the ami output. String of date in format YYYYMMDDHHmm, default is calculated from timestamp", Optional: true, }, - "base_ami": &schema.Schema{ + "base_ami": { Type: schema.TypeString, Description: "Label of the base ami to use. If Base AMI is specified, this will be used instead of the Base OS provided", Optional: true, }, - "base_label": &schema.Schema{ + "base_label": { Type: schema.TypeString, Description: "Label for the base ami (release)", Optional: true, Default: "release", }, - "base_name": &schema.Schema{ + "base_name": { Type: schema.TypeString, Description: "Name of the base ami to use", Optional: true, }, - "base_os": &schema.Schema{ + "base_os": { Type: schema.TypeString, Description: "Base OS to use (trusty)", Optional: true, Default: "trusty", }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "extended_attributes": &schema.Schema{ + "extended_attributes": { Type: schema.TypeMap, Description: "Extra attributes to give the packer template", Optional: true, }, - "package": &schema.Schema{ + "package": { Type: schema.TypeString, Description: "The name of the package you want installed (without any version identifiers).\nIf your build produces a deb file named \"myapp_1.27-h343\", you would want to enter \"myapp\" here.\nIf there are multiple packages (space separated), then they will be installed in the order they are entered.", Optional: true, }, - "rebake": &schema.Schema{ + "rebake": { Type: schema.TypeBool, Description: "Rebake image without regard to the status of any existing bake", Optional: true, Default: false, }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "regions to create the ami (us-east-1)", Optional: true, @@ -87,23 +87,23 @@ func pipelineBakeStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "store_type": &schema.Schema{ + "store_type": { Type: schema.TypeString, Description: "Data store type to use when creating instances (ebs)", Optional: true, Default: "ebs", }, - "template_file_name": &schema.Schema{ + "template_file_name": { Type: schema.TypeString, Description: "Name of custom template to use", Optional: true, }, - "var_file_name": &schema.Schema{ + "var_file_name": { Type: schema.TypeString, Description: "[Bakery] The name of a json file containing key/value pairs to add to the packer command", Optional: true, }, - "vm_type": &schema.Schema{ + "vm_type": { Type: schema.TypeString, Description: "Type of VM to use (hvm, pv)", Optional: true, diff --git a/provider/pipeline_canary_analysis_config_resource.go b/provider/pipeline_canary_analysis_config_resource.go index f09931d..3c873fa 100644 --- a/provider/pipeline_canary_analysis_config_resource.go +++ b/provider/pipeline_canary_analysis_config_resource.go @@ -7,76 +7,76 @@ import ( func pipelineCanaryAnalysisConfigResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "canary_analysis_interval_mins": &schema.Schema{ + "canary_analysis_interval_mins": { Type: schema.TypeString, Description: "The frequency at which a canary score is generated. The recommended interval is at least 30 minutes." + "" + "If an interval is not specified, or the specified interval is larger than the overall time range, there will be one canary run over the full time range.", Optional: true, }, - "canary_config_id": &schema.Schema{ + "canary_config_id": { Type: schema.TypeString, Description: "Id of the canary config.", Required: true, }, - "lifetime_duration": &schema.Schema{ + "lifetime_duration": { Type: schema.TypeString, Description: "The total time for which data will be collected and analyzed during this stage." + "Example: 'PT1H5M' means 1 hour 5 minutes", Required: true, }, - "metrics_account_name": &schema.Schema{ + "metrics_account_name": { Type: schema.TypeString, Description: "The name of the metrics account configured in spinnaker.", Required: true, }, - "scope": &schema.Schema{ + "scope": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "control_location": &schema.Schema{ + "control_location": { Type: schema.TypeString, Optional: true, }, - "control_scope": &schema.Schema{ + "control_scope": { Type: schema.TypeString, Optional: true, }, - "experiment_location": &schema.Schema{ + "experiment_location": { Type: schema.TypeString, Optional: true, }, - "experiment_scope": &schema.Schema{ + "experiment_scope": { Type: schema.TypeString, Optional: true, }, - "extended_scope_params": &schema.Schema{ + "extended_scope_params": { Type: schema.TypeMap, Description: "Metric source specific parameters which may be used to further alter the canary scope." + "" + "Also used to provide variable bindings for use in the expansion of custom filter templates within the canary config.", Optional: true, }, - "scope_name": &schema.Schema{ + "scope_name": { Type: schema.TypeString, Optional: true, Default: "default", }, - "step": &schema.Schema{ + "step": { Type: schema.TypeInt, Optional: true, }, }, }, }, - "score_thresholds": &schema.Schema{ + "score_thresholds": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "marginal": &schema.Schema{ + "marginal": { Type: schema.TypeString, Description: "A canary stage can include multiple canary runs." + "" + @@ -85,7 +85,7 @@ func pipelineCanaryAnalysisConfigResource() *schema.Resource { "If the canary run score is greater than the marginal threshold, the canary stage will not fail and will execute the remaining downstream canary runs.", Required: true, }, - "pass": &schema.Schema{ + "pass": { Type: schema.TypeString, Description: "When all canary runs in a stage have executed, a canary stage is considered a success if the final (that is, the latest) canary run score is greater than or equal to the pass threshold. Otherwise, it is a failure.", Required: true, @@ -93,7 +93,7 @@ func pipelineCanaryAnalysisConfigResource() *schema.Resource { }, }, }, - "storage_account_name": &schema.Schema{ + "storage_account_name": { Type: schema.TypeString, Description: "The name of the storage account configured in spinnaker.", Required: true, diff --git a/provider/pipeline_canary_analysis_deployments_resource.go b/provider/pipeline_canary_analysis_deployments_resource.go index 528c29a..0df5850 100644 --- a/provider/pipeline_canary_analysis_deployments_resource.go +++ b/provider/pipeline_canary_analysis_deployments_resource.go @@ -7,43 +7,43 @@ import ( func pipelineCanaryAnalysisDeploymentsResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "baseline": &schema.Schema{ + "baseline": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeMap, Required: true, }, - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Required: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Required: true, }, }, }, }, - "server_group_pair": &schema.Schema{ + "server_group_pair": { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "control": &schema.Schema{ + "control": { Type: schema.TypeList, MaxItems: 1, Required: true, Elem: clusterResource(), }, - "experiment": &schema.Schema{ + "experiment": { Type: schema.TypeList, MaxItems: 1, Required: true, diff --git a/provider/pipeline_canary_analysis_stage_resource.go b/provider/pipeline_canary_analysis_stage_resource.go index d45f34d..1078f85 100644 --- a/provider/pipeline_canary_analysis_stage_resource.go +++ b/provider/pipeline_canary_analysis_stage_resource.go @@ -26,7 +26,7 @@ func pipelineCanaryAnalysisStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "analysis_type": &schema.Schema{ + "analysis_type": { Type: schema.TypeString, Description: "Real Time analysis will be performed over a time interval beginning at the moment of execution." + "" + @@ -35,14 +35,14 @@ func pipelineCanaryAnalysisStageResource() *schema.Resource { "Retrospective analysis will be performed over an explicitly-specified time interval (likely in the past). You are responsible for provisioning and cleaning up the baseline and canary server groups.", Required: true, }, - "canary_config": &schema.Schema{ + "canary_config": { Type: schema.TypeList, Description: "The manifest artifact account", Required: true, MaxItems: 1, Elem: pipelineCanaryAnalysisConfigResource(), }, - "deployments": &schema.Schema{ + "deployments": { Type: schema.TypeList, Optional: true, MaxItems: 1, diff --git a/provider/pipeline_check_preconditions_stage_resource.go b/provider/pipeline_check_preconditions_stage_resource.go index 5c985e4..4c77540 100644 --- a/provider/pipeline_check_preconditions_stage_resource.go +++ b/provider/pipeline_check_preconditions_stage_resource.go @@ -26,24 +26,24 @@ func pipelineCheckPreconditionsStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "precondition": &schema.Schema{ + "precondition": { Type: schema.TypeList, Description: "The preconditions for the stage", Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "context": &schema.Schema{ + "context": { Type: schema.TypeMap, Description: "Map to describe precondition", Required: true, }, - "fail_pipeline": &schema.Schema{ + "fail_pipeline": { Type: schema.TypeBool, Description: "The pipeline will fail whenever this precondition is false", Optional: true, Default: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Description: "The type of precondition. (expression, stageStatus, etc)", Required: true, diff --git a/provider/pipeline_data_source.go b/provider/pipeline_data_source.go index 3afe7e0..a8a421d 100644 --- a/provider/pipeline_data_source.go +++ b/provider/pipeline_data_source.go @@ -12,12 +12,12 @@ func pipelineDataSource() *schema.Resource { Read: pipelineDataSourceRead, Schema: map[string]*schema.Schema{ - ApplicationKey: &schema.Schema{ + ApplicationKey: { Type: schema.TypeString, Description: "Name of the application where the pipeline lives", Required: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Description: "Name of the pipeline", Required: true, @@ -29,27 +29,27 @@ func pipelineDataSource() *schema.Resource { return }, }, - "disabled": &schema.Schema{ + "disabled": { Type: schema.TypeBool, Description: "If the pipeline is disabled", Computed: true, }, - "keep_waiting_pipelines": &schema.Schema{ + "keep_waiting_pipelines": { Type: schema.TypeBool, Description: "Do not automatically cancel pipelines waiting in queue", Computed: true, }, - "limit_concurrent": &schema.Schema{ + "limit_concurrent": { Type: schema.TypeBool, Description: "Disable concurrent pipeline executions (only run one at a time)", Computed: true, }, - "index": &schema.Schema{ + "index": { Type: schema.TypeInt, Description: "Index of the pipeline", Computed: true, }, - "roles": &schema.Schema{ + "roles": { Type: schema.TypeList, Description: "When the pipeline is triggered using an automated trigger, these roles will be used to decide if the pipeline has permissions to access a protected application or account.\n\nTo read from a protected application or account, the pipeline must have at least one role that has read access to the application or account.\nTo write to a protected application or account, the pipeline must have at least one role that has write access to the application or account.\nNote: To prevent privilege escalation vulnerabilities, a user must be a member of all of the groups specified here in order to modify, and execute the pipeline.", Computed: true, @@ -57,29 +57,29 @@ func pipelineDataSource() *schema.Resource { Type: schema.TypeString, }, }, - "service_account": &schema.Schema{ + "service_account": { Type: schema.TypeString, Description: "Service account to run pipeline", Computed: true, }, - "locked": &schema.Schema{ + "locked": { Type: schema.TypeList, Description: "Lock options", Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ui": &schema.Schema{ + "ui": { Type: schema.TypeBool, Description: "Lock user to edit pipeline over the spinnaker UI", Computed: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Description: "Description banner explaining why ui is locked", Computed: true, }, - "allow_unlock_ui": &schema.Schema{ + "allow_unlock_ui": { Type: schema.TypeBool, Description: "Allow user to unlock ui to edit pipeline", Computed: true, diff --git a/provider/pipeline_delete_manifest_stage_resource.go b/provider/pipeline_delete_manifest_stage_resource.go index 1cbe837..70a0f7b 100644 --- a/provider/pipeline_delete_manifest_stage_resource.go +++ b/provider/pipeline_delete_manifest_stage_resource.go @@ -26,44 +26,44 @@ func pipelineDeleteManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Required: true, }, - "app": &schema.Schema{ + "app": { Type: schema.TypeString, Description: "The application name", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloud provider name", Required: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "The location name", Required: true, }, - "manifest_name": &schema.Schema{ + "manifest_name": { Type: schema.TypeString, Description: "The manifest name", Required: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "The mode name", Required: true, }, - "options": &schema.Schema{ + "options": { Type: schema.TypeList, Description: "Options for delete", Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cascading": &schema.Schema{ + "cascading": { Type: schema.TypeBool, Optional: true, Default: false, diff --git a/provider/pipeline_deploy_manifest_stage_resource.go b/provider/pipeline_deploy_manifest_stage_resource.go index 2385405..aa95b67 100644 --- a/provider/pipeline_deploy_manifest_stage_resource.go +++ b/provider/pipeline_deploy_manifest_stage_resource.go @@ -26,37 +26,37 @@ func pipelineDeployManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Required: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "The credentials name", Optional: true, }, - "namespace_override": &schema.Schema{ + "namespace_override": { Type: schema.TypeString, Description: "Namespace override", Optional: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloud provider name", Required: true, }, - "manifest_artifact_account": &schema.Schema{ + "manifest_artifact_account": { Type: schema.TypeString, Description: "The manifest artifact account", Optional: true, }, - "manifest_artifact_id": &schema.Schema{ + "manifest_artifact_id": { Type: schema.TypeString, Description: "The manifest artifact id", Optional: true, }, - "manifests": &schema.Schema{ + "manifests": { Type: schema.TypeList, Description: "The manifests as yaml", Optional: true, @@ -64,32 +64,32 @@ func pipelineDeployManifestStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "moniker": &schema.Schema{ + "moniker": { Type: schema.TypeList, Description: "Name to attach to manifest", Required: true, MaxItems: 1, Elem: monikerResource(), }, - "relationships": &schema.Schema{ + "relationships": { Type: schema.TypeList, Description: "relationships", Required: true, MaxItems: 1, Elem: relationshipsResource(), }, - "skip_expression_evaluation": &schema.Schema{ + "skip_expression_evaluation": { Type: schema.TypeBool, Description: "Skip Expression Evaluation", Optional: true, Default: false, }, - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Description: "source", Required: true, }, - "traffic_management": &schema.Schema{ + "traffic_management": { Type: schema.TypeList, Description: "The manifest artifact account", Required: true, diff --git a/provider/pipeline_deploy_stage_resource.go b/provider/pipeline_deploy_stage_resource.go index 62bfec9..7395938 100644 --- a/provider/pipeline_deploy_stage_resource.go +++ b/provider/pipeline_deploy_stage_resource.go @@ -26,7 +26,7 @@ func pipelineDeployStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeList, Description: "The clusters to be deployed", Required: true, diff --git a/provider/pipeline_destroy_server_group_stage_resource.go b/provider/pipeline_destroy_server_group_stage_resource.go index 1cc3800..77f3d55 100644 --- a/provider/pipeline_destroy_server_group_stage_resource.go +++ b/provider/pipeline_destroy_server_group_stage_resource.go @@ -26,34 +26,34 @@ func pipelineDestroyServerGroupStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "Name of the cluster", Required: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "Name of the credentials to use", Optional: true, }, - "moniker": &schema.Schema{ + "moniker": { Type: schema.TypeList, Description: "Name to attach to cluster", Optional: true, MaxItems: 1, Elem: monikerResource(), }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "regions to target (us-east-1)", Optional: true, @@ -61,7 +61,7 @@ func pipelineDestroyServerGroupStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "target": &schema.Schema{ + "target": { Type: schema.TypeString, Description: "Which server group to destroy (oldest_asg_dynamic, ancestor_asg_dynamic, current_asg_dynamic)", Optional: true, diff --git a/provider/pipeline_disable_manifest_stage_resource.go b/provider/pipeline_disable_manifest_stage_resource.go index 0be3a00..2bb5dac 100644 --- a/provider/pipeline_disable_manifest_stage_resource.go +++ b/provider/pipeline_disable_manifest_stage_resource.go @@ -26,47 +26,47 @@ func pipelineDisableManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Required: true, }, - "app": &schema.Schema{ + "app": { Type: schema.TypeString, Description: "The application name", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloud provider name", Required: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "The name of the manifest to enable (e.g. replicatSet my-service)", Required: true, }, - "criteria": &schema.Schema{ + "criteria": { Type: schema.TypeString, Description: "The target cluster (e.g. newest)", Required: true, }, - "kind": &schema.Schema{ + "kind": { Type: schema.TypeString, Description: "The cluster kind (e.g. replicaSet)", Required: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "The location name", Required: true, }, - "manifest_name": &schema.Schema{ + "manifest_name": { Type: schema.TypeString, Description: "The manifest name", Optional: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "The mode name", Required: true, diff --git a/provider/pipeline_enable_manifest_stage_resource.go b/provider/pipeline_enable_manifest_stage_resource.go index 0c64772..4808989 100644 --- a/provider/pipeline_enable_manifest_stage_resource.go +++ b/provider/pipeline_enable_manifest_stage_resource.go @@ -26,42 +26,42 @@ func pipelineEnableManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Required: true, }, - "app": &schema.Schema{ + "app": { Type: schema.TypeString, Description: "The application name", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloud provider name", Required: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "The name of the manifest to enable (e.g. replicatSet my-service)", Required: true, }, - "criteria": &schema.Schema{ + "criteria": { Type: schema.TypeString, Description: "The target cluster (e.g. newest)", Required: true, }, - "kind": &schema.Schema{ + "kind": { Type: schema.TypeString, Description: "The cluster kind (e.g. replicaSet)", Required: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "The location name", Required: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "The mode name", Required: true, diff --git a/provider/pipeline_enable_server_group_stage_resource.go b/provider/pipeline_enable_server_group_stage_resource.go index 4717b95..78b40df 100644 --- a/provider/pipeline_enable_server_group_stage_resource.go +++ b/provider/pipeline_enable_server_group_stage_resource.go @@ -26,27 +26,27 @@ func pipelineEnableServerGroupStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws, kubernetes)", Required: true, }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws, kubernetes)", Required: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "Cluster to enable", Required: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "Credentials to use with cloud provider", Required: true, }, - "interesting_health_provider_names": &schema.Schema{ + "interesting_health_provider_names": { Type: schema.TypeList, Description: "Health provider names", Required: true, @@ -54,7 +54,7 @@ func pipelineEnableServerGroupStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "namespaces": &schema.Schema{ + "namespaces": { Type: schema.TypeList, Description: "Deploy to K8s Namespaces", Optional: true, @@ -62,7 +62,7 @@ func pipelineEnableServerGroupStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "Deploy to AWS regions", Optional: true, @@ -70,7 +70,7 @@ func pipelineEnableServerGroupStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "target": &schema.Schema{ + "target": { Type: schema.TypeString, Description: "Which version of cluster to target", Required: true, diff --git a/provider/pipeline_evaluate_variables_stage_resource.go b/provider/pipeline_evaluate_variables_stage_resource.go index f984922..845c1e8 100644 --- a/provider/pipeline_evaluate_variables_stage_resource.go +++ b/provider/pipeline_evaluate_variables_stage_resource.go @@ -26,7 +26,7 @@ func pipelineEvaluateVariablesStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "variables": &schema.Schema{ + "variables": { Type: schema.TypeMap, Description: "List of values to assign as variables", Required: true, diff --git a/provider/pipeline_find_artifacts_from_resource_stage_resource.go b/provider/pipeline_find_artifacts_from_resource_stage_resource.go index b282e55..fe4b790 100644 --- a/provider/pipeline_find_artifacts_from_resource_stage_resource.go +++ b/provider/pipeline_find_artifacts_from_resource_stage_resource.go @@ -26,27 +26,27 @@ func pipelineFindArtifactsFromResourceStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "Spinnaker account for cloud provider", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (kubernetes)", Required: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "Location in cloud provider to search (k8s namespaces)", Required: true, }, - "manifest_name": &schema.Schema{ + "manifest_name": { Type: schema.TypeString, Description: "If mode is static, resource manifest name", Optional: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "Manifest Selector (static, dynamic)", Required: true, diff --git a/provider/pipeline_find_image_from_tags_stage_resource.go b/provider/pipeline_find_image_from_tags_stage_resource.go index e7c9d66..4fa4978 100644 --- a/provider/pipeline_find_image_from_tags_stage_resource.go +++ b/provider/pipeline_find_image_from_tags_stage_resource.go @@ -26,22 +26,22 @@ func pipelineFindImageFromTagsStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Required: true, }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Required: true, }, - "package_name": &schema.Schema{ + "package_name": { Type: schema.TypeString, Description: "Label of the base ami to use. If Base AMI is specified, this will be used instead of the Base OS provided", Optional: true, }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "regions to target (us-east-1)", Optional: true, @@ -49,7 +49,7 @@ func pipelineFindImageFromTagsStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "tags": &schema.Schema{ + "tags": { Type: schema.TypeMap, Description: "Tags of base ami to use.", Optional: true, diff --git a/provider/pipeline_jenkins_stage_resource.go b/provider/pipeline_jenkins_stage_resource.go index deb8354..106cf5f 100644 --- a/provider/pipeline_jenkins_stage_resource.go +++ b/provider/pipeline_jenkins_stage_resource.go @@ -26,28 +26,28 @@ func pipelineJenkinsStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "job": &schema.Schema{ + "job": { Type: schema.TypeString, Description: "Name of the Jenkins job to execute", Required: true, }, - "mark_unstable_as_successful": &schema.Schema{ + "mark_unstable_as_successful": { Type: schema.TypeBool, Description: "If Jenkins reports the build status as UNSTABLE, Spinnaker will mark the stage as SUCCEEDED and continue execution of the pipeline", Optional: true, Default: false, }, - "master": &schema.Schema{ + "master": { Type: schema.TypeString, Description: "Name of the Jenkins master where the job will be executed", Required: true, }, - "parameters": &schema.Schema{ + "parameters": { Type: schema.TypeMap, Description: "Parameters to pass to the Jenkins job", Optional: true, }, - "property_file": &schema.Schema{ + "property_file": { Type: schema.TypeString, Description: "Name of the property file to use for results", Optional: true, diff --git a/provider/pipeline_locked.go b/provider/pipeline_locked.go index 3850487..002b614 100644 --- a/provider/pipeline_locked.go +++ b/provider/pipeline_locked.go @@ -28,7 +28,7 @@ func fromClientLocked(clientLocked *client.Locked) lockedArray { return lockedArray{} } return []locked{ - locked{ + { UI: clientLocked.UI, Description: clientLocked.Description, AllowUnlockUI: clientLocked.AllowUnlockUI, diff --git a/provider/pipeline_manifest_artifact_resource.go b/provider/pipeline_manifest_artifact_resource.go index 04b1590..d79b973 100644 --- a/provider/pipeline_manifest_artifact_resource.go +++ b/provider/pipeline_manifest_artifact_resource.go @@ -7,7 +7,7 @@ import ( func manifestArtifactResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "artifact_account": &schema.Schema{ + "artifact_account": { Type: schema.TypeString, Description: "Account of artifact", Optional: true, @@ -18,7 +18,7 @@ func manifestArtifactResource() *schema.Resource { Optional: true, Default: false, }, - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, }, @@ -26,7 +26,7 @@ func manifestArtifactResource() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "metadata": &schema.Schema{ + "metadata": { Type: schema.TypeMap, Description: "Metadata", Optional: true, @@ -35,15 +35,15 @@ func manifestArtifactResource() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "reference": &schema.Schema{ + "reference": { Type: schema.TypeString, Optional: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Optional: true, }, - "version": &schema.Schema{ + "version": { Type: schema.TypeString, Optional: true, }, diff --git a/provider/pipeline_manual_judgment_stage_resource.go b/provider/pipeline_manual_judgment_stage_resource.go index 334e716..3ce8c65 100644 --- a/provider/pipeline_manual_judgment_stage_resource.go +++ b/provider/pipeline_manual_judgment_stage_resource.go @@ -26,12 +26,12 @@ func pipelineManualJudgementStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "instructions": &schema.Schema{ + "instructions": { Type: schema.TypeString, Description: "Instructions", Optional: true, }, - "judgment_inputs": &schema.Schema{ + "judgment_inputs": { Type: schema.TypeList, Description: "Judgment Inputs", Required: true, @@ -39,7 +39,7 @@ func pipelineManualJudgementStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "notification": &schema.Schema{ + "notification": { Type: schema.TypeList, Description: "Notifications to send for stage results", Optional: true, diff --git a/provider/pipeline_notification_resource.go b/provider/pipeline_notification_resource.go index 4118643..29fa177 100644 --- a/provider/pipeline_notification_resource.go +++ b/provider/pipeline_notification_resource.go @@ -35,13 +35,13 @@ func pipelineNotificationResource() *schema.Resource { }, Schema: map[string]*schema.Schema{ - PipelineKey: &schema.Schema{ + PipelineKey: { Type: schema.TypeString, Description: "Id of the pipeline to send notification", Required: true, ForceNew: true, }, - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Description: "Address of the notification (slack channel, email, etc)", Required: true, @@ -53,42 +53,42 @@ func pipelineNotificationResource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "complete": &schema.Schema{ + "complete": { Type: schema.TypeString, Optional: true, }, - "failed": &schema.Schema{ + "failed": { Type: schema.TypeString, Optional: true, }, - "starting": &schema.Schema{ + "starting": { Type: schema.TypeString, Optional: true, }, }, }, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Description: "Type of notification (slack, email, etc)", Required: true, }, - "when": &schema.Schema{ + "when": { Type: schema.TypeList, Description: "When to send notification (started, completed, failed)", Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "complete": &schema.Schema{ + "complete": { Type: schema.TypeBool, Optional: true, }, - "failed": &schema.Schema{ + "failed": { Type: schema.TypeBool, Optional: true, }, - "starting": &schema.Schema{ + "starting": { Type: schema.TypeBool, Optional: true, }, diff --git a/provider/pipeline_parameter_resource.go b/provider/pipeline_parameter_resource.go index c88691f..9b3aee8 100644 --- a/provider/pipeline_parameter_resource.go +++ b/provider/pipeline_parameter_resource.go @@ -32,43 +32,43 @@ func pipelineParameterResource() *schema.Resource { }, Schema: map[string]*schema.Schema{ - PipelineKey: &schema.Schema{ + PipelineKey: { Type: schema.TypeString, Description: "Id of the pipeline to add parameter", Required: true, ForceNew: true, }, - "default": &schema.Schema{ + "default": { Type: schema.TypeString, Description: "Default value", Optional: true, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, }, - "label": &schema.Schema{ + "label": { Type: schema.TypeString, Description: "A label to display when users are triggering the pipeline manually", Optional: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, }, - "option": &schema.Schema{ + "option": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "value": &schema.Schema{ + "value": { Type: schema.TypeString, Required: true, }, }, }, }, - "required": &schema.Schema{ + "required": { Type: schema.TypeBool, Optional: true, Default: false, diff --git a/provider/pipeline_pipeline_stage_resource.go b/provider/pipeline_pipeline_stage_resource.go index 58a0c17..488478e 100644 --- a/provider/pipeline_pipeline_stage_resource.go +++ b/provider/pipeline_pipeline_stage_resource.go @@ -26,22 +26,22 @@ func pipelinePipelineResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Description: "Application with target pipeline", Required: true, }, - "target_pipeline": &schema.Schema{ + "target_pipeline": { Type: schema.TypeString, Description: "Target pipeline", Required: true, }, - "pipeline_parameters": &schema.Schema{ + "pipeline_parameters": { Type: schema.TypeMap, Description: "Parameters to pass to pipeline", Optional: true, }, - "wait_for_completion": &schema.Schema{ + "wait_for_completion": { Type: schema.TypeBool, Description: "if false, marks the stage as successful right away without waiting for the pipeline to complete", Optional: true, diff --git a/provider/pipeline_resize_server_group_stage_resource.go b/provider/pipeline_resize_server_group_stage_resource.go index ca3f2d3..bbca3f7 100644 --- a/provider/pipeline_resize_server_group_stage_resource.go +++ b/provider/pipeline_resize_server_group_stage_resource.go @@ -26,46 +26,46 @@ func pipelineResizeServerGroupStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "action": &schema.Schema{ + "action": { Type: schema.TypeString, Description: "Configures the resize action for the target server group (scale_down, scale_up, scale_to_cluster, scale_exact)", Required: true, }, - "capacity": &schema.Schema{ + "capacity": { Type: schema.TypeList, Description: "Capacity for cluster", MaxItems: 1, Optional: true, Elem: capacityResource(), }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "Name of the cluster", Required: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "Name of the credentials to use", Optional: true, }, - "moniker": &schema.Schema{ + "moniker": { Type: schema.TypeList, Description: "Name to attach to cluster", Optional: true, MaxItems: 1, Elem: monikerResource(), }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "regions to target (us-east-1)", Optional: true, @@ -73,17 +73,17 @@ func pipelineResizeServerGroupStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "resize_type": &schema.Schema{ + "resize_type": { Type: schema.TypeString, Description: "Type of resize based on action (incremental, percentage)", Optional: true, }, - "target": &schema.Schema{ + "target": { Type: schema.TypeString, Description: "Which server group to resize (ancestor_asg_dynamic, current_asg_dynamic, oldest_asg_dynamic)", Optional: true, }, - "target_healthy_deploy_percentage": &schema.Schema{ + "target_healthy_deploy_percentage": { Type: schema.TypeInt, Description: "Consider deploy successful when percent of instances are healthy", Optional: true, diff --git a/provider/pipeline_resource.go b/provider/pipeline_resource.go index b2cb8c0..e6628c9 100644 --- a/provider/pipeline_resource.go +++ b/provider/pipeline_resource.go @@ -39,30 +39,30 @@ func pipelineResource() *schema.Resource { }, Schema: map[string]*schema.Schema{ - ApplicationKey: &schema.Schema{ + ApplicationKey: { Type: schema.TypeString, Description: "Name of the application where the pipeline lives", Required: true, }, - "disabled": &schema.Schema{ + "disabled": { Type: schema.TypeBool, Description: "If the pipeline is disabled", Optional: true, Default: false, }, - "keep_waiting_pipelines": &schema.Schema{ + "keep_waiting_pipelines": { Type: schema.TypeBool, Description: "Do not automatically cancel pipelines waiting in queue", Optional: true, Default: false, }, - "limit_concurrent": &schema.Schema{ + "limit_concurrent": { Type: schema.TypeBool, Description: "Disable concurrent pipeline executions (only run one at a time)", Optional: true, Default: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Description: "Name of the pipeline", Required: true, @@ -74,13 +74,13 @@ func pipelineResource() *schema.Resource { return }, }, - "index": &schema.Schema{ + "index": { Type: schema.TypeInt, Description: "Index of the pipeline", Optional: true, Computed: true, }, - "roles": &schema.Schema{ + "roles": { Type: schema.TypeList, Description: "When the pipeline is triggered using an automated trigger, these roles will be used to decide if the pipeline has permissions to access a protected application or account.\n\nTo read from a protected application or account, the pipeline must have at least one role that has read access to the application or account.\nTo write to a protected application or account, the pipeline must have at least one role that has write access to the application or account.\nNote: To prevent privilege escalation vulnerabilities, a user must be a member of all of the groups specified here in order to modify, and execute the pipeline.", Optional: true, @@ -88,30 +88,30 @@ func pipelineResource() *schema.Resource { Type: schema.TypeString, }, }, - "service_account": &schema.Schema{ + "service_account": { Type: schema.TypeString, Description: "Service account to run pipeline", Optional: true, }, - "locked": &schema.Schema{ + "locked": { Type: schema.TypeList, Description: "Lock options", Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "ui": &schema.Schema{ + "ui": { Type: schema.TypeBool, Description: "Lock user to edit pipeline over the spinnaker UI", Optional: true, Default: false, }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Description: "Description banner explaining why ui is locked", Optional: true, }, - "allow_unlock_ui": &schema.Schema{ + "allow_unlock_ui": { Type: schema.TypeBool, Description: "Allow user to unlock ui to edit pipeline", Optional: true, diff --git a/provider/pipeline_rollback_cluster_stage_resource.go b/provider/pipeline_rollback_cluster_stage_resource.go index 389b193..d8a8254 100644 --- a/provider/pipeline_rollback_cluster_stage_resource.go +++ b/provider/pipeline_rollback_cluster_stage_resource.go @@ -26,34 +26,34 @@ func pipelineRollbackClusterStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cloud_provider_type": &schema.Schema{ + "cloud_provider_type": { Type: schema.TypeString, Description: "Cloud provider to use (aws)", Optional: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "Name of the cluster to be rollback", Required: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "Name of the credentials to use", Optional: true, }, - "moniker": &schema.Schema{ + "moniker": { Type: schema.TypeList, Description: "Name to attach to cluster", Optional: true, MaxItems: 1, Elem: monikerResource(), }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "regions to rollback (us-east-1)", Optional: true, @@ -61,7 +61,7 @@ func pipelineRollbackClusterStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "target_healthy_rollback_percentage": &schema.Schema{ + "target_healthy_rollback_percentage": { Type: schema.TypeInt, Description: "Consider rollback successful when percent of instances are healthy", Optional: true, diff --git a/provider/pipeline_run_job_manifest_stage_resource.go b/provider/pipeline_run_job_manifest_stage_resource.go index fb051a5..072283c 100644 --- a/provider/pipeline_run_job_manifest_stage_resource.go +++ b/provider/pipeline_run_job_manifest_stage_resource.go @@ -26,40 +26,40 @@ func pipelineRunJobManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "A Spinnaker account corresponds to a physical Kubernetes cluster. If you are unsure which account to use, talk to your Spinnaker admin.", Required: true, }, - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Description: "This is the Spinnaker application that your manifest will be deployed to. An application is generally used to group resources that belong to a single service.", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloudprovider to handle the manifest", Required: true, }, - "consume_artifact_source": &schema.Schema{ + "consume_artifact_source": { Type: schema.TypeString, Optional: true, }, - "credentials": &schema.Schema{ + "credentials": { Type: schema.TypeString, Description: "Spinnaker credientials to use to talk to cloud provider", Optional: true, }, - "manifest": &schema.Schema{ + "manifest": { Type: schema.TypeString, Description: "Manifest Yaml as text", Required: true, }, - "property_file": &schema.Schema{ + "property_file": { Type: schema.TypeString, Optional: true, }, - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Description: "Where the manifest file content is read from." + "text: The manifest is supplied statically to the pipeline from the below text-box." + diff --git a/provider/pipeline_scale_manifest_stage_resource.go b/provider/pipeline_scale_manifest_stage_resource.go index e664996..aa26d3a 100644 --- a/provider/pipeline_scale_manifest_stage_resource.go +++ b/provider/pipeline_scale_manifest_stage_resource.go @@ -26,37 +26,37 @@ func pipelineScaleManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Required: true, }, - "application": &schema.Schema{ + "application": { Type: schema.TypeString, Description: "The application name", Optional: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "The cloud provider name", Required: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "The cluster to scale", Optional: true, }, - "criteria": &schema.Schema{ + "criteria": { Type: schema.TypeString, Description: "The criteria for determining the target cluster", Optional: true, }, - "kind": &schema.Schema{ + "kind": { Type: schema.TypeString, Description: "The kind of manifest to scale", Optional: true, }, - "kinds": &schema.Schema{ + "kinds": { Type: schema.TypeList, Description: "The kinds of manifest to scale", Optional: true, @@ -64,27 +64,27 @@ func pipelineScaleManifestStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "label_selectors": &schema.Schema{ + "label_selectors": { Type: schema.TypeMap, Description: "The label selectors", Optional: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "The namespace", Optional: true, }, - "manifest_name": &schema.Schema{ + "manifest_name": { Type: schema.TypeString, Description: "The name of the manifest", Optional: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "The selector mode", Optional: true, }, - "replicas": &schema.Schema{ + "replicas": { Type: schema.TypeString, Description: "The number of replicas", Optional: true, diff --git a/provider/pipeline_script_stage_resource.go b/provider/pipeline_script_stage_resource.go index 62b3e4e..c1873c7 100644 --- a/provider/pipeline_script_stage_resource.go +++ b/provider/pipeline_script_stage_resource.go @@ -26,17 +26,17 @@ func pipelineScriptStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "The account name", Optional: true, }, - "cluster": &schema.Schema{ + "cluster": { Type: schema.TypeString, Description: "The cluster to scale", Optional: true, }, - "clusters": &schema.Schema{ + "clusters": { Type: schema.TypeList, Description: "The clusters to scale", Optional: true, @@ -44,32 +44,32 @@ func pipelineScriptStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "command": &schema.Schema{ + "command": { Type: schema.TypeString, Description: "The criteria for determining the target cluster", Required: true, }, - "cmc": &schema.Schema{ + "cmc": { Type: schema.TypeString, Description: "cmc passed down to script execution as CMC", Optional: true, }, - "image": &schema.Schema{ + "image": { Type: schema.TypeString, Description: "The label selectors", Optional: true, }, - "property_file": &schema.Schema{ + "property_file": { Type: schema.TypeString, Description: "The name to the properties file produced by the script execution to be used by later stages of the Spinnaker pipeline.", Optional: true, }, - "region": &schema.Schema{ + "region": { Type: schema.TypeString, Description: "The kind of manifest to scale", Optional: true, }, - "regions": &schema.Schema{ + "regions": { Type: schema.TypeList, Description: "The kinds of manifest to scale", Optional: true, @@ -77,22 +77,22 @@ func pipelineScriptStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "repo_url": &schema.Schema{ + "repo_url": { Type: schema.TypeString, Description: "Path to the repo hosting the scripts in Stash. (e.g. CDL/mimir-scripts). Leave empty to use the default.", Optional: true, }, - "repo_branch": &schema.Schema{ + "repo_branch": { Type: schema.TypeString, Description: "Git Branch. (e.g. master). Leave empty to use the master branch.", Optional: true, }, - "script_path": &schema.Schema{ + "script_path": { Type: schema.TypeString, Description: "Path to script to run", Required: true, }, - "wait_for_completion": &schema.Schema{ + "wait_for_completion": { Type: schema.TypeBool, Description: "if false, marks the stage as successful right away without waiting for the script to complete", Optional: true, diff --git a/provider/pipeline_trigger_docker_resource.go b/provider/pipeline_trigger_docker_resource.go index 1c8feed..857d39b 100644 --- a/provider/pipeline_trigger_docker_resource.go +++ b/provider/pipeline_trigger_docker_resource.go @@ -24,27 +24,27 @@ func pipelineDockerTriggerResource() *schema.Resource { }, Schema: triggerResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "Name of the account", Required: true, }, - "organization": &schema.Schema{ + "organization": { Type: schema.TypeString, Description: "Name of the organization", Required: true, }, - "registry": &schema.Schema{ + "registry": { Type: schema.TypeString, Description: "", Optional: true, }, - "repository": &schema.Schema{ + "repository": { Type: schema.TypeString, Description: "Name of repository", Required: true, }, - "tag": &schema.Schema{ + "tag": { Type: schema.TypeString, Description: "", Optional: true, diff --git a/provider/pipeline_trigger_jenkins_resource.go b/provider/pipeline_trigger_jenkins_resource.go index 997e28f..41a1563 100644 --- a/provider/pipeline_trigger_jenkins_resource.go +++ b/provider/pipeline_trigger_jenkins_resource.go @@ -25,22 +25,22 @@ func pipelineJenkinsTriggerResource(deprecationMessage string) *schema.Resource DeprecationMessage: deprecationMessage, Schema: triggerResource(map[string]*schema.Schema{ - "job": &schema.Schema{ + "job": { Type: schema.TypeString, Description: "Name of the job", Required: true, }, - "master": &schema.Schema{ + "master": { Type: schema.TypeString, Description: "Name of the job master", Required: true, }, - "property_file": &schema.Schema{ + "property_file": { Type: schema.TypeString, Description: "Name of file to use for properties", Optional: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Description: "[DEPRECATED] Type of trigger, not used use explicit trigger resource", Optional: true, diff --git a/provider/pipeline_trigger_pipeline_resource.go b/provider/pipeline_trigger_pipeline_resource.go index f888e17..be85e27 100644 --- a/provider/pipeline_trigger_pipeline_resource.go +++ b/provider/pipeline_trigger_pipeline_resource.go @@ -24,17 +24,17 @@ func pipelinePipelineTriggerResource() *schema.Resource { }, Schema: triggerResource(map[string]*schema.Schema{ - "triggering_application": &schema.Schema{ + "triggering_application": { Type: schema.TypeString, Description: "Name of the spinnaker application", Required: true, }, - "triggering_pipeline": &schema.Schema{ + "triggering_pipeline": { Type: schema.TypeString, Description: "Name of the spinnaker pipeline", Required: true, }, - "status": &schema.Schema{ + "status": { Type: schema.TypeList, Description: "Status of pipeline execution", Required: true, diff --git a/provider/pipeline_trigger_resource.go b/provider/pipeline_trigger_resource.go index c8d909b..d85e72d 100644 --- a/provider/pipeline_trigger_resource.go +++ b/provider/pipeline_trigger_resource.go @@ -14,13 +14,13 @@ var errInvalidTriggerImportKey = errors.New("Invalid import key, must be pipelin func triggerResource(in map[string]*schema.Schema) map[string]*schema.Schema { out := map[string]*schema.Schema{ - PipelineKey: &schema.Schema{ + PipelineKey: { Type: schema.TypeString, Description: "Id of the pipeline to trigger", Required: true, ForceNew: true, }, - "enabled": &schema.Schema{ + "enabled": { Type: schema.TypeBool, Description: "If the trigger is enabled", Optional: true, diff --git a/provider/pipeline_trigger_webhook_resource.go b/provider/pipeline_trigger_webhook_resource.go index 916acc2..d493696 100644 --- a/provider/pipeline_trigger_webhook_resource.go +++ b/provider/pipeline_trigger_webhook_resource.go @@ -24,12 +24,12 @@ func pipelineWebhookTriggerResource() *schema.Resource { }, Schema: triggerResource(map[string]*schema.Schema{ - "source": &schema.Schema{ + "source": { Type: schema.TypeString, Description: "Name of the webhook source", Required: true, }, - "payload_constraints": &schema.Schema{ + "payload_constraints": { Type: schema.TypeMap, Description: "Payload contraints", Optional: true, diff --git a/provider/pipeline_undo_rollout_manifest_stage_resource.go b/provider/pipeline_undo_rollout_manifest_stage_resource.go index 477b14e..739cf4b 100644 --- a/provider/pipeline_undo_rollout_manifest_stage_resource.go +++ b/provider/pipeline_undo_rollout_manifest_stage_resource.go @@ -26,33 +26,33 @@ func pipelineUndoRolloutManifestStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Description: "Spinnaker account to use", Required: true, }, - "cloud_provider": &schema.Schema{ + "cloud_provider": { Type: schema.TypeString, Description: "Cloud provider to use (aws, kubernetes)", Required: true, }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Description: "K8s namespace with manifest", Required: true, }, - "manifest_name": &schema.Schema{ + "manifest_name": { Type: schema.TypeString, Description: "K8s manifest name with kind (e.g. replicaSet my-service)", Required: true, }, - "mode": &schema.Schema{ + "mode": { Type: schema.TypeString, Description: "Rollback mode (static)", Optional: true, Default: "static", }, - "num_revisions_back": &schema.Schema{ + "num_revisions_back": { Type: schema.TypeInt, Description: "How many revisions to rollback", Required: true, diff --git a/provider/pipeline_webhook_stage_resource.go b/provider/pipeline_webhook_stage_resource.go index 9dff0a1..45b1eb1 100644 --- a/provider/pipeline_webhook_stage_resource.go +++ b/provider/pipeline_webhook_stage_resource.go @@ -26,17 +26,17 @@ func pipelineWebhookStageResource() *schema.Resource { }, Schema: stageResource(map[string]*schema.Schema{ - "canceled_statuses": &schema.Schema{ + "canceled_statuses": { Type: schema.TypeString, Description: "Comma-separated list of strings that will be considered as CANCELED status.", Optional: true, }, - "custom_headers": &schema.Schema{ + "custom_headers": { Type: schema.TypeMap, Description: "Key-value pairs to be sent as additional headers to the service.", Optional: true, }, - "fail_fast_status_codes": &schema.Schema{ + "fail_fast_status_codes": { Type: schema.TypeList, Description: "Comma-separated HTTP status codes (4xx or 5xx) that will cause this webhook stage to fail without retrying.", Optional: true, @@ -44,48 +44,48 @@ func pipelineWebhookStageResource() *schema.Resource { Type: schema.TypeString, }, }, - "method": &schema.Schema{ + "method": { Type: schema.TypeString, Description: "Config the HTTP method used for the webhook.", Optional: true, Default: "GET", }, - "payload_string": &schema.Schema{ + "payload_string": { Type: schema.TypeString, Description: "JSON payload to be added to the webhook call.", Optional: true, }, - "progress_json_path": &schema.Schema{ + "progress_json_path": { Type: schema.TypeString, Description: "JSON path to a descriptive message about the progress in the webhook's response JSON. (e.g. $.buildInfo.progress)", Optional: true, }, - "status_json_path": &schema.Schema{ + "status_json_path": { Type: schema.TypeString, Description: "JSON path to the status information in the webhook's response JSON. (e.g. $.buildInfo.status)", Optional: true, }, - "status_url_json_path": &schema.Schema{ + "status_url_json_path": { Type: schema.TypeString, Description: "JSON path to the status url in the webhook's response JSON. (i.e. $.buildInfo.url)", Optional: true, }, - "status_url_resolution": &schema.Schema{ + "status_url_resolution": { Type: schema.TypeString, Description: "Set the technique to lookup the overall status: webhookResponse - GET method against webhook URL; locationHeader - From the Location header; getMethod - From webhook’s response.", Optional: true, }, - "success_statuses": &schema.Schema{ + "success_statuses": { Type: schema.TypeString, Description: "Comma-separated list of strings that will be considered as SUCCESS status.", Optional: true, }, - "terminal_statuses": &schema.Schema{ + "terminal_statuses": { Type: schema.TypeString, Description: "Comma-separated list of strings that will be considered as TERMINAL status.", Optional: true, }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Description: "Config the url for the webhook.", Required: true, diff --git a/provider/provider.go b/provider/provider.go index e780f92..d99732f 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -21,42 +21,42 @@ type Services struct { func Provider() terraform.ResourceProvider { return &schema.Provider{ Schema: map[string]*schema.Schema{ - "address": &schema.Schema{ + "address": { Type: schema.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc("SPINNAKER_ADDRESS", nil), Description: "Address of spinnaker api", }, - "enabled": &schema.Schema{ + "enabled": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Path to cert to authenticate with spinnaker api", }, - "cert_path": &schema.Schema{ + "cert_path": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("SPINNAKER_CERT", nil), Description: "Path to cert to authenticate with spinnaker api", }, - "key_path": &schema.Schema{ + "key_path": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("SPINNAKER_KEY", nil), Description: "Path to key to authenticate with spinnaker api", }, - "user_email": &schema.Schema{ + "user_email": { Type: schema.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("SPINNAKER_EMAIL", nil), Description: "Path to user_email to authenticate with spinnaker api", }, - "insecure": &schema.Schema{ + "insecure": { Type: schema.TypeBool, Optional: true, Default: true, diff --git a/provider/relationships_resource.go b/provider/relationships_resource.go index 37147ab..ffdff7e 100644 --- a/provider/relationships_resource.go +++ b/provider/relationships_resource.go @@ -7,14 +7,14 @@ import ( func relationshipsResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "load_balancers": &schema.Schema{ + "load_balancers": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "security_groups": &schema.Schema{ + "security_groups": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ diff --git a/provider/restricted_execution_window_resource.go b/provider/restricted_execution_window_resource.go index 8f9dcf4..e888d09 100644 --- a/provider/restricted_execution_window_resource.go +++ b/provider/restricted_execution_window_resource.go @@ -5,56 +5,56 @@ import "github.com/hashicorp/terraform/helper/schema" func restrictedExecutionWindowResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "days": &schema.Schema{ + "days": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, - "jitter": &schema.Schema{ + "jitter": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "enabled": &schema.Schema{ + "enabled": { Type: schema.TypeBool, Optional: true, }, - "max_delay": &schema.Schema{ + "max_delay": { Type: schema.TypeInt, Optional: true, }, - "min_delay": &schema.Schema{ + "min_delay": { Type: schema.TypeInt, Optional: true, }, - "skip_manual": &schema.Schema{ + "skip_manual": { Type: schema.TypeBool, Optional: true, }, }, }, }, - "whitelist": &schema.Schema{ + "whitelist": { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_hour": &schema.Schema{ + "end_hour": { Type: schema.TypeInt, Optional: true, }, - "end_min": &schema.Schema{ + "end_min": { Type: schema.TypeInt, Optional: true, }, - "start_hour": &schema.Schema{ + "start_hour": { Type: schema.TypeInt, Optional: true, }, - "start_min": &schema.Schema{ + "start_min": { Type: schema.TypeInt, Optional: true, }, diff --git a/provider/stage_enabled_resource.go b/provider/stage_enabled_resource.go index 77cc7f3..a23ded2 100644 --- a/provider/stage_enabled_resource.go +++ b/provider/stage_enabled_resource.go @@ -7,11 +7,11 @@ import ( func stageEnabledResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "expression": &schema.Schema{ + "expression": { Type: schema.TypeString, Optional: true, }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Optional: true, }, diff --git a/provider/traffic_management_resource.go b/provider/traffic_management_resource.go index 2204ca7..faed58c 100644 --- a/provider/traffic_management_resource.go +++ b/provider/traffic_management_resource.go @@ -7,34 +7,34 @@ import ( func trafficManagementResource() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "enabled": &schema.Schema{ + "enabled": { Type: schema.TypeBool, Optional: true, Default: false, }, - "options": &schema.Schema{ + "options": { Type: schema.TypeList, Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "enable_traffic": &schema.Schema{ + "enable_traffic": { Type: schema.TypeBool, Optional: true, Default: false, }, - "namespace": &schema.Schema{ + "namespace": { Type: schema.TypeString, Optional: true, }, - "services": &schema.Schema{ + "services": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "strategy": &schema.Schema{ + "strategy": { Type: schema.TypeString, Optional: true, },