repository

package
v12.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlpinePackageType            = "alpine"
	AnsiblePackageType           = "ansible"
	BowerPackageType             = "bower"
	CargoPackageType             = "cargo"
	ChefPackageType              = "chef"
	CocoapodsPackageType         = "cocoapods"
	ComposerPackageType          = "composer"
	CondaPackageType             = "conda"
	ConanPackageType             = "conan"
	CranPackageType              = "cran"
	DebianPackageType            = "debian"
	DockerPackageType            = "docker"
	GemsPackageType              = "gems"
	GenericPackageType           = "generic"
	GitLFSPackageType            = "gitlfs"
	GoPackageType                = "go"
	GradlePackageType            = "gradle"
	HelmPackageType              = "helm"
	HelmOCIPackageType           = "helmoci"
	HuggingFacePackageType       = "huggingfaceml"
	IvyPackageType               = "ivy"
	MachineLearningType          = "machinelearning"
	MavenPackageType             = "maven"
	NPMPackageType               = "npm"
	NugetPackageType             = "nuget"
	OCIPackageType               = "oci"
	OpkgPackageType              = "opkg"
	P2PackageType                = "p2"
	PubPackageType               = "pub"
	PuppetPackageType            = "puppet"
	PyPiPackageType              = "pypi"
	RPMPackageType               = "rpm"
	SBTPackageType               = "sbt"
	SwiftPackageType             = "swift"
	TerraformBackendPackageType  = "terraformbackend"
	TerraformModulePackageType   = "terraform_module"
	TerraformProviderPackageType = "terraform_provider"
	TerraformPackageType         = "terraform"
	VagrantPackageType           = "vagrant"
	VCSPackageType               = "vcs"
)
View Source
const CustomProjectEnvironmentSupportedVersion = "7.53.1"
View Source
const RepositoriesEndpoint = "artifactory/api/repositories/{key}"

Variables

