/
knowledgeBase.go
162 lines (133 loc) · 6.66 KB
/
knowledgeBase.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
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v2beta1
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.
type KnowledgeBase struct {
pulumi.CustomResourceState
// The display name of the knowledge base. The name must be 1024 bytes or less; otherwise, the creation request fails.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// Language which represents the KnowledgeBase. When the KnowledgeBase is created/updated, this is populated for all non en-us languages. If not populated, the default language en-us applies.
LanguageCode pulumi.StringOutput `pulumi:"languageCode"`
Location pulumi.StringOutput `pulumi:"location"`
// The knowledge base resource name. The name must be empty when creating a knowledge base. Format: `projects//locations//knowledgeBases/`.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
}
// NewKnowledgeBase registers a new resource with the given unique name, arguments, and options.
func NewKnowledgeBase(ctx *pulumi.Context,
name string, args *KnowledgeBaseArgs, opts ...pulumi.ResourceOption) (*KnowledgeBase, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DisplayName == nil {
return nil, errors.New("invalid value for required argument 'DisplayName'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"location",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource KnowledgeBase
err := ctx.RegisterResource("google-native:dialogflow/v2beta1:KnowledgeBase", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKnowledgeBase gets an existing KnowledgeBase resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetKnowledgeBase(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KnowledgeBaseState, opts ...pulumi.ResourceOption) (*KnowledgeBase, error) {
var resource KnowledgeBase
err := ctx.ReadResource("google-native:dialogflow/v2beta1:KnowledgeBase", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering KnowledgeBase resources.
type knowledgeBaseState struct {
}
type KnowledgeBaseState struct {
}
func (KnowledgeBaseState) ElementType() reflect.Type {
return reflect.TypeOf((*knowledgeBaseState)(nil)).Elem()
}
type knowledgeBaseArgs struct {
// The display name of the knowledge base. The name must be 1024 bytes or less; otherwise, the creation request fails.
DisplayName string `pulumi:"displayName"`
// Language which represents the KnowledgeBase. When the KnowledgeBase is created/updated, this is populated for all non en-us languages. If not populated, the default language en-us applies.
LanguageCode *string `pulumi:"languageCode"`
Location *string `pulumi:"location"`
// The knowledge base resource name. The name must be empty when creating a knowledge base. Format: `projects//locations//knowledgeBases/`.
Name *string `pulumi:"name"`
Project *string `pulumi:"project"`
}
// The set of arguments for constructing a KnowledgeBase resource.
type KnowledgeBaseArgs struct {
// The display name of the knowledge base. The name must be 1024 bytes or less; otherwise, the creation request fails.
DisplayName pulumi.StringInput
// Language which represents the KnowledgeBase. When the KnowledgeBase is created/updated, this is populated for all non en-us languages. If not populated, the default language en-us applies.
LanguageCode pulumi.StringPtrInput
Location pulumi.StringPtrInput
// The knowledge base resource name. The name must be empty when creating a knowledge base. Format: `projects//locations//knowledgeBases/`.
Name pulumi.StringPtrInput
Project pulumi.StringPtrInput
}
func (KnowledgeBaseArgs) ElementType() reflect.Type {
return reflect.TypeOf((*knowledgeBaseArgs)(nil)).Elem()
}
type KnowledgeBaseInput interface {
pulumi.Input
ToKnowledgeBaseOutput() KnowledgeBaseOutput
ToKnowledgeBaseOutputWithContext(ctx context.Context) KnowledgeBaseOutput
}
func (*KnowledgeBase) ElementType() reflect.Type {
return reflect.TypeOf((**KnowledgeBase)(nil)).Elem()
}
func (i *KnowledgeBase) ToKnowledgeBaseOutput() KnowledgeBaseOutput {
return i.ToKnowledgeBaseOutputWithContext(context.Background())
}
func (i *KnowledgeBase) ToKnowledgeBaseOutputWithContext(ctx context.Context) KnowledgeBaseOutput {
return pulumi.ToOutputWithContext(ctx, i).(KnowledgeBaseOutput)
}
type KnowledgeBaseOutput struct{ *pulumi.OutputState }
func (KnowledgeBaseOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KnowledgeBase)(nil)).Elem()
}
func (o KnowledgeBaseOutput) ToKnowledgeBaseOutput() KnowledgeBaseOutput {
return o
}
func (o KnowledgeBaseOutput) ToKnowledgeBaseOutputWithContext(ctx context.Context) KnowledgeBaseOutput {
return o
}
// The display name of the knowledge base. The name must be 1024 bytes or less; otherwise, the creation request fails.
func (o KnowledgeBaseOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *KnowledgeBase) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// Language which represents the KnowledgeBase. When the KnowledgeBase is created/updated, this is populated for all non en-us languages. If not populated, the default language en-us applies.
func (o KnowledgeBaseOutput) LanguageCode() pulumi.StringOutput {
return o.ApplyT(func(v *KnowledgeBase) pulumi.StringOutput { return v.LanguageCode }).(pulumi.StringOutput)
}
func (o KnowledgeBaseOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *KnowledgeBase) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// The knowledge base resource name. The name must be empty when creating a knowledge base. Format: `projects//locations//knowledgeBases/`.
func (o KnowledgeBaseOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *KnowledgeBase) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o KnowledgeBaseOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *KnowledgeBase) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*KnowledgeBaseInput)(nil)).Elem(), &KnowledgeBase{})
pulumi.RegisterOutputType(KnowledgeBaseOutput{})
}