-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_source_repository_yum_hosted.go
42 lines (37 loc) · 1.36 KB
/
data_source_repository_yum_hosted.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
package repository
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/nduyphuong/terraform-provider-nexus/internal/schema/common"
"github.com/nduyphuong/terraform-provider-nexus/internal/schema/repository"
)
func DataSourceRepositoryYumHosted() *schema.Resource {
return &schema.Resource{
Description: "Use this data source to get an existing hosted yum repository.",
Read: dataSourceRepositoryYumHostedRead,
Schema: map[string]*schema.Schema{
// Common schemas
"id": common.DataSourceID,
"name": repository.DataSourceName,
"online": repository.DataSourceOnline,
// Hosted schemas
"cleanup": repository.DataSourceCleanup,
"component": repository.DataSourceComponent,
"storage": repository.DataSourceHostedStorage,
// Yum hosted schemas
"deploy_policy": {
Description: "Validate that all paths are RPMs or yum metadata. Possible values: `STRICT` or `PERMISSIVE`",
Type: schema.TypeString,
Computed: true,
},
"repodata_depth": {
Description: "Specifies the repository depth where repodata folder(s) are created. Possible values: 0-5",
Type: schema.TypeInt,
Computed: true,
},
},
}
}
func dataSourceRepositoryYumHostedRead(d *schema.ResourceData, m interface{}) error {
d.SetId(d.Get("name").(string))
return resourceYumHostedRepositoryRead(d, m)
}