View Source
var AlpinePrimaryKeyPairRef = map[string]*sdkv2_schema.Schema{
	"primary_keypair_ref": {
		Type:     sdkv2_schema.TypeString,
		Optional: true,
		Description: "Used to sign index files in Alpine Linux repositories. " +
			"See: https://www.jfrog.com/confluence/display/JFROG/Alpine+Linux+Repositories#AlpineLinuxRepositories-SigningAlpineLinuxIndex",
	},
}
View Source
var BaseAttributes = map[string]schema.Attribute{
	"id": schema.StringAttribute{
		Computed: true,
	},
	"key": schema.StringAttribute{
		Required: true,
		Validators: []validator.String{
			validatorfw_string.RepoKey(),
		},
		PlanModifiers: []planmodifier.String{
			stringplanmodifier.RequiresReplace(),
		},
		MarkdownDescription: "A mandatory identifier for the repository that must be unique. Must be 1 - 64 alphanumeric and hyphen characters. It cannot contain spaces or special characters.",
	},
	"project_key": schema.StringAttribute{
		Optional: true,
		Computed: true,
		Default:  stringdefault.StaticString(""),
		Validators: []validator.String{
			validatorfw_string.ProjectKey(),
		},
		MarkdownDescription: "Project key for assigning this repository to. Must be 2 - 32 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash.",
	},
	"project_environments": schema.SetAttribute{
		ElementType: types.StringType,
		Optional:    true,
		Computed:    true,
		Validators: []validator.Set{
			setvalidator.SizeBetween(0, 2),
		},
		MarkdownDescription: "Project environment for assigning this repository to. Allow values: \"DEV\", \"PROD\", or one of custom environment. " +
			"Before Artifactory 7.53.1, up to 2 values (\"DEV\" and \"PROD\") are allowed. From 7.53.1 onward, only one value is allowed. " +
			"The attribute should only be used if the repository is already assigned to the existing project. If not, " +
			"the attribute will be ignored by Artifactory, but will remain in the Terraform state, which will create " +
			"state drift during the update.",
	},
	"description": schema.StringAttribute{
		Optional:            true,
		Computed:            true,
		Default:             stringdefault.StaticString(""),
		MarkdownDescription: "Public description.",
	},
	"notes": schema.StringAttribute{
		Optional:            true,
		Computed:            true,
		Default:             stringdefault.StaticString(""),
		MarkdownDescription: "Internal description.",
	},
	"includes_pattern": schema.StringAttribute{
		Optional: true,
		Computed: true,
		Default:  stringdefault.StaticString("**/*"),
		Validators: []validator.String{
			stringvalidator.LengthAtLeast(1),
		},
		MarkdownDescription: "List of comma-separated artifact patterns to include when evaluating artifact requests in the form of `x/y/**/z/*`. " +
			"When used, only artifacts matching one of the include patterns are served. By default, all artifacts are included (`**/*`).",
	},
	"excludes_pattern": schema.StringAttribute{
		Optional: true,
		Computed: true,
		Default:  stringdefault.StaticString(""),
		MarkdownDescription: "List of artifact patterns to exclude when evaluating artifact requests, in the form of `x/y/**/z/*`." +
			"By default no artifacts are excluded.",
	},
}
View Source
var BaseSchemaV1 = map[string]*sdkv2_schema.Schema{
	"key": {
		Type:             sdkv2_schema.TypeString,
		Required:         true,
		ForceNew:         true,
		ValidateDiagFunc: sdkv2_validator.RepoKey,
		Description:      "A mandatory identifier for the repository that must be unique. Must be 1 - 64 alphanumeric and hyphen characters. It cannot contain spaces or special characters.",
	},
	"project_key": {
		Type:             sdkv2_schema.TypeString,
		Optional:         true,
		ValidateDiagFunc: sdkv2_validator.ProjectKey,
		Description:      "Project key for assigning this repository to. Must be 2 - 32 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash.",
	},
	"project_environments": {
		Type:     sdkv2_schema.TypeSet,
		Elem:     &sdkv2_schema.Schema{Type: sdkv2_schema.TypeString},
		MinItems: 0,
		MaxItems: 2,
		Set:      sdkv2_schema.HashString,
		Optional: true,
		Computed: true,
		Description: "Project environment for assigning this repository to. Allow values: \"DEV\", \"PROD\", or one of custom environment. " +
			"Before Artifactory 7.53.1, up to 2 values (\"DEV\" and \"PROD\") are allowed. From 7.53.1 onward, only one value is allowed. " +
			"The attribute should only be used if the repository is already assigned to the existing project. If not, " +
			"the attribute will be ignored by Artifactory, but will remain in the Terraform state, which will create " +
			"state drift during the update.",
	},
	"package_type": {
		Type:     sdkv2_schema.TypeString,
		Required: false,
		Computed: true,
		ForceNew: true,
	},
	"description": {
		Type:        sdkv2_schema.TypeString,
		Optional:    true,
		Description: "Public description.",
	},
	"notes": {
		Type:        sdkv2_schema.TypeString,
		Optional:    true,
		Description: "Internal description.",
	},
	"includes_pattern": {
		Type:     sdkv2_schema.TypeString,
		Optional: true,
		Default:  "**/*",
		Description: "List of comma-separated artifact patterns to include when evaluating artifact requests in the form of `x/y/**/z/*`. " +
			"When used, only artifacts matching one of the include patterns are served. By default, all artifacts are included (`**/*`).",
	},
	"excludes_pattern": {
		Type:     sdkv2_schema.TypeString,
		Optional: true,
		Description: "List of artifact patterns to exclude when evaluating artifact requests, in the form of `x/y/**/z/*`." +
			"By default no artifacts are excluded.",
	},
	"repo_layout_ref": {
		Type:     sdkv2_schema.TypeString,
		Optional: true,

		ValidateDiagFunc: ValidateRepoLayoutRefSchemaOverride,
		Description:      "Sets the layout that the repository should use for storing and identifying modules. A recommended layout that corresponds to the package type defined is suggested, and index packages uploaded and calculate metadata accordingly.",
	},
}
View Source
var CompressionFormats = map[string]*sdkv2_schema.Schema{
	"index_compression_formats": {
		Type: sdkv2_schema.TypeSet,
		Elem: &sdkv2_schema.Schema{
			Type: sdkv2_schema.TypeString,
		},
		Set:      sdkv2_schema.HashString,
		Optional: true,
	},
}
View Source
var ConanBaseSchema = map[string]*schema.Schema{
	"force_conan_authentication": {
		Type:        schema.TypeBool,
		Optional:    true,
		Default:     false,
		Description: "Force basic authentication credentials in order to use this repository. Default value is 'false'.",
	},
}
View Source
var PackageTypesLikeGradle = []string{
	GradlePackageType,
	SBTPackageType,
	IvyPackageType,
}
View Source
var PrimaryKeyPairRef = map[string]*sdkv2_schema.Schema{
	"primary_keypair_ref": {
		Type:             sdkv2_schema.TypeString,
		Optional:         true,
		ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsNotEmpty),
		Description:      "Primary keypair used to sign artifacts. Default value is empty.",
	},
}
View Source
var ProjectEnvironmentsSupported = []string{"DEV", "PROD"}
View Source
var ProxySchema = map[string]*sdkv2_schema.Schema{
	"proxy": {
		Type:        sdkv2_schema.TypeString,
		Optional:    true,
		Description: "Proxy key from Artifactory Proxies settings. Can't be set if `disable_proxy = true`.",
	},
	"disable_proxy": {
		Type:        sdkv2_schema.TypeBool,
		Optional:    true,
		Default:     false,
		Description: "When set to `true`, the proxy is disabled, and not returned in the API response body. If there is a default proxy set for the Artifactory instance, it will be ignored, too. Introduced since Artifactory 7.41.7.",
	},
}
View Source
var SecondaryKeyPairRef = map[string]*sdkv2_schema.Schema{
	"secondary_keypair_ref": {
		Type:             sdkv2_schema.TypeString,
		Optional:         true,
		ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsNotEmpty),
		Description:      "Secondary keypair used to sign artifacts.",
	},
}

