-
Notifications
You must be signed in to change notification settings - Fork 101
/
resource_artifactory_virtual_nuget_repository.go
44 lines (36 loc) · 1.34 KB
/
resource_artifactory_virtual_nuget_repository.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package artifactory
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func resourceArtifactoryNugetVirtualRepository() *schema.Resource {
const packageType = "nuget"
var nugetVirtualSchema = mergeSchema(baseVirtualRepoSchema, map[string]*schema.Schema{
"force_nuget_authentication": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "Force basic authentication credentials in order to use this repository.",
},
}, repoLayoutRefSchema("virtual", packageType))
type NugetVirtualRepositoryParams struct {
VirtualRepositoryBaseParams
ForceNugetAuthentication bool `json:"forceNugetAuthentication"`
}
var unpackNugetVirtualRepository = func(s *schema.ResourceData) (interface{}, string, error) {
d := &ResourceData{s}
repo := NugetVirtualRepositoryParams{
VirtualRepositoryBaseParams: unpackBaseVirtRepo(s, packageType),
ForceNugetAuthentication: d.getBool("force_nuget_authentication", false),
}
repo.PackageType = packageType
return &repo, repo.Key, nil
}
return mkResourceSchema(nugetVirtualSchema, defaultPacker(nugetVirtualSchema), unpackNugetVirtualRepository, func() interface{} {
return &NugetVirtualRepositoryParams{
VirtualRepositoryBaseParams: VirtualRepositoryBaseParams{
Rclass: "virtual",
PackageType: packageType,
},
}
})
}