-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_source_repository_nuget_proxy.go
46 lines (40 loc) · 1.56 KB
/
data_source_repository_nuget_proxy.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
45
46
package repository
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/nduyphuong/terraform-provider-nexus/internal/schema/common"
repositorySchema "github.com/nduyphuong/terraform-provider-nexus/internal/schema/repository"
)
func DataSourceRepositoryNugetProxy() *schema.Resource {
return &schema.Resource{
Description: "Use this data source to get an existing nuget proxy repository.",
Read: dataSourceRepositoryNugetProxyRead,
Schema: map[string]*schema.Schema{
// Common schemas
"id": common.DataSourceID,
"name": repositorySchema.DataSourceName,
"online": repositorySchema.DataSourceOnline,
// Proxy schemas
"cleanup": repositorySchema.DataSourceCleanup,
"http_client": repositorySchema.DataSourceHTTPClient,
"negative_cache": repositorySchema.DataSourceNegativeCache,
"proxy": repositorySchema.DataSourceProxy,
"routing_rule": repositorySchema.DataSourceRoutingRule,
"storage": repositorySchema.DataSourceStorage,
// Nuget proxy schemas
"nuget_version": {
Description: "Nuget protocol version",
Computed: true,
Type: schema.TypeString,
},
"query_cache_item_max_age": {
Description: "How long to cache query results from the proxied repository (in seconds)",
Computed: true,
Type: schema.TypeInt,
},
},
}
}
func dataSourceRepositoryNugetProxyRead(resourceData *schema.ResourceData, m interface{}) error {
resourceData.SetId(resourceData.Get("name").(string))
return resourceNugetProxyRepositoryRead(resourceData, m)
}