Functions

func AssignRepoToProject added in v12.7.0

func AssignRepoToProject(repoKey string, projectKey string, client *resty.Client) error

func CheckRepo

func CheckRepo(id string, request *resty.Request) (*resty.Response, error)

func Create

func Create(ctx context.Context, d *sdkv2_schema.ResourceData, m interface{}, unpack unpacker.UnpackFunc) sdkv2_diag.Diagnostics

func DeleteRepo

func DeleteRepo(ctx context.Context, d *sdkv2_schema.ResourceData, m interface{}) sdkv2_diag.Diagnostics

func GetArtifactCount added in v12.1.0

func GetArtifactCount(repoKey string, client *resty.Client) (int, error)

func GetDefaultRepoLayoutRef

func GetDefaultRepoLayoutRef(repositoryType, packageType string) (string, error)

GetDefaultRepoLayoutRef return the default repo layout by Repository Type & Package Type

func HandleResetWithNonExistentValue

func HandleResetWithNonExistentValue(d *utilsdk.ResourceData, key string) string

HandleResetWithNonExistentValue Special handling for field that requires non-existant value for RT

Artifactory REST API will not accept empty string or null to reset value to not set Instead, using a non-existant value works as a workaround To ensure we don't accidentally set the value to a valid value, we use a UUID v4 string

func MkRepoRead

func MkRepoRead(pack packer.PackFunc, construct Constructor) sdkv2_schema.ReadContextFunc

func MkResourceSchema

func MkResourceSchema(skeemas map[int16]map[string]*sdkv2_schema.Schema, packer packer.PackFunc, unpack unpacker.UnpackFunc, constructor Constructor) *sdkv2_schema.Resource

func ProjectEnvironmentsDiff

func ProjectEnvironmentsDiff(ctx context.Context, diff *sdkv2_schema.ResourceDiff, meta interface{}) error

func RepoLayoutRefAttribute added in v12.7.0

func RepoLayoutRefAttribute(repositoryType string, packageType string) map[string]schema.Attribute

func RepoLayoutRefSDKv2Schema added in v12.7.0

func RepoLayoutRefSDKv2Schema(repositoryType string, packageType string) map[string]*sdkv2_schema.Schema

func Resource added in v12.1.0

func Resource(skeema map[string]*sdkv2_schema.Schema) *sdkv2_schema.Resource

func ResourceUpgradeProjectKey

func ResourceUpgradeProjectKey(ctx context.Context, rawState map[string]any, meta any) (map[string]any, error)

func Retry400

func Retry400(response *resty.Response, _ error) bool

func UnassignRepoFromProject added in v12.7.0

func UnassignRepoFromProject(repoKey string, client *resty.Client) error

func Update

func Update(ctx context.Context, d *sdkv2_schema.ResourceData, m interface{}, unpack unpacker.UnpackFunc) sdkv2_diag.Diagnostics

func ValidateRepoLayoutRefSchemaOverride

func ValidateRepoLayoutRefSchemaOverride(_ interface{}, _ cty.Path) sdkv2_diag.Diagnostics

func VerifyDisableProxy

func VerifyDisableProxy(_ context.Context, diff *sdkv2_schema.ResourceDiff, _ interface{}) error

Types

type BaseAPIModel added in v12.7.0

type BaseAPIModel struct {
	Key                 string   `json:"key"`
	ProjectKey          string   `json:"projectKey"`
	ProjectEnvironments []string `json:"environments,omitempty"`
	Rclass              string   `json:"rclass"`
	PackageType         string   `json:"packageType"`
	Description         string   `json:"description"`
	Notes               string   `json:"notes"`
	IncludesPattern     string   `json:"includesPattern"`
	ExcludesPattern     string   `json:"excludesPattern"`
	RepoLayoutRef       string   `json:"repoLayoutRef"`
}

type BaseResource added in v12.7.0

type BaseResource struct {
	util.JFrogResource
	Description       string
	PackageType       string
	Rclass            string
	ResourceModelType reflect.Type
	APIModelType      reflect.Type
}

func (*BaseResource) Create added in v12.7.0

func (*BaseResource) Delete added in v12.7.0

func (*BaseResource) ImportState added in v12.7.0

ImportState imports the resource into the Terraform state.

