repository

package
v9.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ConanPackageType = "conan"
View Source
const CustomProjectEnvironmentSupportedVersion = "7.53.1"
View Source
const RepositoriesEndpoint = "artifactory/api/repositories/{key}"

Variables

View Source
var BaseRepoSchema = map[string]*schema.Schema{
	"key": {
		Type:         schema.TypeString,
		Required:     true,
		ForceNew:     true,
		ValidateFunc: RepoKeyValidator,
		Description:  "A mandatory identifier for the repository that must be unique. Must be 3 - 10 lowercase alphanumeric and hyphen characters. It cannot begin with a number or contain spaces or special characters.",
	},
	"project_key": {
		Type:             schema.TypeString,
		Optional:         true,
		ValidateDiagFunc: validator.ProjectKey,
		Description:      "Project key for assigning this repository to. Must be 2 - 20 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:     schema.TypeSet,
		Elem:     &schema.Schema{Type: schema.TypeString},
		MinItems: 0,
		MaxItems: 2,
		Set:      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:     schema.TypeString,
		Required: false,
		Computed: true,
		ForceNew: true,
	},
	"description": {
		Type:        schema.TypeString,
		Optional:    true,
		Description: "Public description.",
	},
	"notes": {
		Type:        schema.TypeString,
		Optional:    true,
		Description: "Internal description.",
	},
	"includes_pattern": {
		Type:     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:     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:     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]*schema.Schema{
	"index_compression_formats": {
		Type: schema.TypeSet,
		Elem: &schema.Schema{
			Type: schema.TypeString,
		},
		Set:      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 GradleLikePackageTypes = []string{
	"gradle",
	"sbt",
	"ivy",
}
View Source
var ProjectEnvironmentsSupported = []string{"DEV", "PROD"}
View Source
var ProxySchema = map[string]*schema.Schema{
	"proxy": {
		Type:        schema.TypeString,
		Optional:    true,
		Description: "Proxy key from Artifactory Proxies settings. Can't be set if `disable_proxy = true`.",
	},
	"disable_proxy": {
		Type:        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 RepoKeyValidator = validation.All(
	validation.StringDoesNotMatch(regexp.MustCompile("^[0-9].*"), "repo key cannot start with a number"),
	validation.StringDoesNotContainAny(" !@#$%^&*()+={}[]:;<>,/?~`|\\"),
)

Functions

func CheckRepo

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

func Create added in v9.7.3

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

func DeleteRepo

func DeleteRepo(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics

func GetDefaultRepoLayoutRef

func GetDefaultRepoLayoutRef(repositoryType, packageType string) func() (interface{}, 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) schema.ReadContextFunc

func MkResourceSchema

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

func ProjectEnvironmentsDiff

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

func RepoLayoutRefSchema

func RepoLayoutRefSchema(repositoryType string, packageType string) map[string]*schema.Schema

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 Update added in v9.7.3

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

func ValidateRepoLayoutRefSchemaOverride

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

func VerifyDisableProxy added in v9.9.0

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

Types

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 ReadFunc

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

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