spec

package
v1.4.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SpecKey = "spec"
	URLKey  = "url"
)

Variables

View Source
var SpecSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "Spec for the Repository.",
	Required:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			URLKey: {
				Type:         schema.TypeString,
				Description:  "URL of the git repository. Repository URL should begin with http, https, or ssh",
				Required:     true,
				ValidateFunc: validation.IsURLWithScheme([]string{"http", "https", "ssh"}),
			},
			secretRefKey: {
				Type:        schema.TypeString,
				Description: "Reference to the secret. Repository credential.",
				Optional:    true,
				Default:     "",
			},
			intervalKey: {
				Type:        schema.TypeString,
				Description: "Interval at which to check gitrepository for updates. This is the interval at which Tanzu Mission Control will attempt to reconcile changes in the repository to the cluster. A sync interval of 0 would result in no future syncs. If no value is entered, a default interval of 5 minutes will be applied as `5m`.",
				Optional:    true,
				Default:     "5m",
				DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
					durationInScript, err := time.ParseDuration(old)
					if err != nil {
						return false
					}

					durationInState, err := time.ParseDuration(new)
					if err != nil {
						return false
					}

					return durationInScript.Seconds() == durationInState.Seconds()
				},
			},
			gitImplementationKey: {
				Type:        schema.TypeString,
				Description: "GitImplementation specifies which client library implementation to use. go-git is the default git implementation.",
				Optional:    true,
				Default:     fmt.Sprint(gitrepositoryclustermodel.VmwareTanzuManageV1alpha1ClusterNamespaceFluxcdGitrepositoryGitImplementationGOGIT),
				ValidateFunc: validation.StringInSlice([]string{
					fmt.Sprint(gitrepositoryclustermodel.VmwareTanzuManageV1alpha1ClusterNamespaceFluxcdGitrepositoryGitImplementationGOGIT),
					fmt.Sprint(gitrepositoryclustermodel.VmwareTanzuManageV1alpha1ClusterNamespaceFluxcdGitrepositoryGitImplementationLIBGIT2),
				}, false),
			},
			refKey: refSchema,
		},
	},
}

Functions

func HasSpecChanged

func HasSpecChanged(d *schema.ResourceData) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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