func (*BaseResource) Read added in v12.7.0

func (*BaseResource) Update added in v12.7.0

func (BaseResource) ValidateConfig added in v12.7.0

type BaseResourceModel added in v12.7.0

type BaseResourceModel struct {
	ID                  types.String `tfsdk:"id"`
	Key                 types.String `tfsdk:"key"`
	ProjectKey          types.String `tfsdk:"project_key"`
	ProjectEnvironments types.Set    `tfsdk:"project_environments"`
	Description         types.String `tfsdk:"description"`
	Notes               types.String `tfsdk:"notes"`
	IncludesPattern     types.String `tfsdk:"includes_pattern"`
	ExcludesPattern     types.String `tfsdk:"excludes_pattern"`
}

func (*BaseResourceModel) FromAPIModel added in v12.7.0

func (r *BaseResourceModel) FromAPIModel(ctx context.Context, apiModel interface{}) diag.Diagnostics

func (BaseResourceModel) KeyString added in v12.7.0

func (r BaseResourceModel) KeyString() string

func (BaseResourceModel) ProjectEnvironmentsValue added in v12.7.0

func (r BaseResourceModel) ProjectEnvironmentsValue() basetypes.SetValue

func (BaseResourceModel) ProjectKeyValue added in v12.7.0

func (r BaseResourceModel) ProjectKeyValue() basetypes.StringValue

func (*BaseResourceModel) SetID added in v12.7.0

func (r *BaseResourceModel) SetID(id string)

func (*BaseResourceModel) SetProjectEnvironments added in v12.7.0

func (r *BaseResourceModel) SetProjectEnvironments(v basetypes.SetValue)

func (BaseResourceModel) ToAPIModel added in v12.7.0

func (r BaseResourceModel) ToAPIModel(ctx context.Context, rclass, packageType string) (interface{}, diag.Diagnostics)

type ConanBaseParams

type ConanBaseParams struct {
	EnableConanSupport       bool `json:"enableConanSupport"`
	ForceConanAuthentication bool `json:"forceConanAuthentication"`
}

type Constructor

type Constructor func() (interface{}, error)

Constructor Must return a pointer to a struct. When just returning a struct, resty gets confused and thinks it's a map

type ContentSynchronisation

type ContentSynchronisation struct {
	Enabled    bool                             `json:"enabled"`
	Statistics ContentSynchronisationStatistics `json:"statistics"`
	Properties ContentSynchronisationProperties `json:"properties"`
	Source     ContentSynchronisationSource     `json:"source"`
}

type ContentSynchronisationProperties

type ContentSynchronisationProperties struct {
	Enabled bool `hcl:"properties_enabled" json:"enabled"`
}

type ContentSynchronisationSource

type ContentSynchronisationSource struct {
	OriginAbsenceDetection bool `hcl:"source_origin_absence_detection" json:"originAbsenceDetection"`
}

type ContentSynchronisationStatistics

type ContentSynchronisationStatistics struct {
	Enabled bool `hcl:"statistics_enabled" json:"enabled"`
}

type PrimaryKeyPairRefParam

type PrimaryKeyPairRefParam struct {
	PrimaryKeyPairRef string `hcl:"primary_keypair_ref" json:"primaryKeyPairRef"`
}

type ReadFunc

type ReadFunc func(d *sdkv2_schema.ResourceData, m interface{}) error

type RepositoryFileList added in v12.1.0

type RepositoryFileList struct {
	URI   string            `json:"uri"`
	Files []json.RawMessage `json:"files"`
}

type ResourceModelIface added in v12.7.0

type ResourceModelIface interface {
	SetID(string)
	KeyString() string
	ToAPIModel(ctx context.Context, packageType string) (interface{}, diag.Diagnostics)
	FromAPIModel(ctx context.Context, apiModel interface{}) diag.Diagnostics
	GetCreateResourcePlanData(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
	SetCreateResourceStateData(ctx context.Context, resp *resource.CreateResponse)
	GetReadResourceStateData(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
	SetReadResourceStateData(ctx context.Context, resp *resource.ReadResponse)
	GetUpdateResourcePlanData(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
	GetUpdateResourceStateData(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
	SetUpdateResourceStateData(ctx context.Context, resp *resource.UpdateResponse)
	ProjectEnvironmentsValue() basetypes.SetValue
	SetProjectEnvironments(basetypes.SetValue)
	ProjectKeyValue() basetypes.StringValue
}

type SecondaryKeyPairRefParam

type SecondaryKeyPairRefParam struct {
	SecondaryKeyPairRef string `hcl:"secondary_keypair_ref" json:"secondaryKeyPairRef"`
}

type SupportedRepoClasses

type SupportedRepoClasses struct {
	RepoLayoutRef      string
	SupportedRepoTypes map[string]bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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