generated from pulumi/pulumi-tf-provider-boilerplate
/
getNamespaces.go
165 lines (145 loc) · 5.82 KB
/
getNamespaces.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package cci
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to obtain CCI namespaces within HuaweiCloud.
//
// ## Example Usage
// ### Get the specified namespace details
//
// ```go
// package main
//
// import (
//
// "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Cci"
// "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Cci"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// namespaceName := cfg.RequireObject("namespaceName")
// _, err := Cci.GetNamespaces(ctx, &cci.GetNamespacesArgs{
// Name: pulumi.StringRef(namespaceName),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetNamespaces(ctx *pulumi.Context, args *GetNamespacesArgs, opts ...pulumi.InvokeOption) (*GetNamespacesResult, error) {
opts = pkgInvokeDefaultOpts(opts)
var rv GetNamespacesResult
err := ctx.Invoke("huaweicloud:Cci/getNamespaces:getNamespaces", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getNamespaces.
type GetNamespacesArgs struct {
// Specifies the enterprise project ID in UUID format.
EnterpriseProjectId *string `pulumi:"enterpriseProjectId"`
// Specifies th name of the specified CCI namespace.
// This parameter can contain a maximum of 63 characters, which may consist of lowercase letters, digits and hyphens,
// and must start and end with lowercase letters and digits.
Name *string `pulumi:"name"`
// Specifies the region in which to obtain the CCI namespace list.
// If omitted, the provider-level region will be used.
Region *string `pulumi:"region"`
// Specifies the CCI namespace type.
// The valid values are **general-computing** and **gpu-accelerated**.
Type *string `pulumi:"type"`
}
// A collection of values returned by getNamespaces.
type GetNamespacesResult struct {
// The enterprise project ID in UUID format.
EnterpriseProjectId *string `pulumi:"enterpriseProjectId"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The CCI network name.
Name *string `pulumi:"name"`
// All CCI namespaces that meet the query parameters.
Namespaces []GetNamespacesNamespace `pulumi:"namespaces"`
Region string `pulumi:"region"`
// The CCI namespace type.
Type *string `pulumi:"type"`
}
func GetNamespacesOutput(ctx *pulumi.Context, args GetNamespacesOutputArgs, opts ...pulumi.InvokeOption) GetNamespacesResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetNamespacesResult, error) {
args := v.(GetNamespacesArgs)
r, err := GetNamespaces(ctx, &args, opts...)
var s GetNamespacesResult
if r != nil {
s = *r
}
return s, err
}).(GetNamespacesResultOutput)
}
// A collection of arguments for invoking getNamespaces.
type GetNamespacesOutputArgs struct {
// Specifies the enterprise project ID in UUID format.
EnterpriseProjectId pulumi.StringPtrInput `pulumi:"enterpriseProjectId"`
// Specifies th name of the specified CCI namespace.
// This parameter can contain a maximum of 63 characters, which may consist of lowercase letters, digits and hyphens,
// and must start and end with lowercase letters and digits.
Name pulumi.StringPtrInput `pulumi:"name"`
// Specifies the region in which to obtain the CCI namespace list.
// If omitted, the provider-level region will be used.
Region pulumi.StringPtrInput `pulumi:"region"`
// Specifies the CCI namespace type.
// The valid values are **general-computing** and **gpu-accelerated**.
Type pulumi.StringPtrInput `pulumi:"type"`
}
func (GetNamespacesOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetNamespacesArgs)(nil)).Elem()
}
// A collection of values returned by getNamespaces.
type GetNamespacesResultOutput struct{ *pulumi.OutputState }
func (GetNamespacesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetNamespacesResult)(nil)).Elem()
}
func (o GetNamespacesResultOutput) ToGetNamespacesResultOutput() GetNamespacesResultOutput {
return o
}
func (o GetNamespacesResultOutput) ToGetNamespacesResultOutputWithContext(ctx context.Context) GetNamespacesResultOutput {
return o
}
// The enterprise project ID in UUID format.
func (o GetNamespacesResultOutput) EnterpriseProjectId() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetNamespacesResult) *string { return v.EnterpriseProjectId }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetNamespacesResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetNamespacesResult) string { return v.Id }).(pulumi.StringOutput)
}
// The CCI network name.
func (o GetNamespacesResultOutput) Name() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetNamespacesResult) *string { return v.Name }).(pulumi.StringPtrOutput)
}
// All CCI namespaces that meet the query parameters.
func (o GetNamespacesResultOutput) Namespaces() GetNamespacesNamespaceArrayOutput {
return o.ApplyT(func(v GetNamespacesResult) []GetNamespacesNamespace { return v.Namespaces }).(GetNamespacesNamespaceArrayOutput)
}
func (o GetNamespacesResultOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v GetNamespacesResult) string { return v.Region }).(pulumi.StringOutput)
}
// The CCI namespace type.
func (o GetNamespacesResultOutput) Type() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetNamespacesResult) *string { return v.Type }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(GetNamespacesResultOutput{})
}