/
conversation.go
202 lines (168 loc) · 12.8 KB
/
conversation.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// 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 v2
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new conversation. Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And during `Automated Agent Stage`, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.
// Auto-naming is currently not supported for this resource.
// Note - this resource's API doesn't support deletion. When deleted, the resource will persist
// on Google Cloud even though it will be deleted from Pulumi state.
type Conversation struct {
pulumi.CustomResourceState
// Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression fomula `a-zA-Z*` with the characters length in range of [3,64]. If the field is provided, the caller is resposible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
ConversationId pulumi.StringPtrOutput `pulumi:"conversationId"`
// The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
ConversationProfile pulumi.StringOutput `pulumi:"conversationProfile"`
// The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
ConversationStage pulumi.StringOutput `pulumi:"conversationStage"`
// The time the conversation was finished.
EndTime pulumi.StringOutput `pulumi:"endTime"`
// The current state of the Conversation.
LifecycleState pulumi.StringOutput `pulumi:"lifecycleState"`
Location pulumi.StringOutput `pulumi:"location"`
// The unique identifier of this conversation. Format: `projects//locations//conversations/`.
Name pulumi.StringOutput `pulumi:"name"`
// It will not be empty if the conversation is to be connected over telephony.
PhoneNumber GoogleCloudDialogflowV2ConversationPhoneNumberResponseOutput `pulumi:"phoneNumber"`
Project pulumi.StringOutput `pulumi:"project"`
// The time the conversation was started.
StartTime pulumi.StringOutput `pulumi:"startTime"`
}
// NewConversation registers a new resource with the given unique name, arguments, and options.
func NewConversation(ctx *pulumi.Context,
name string, args *ConversationArgs, opts ...pulumi.ResourceOption) (*Conversation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ConversationProfile == nil {
return nil, errors.New("invalid value for required argument 'ConversationProfile'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"location",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Conversation
err := ctx.RegisterResource("google-native:dialogflow/v2:Conversation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetConversation gets an existing Conversation 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 GetConversation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ConversationState, opts ...pulumi.ResourceOption) (*Conversation, error) {
var resource Conversation
err := ctx.ReadResource("google-native:dialogflow/v2:Conversation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Conversation resources.
type conversationState struct {
}
type ConversationState struct {
}
func (ConversationState) ElementType() reflect.Type {
return reflect.TypeOf((*conversationState)(nil)).Elem()
}
type conversationArgs struct {
// Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression fomula `a-zA-Z*` with the characters length in range of [3,64]. If the field is provided, the caller is resposible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
ConversationId *string `pulumi:"conversationId"`
// The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
ConversationProfile string `pulumi:"conversationProfile"`
// The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
ConversationStage *ConversationConversationStage `pulumi:"conversationStage"`
Location *string `pulumi:"location"`
Project *string `pulumi:"project"`
}
// The set of arguments for constructing a Conversation resource.
type ConversationArgs struct {
// Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression fomula `a-zA-Z*` with the characters length in range of [3,64]. If the field is provided, the caller is resposible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
ConversationId pulumi.StringPtrInput
// The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
ConversationProfile pulumi.StringInput
// The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
ConversationStage ConversationConversationStagePtrInput
Location pulumi.StringPtrInput
Project pulumi.StringPtrInput
}
func (ConversationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*conversationArgs)(nil)).Elem()
}
type ConversationInput interface {
pulumi.Input
ToConversationOutput() ConversationOutput
ToConversationOutputWithContext(ctx context.Context) ConversationOutput
}
func (*Conversation) ElementType() reflect.Type {
return reflect.TypeOf((**Conversation)(nil)).Elem()
}
func (i *Conversation) ToConversationOutput() ConversationOutput {
return i.ToConversationOutputWithContext(context.Background())
}
func (i *Conversation) ToConversationOutputWithContext(ctx context.Context) ConversationOutput {
return pulumi.ToOutputWithContext(ctx, i).(ConversationOutput)
}
type ConversationOutput struct{ *pulumi.OutputState }
func (ConversationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Conversation)(nil)).Elem()
}
func (o ConversationOutput) ToConversationOutput() ConversationOutput {
return o
}
func (o ConversationOutput) ToConversationOutputWithContext(ctx context.Context) ConversationOutput {
return o
}
// Optional. Identifier of the conversation. Generally it's auto generated by Google. Only set it if you cannot wait for the response to return a auto-generated one to you. The conversation ID must be compliant with the regression fomula `a-zA-Z*` with the characters length in range of [3,64]. If the field is provided, the caller is resposible for 1. the uniqueness of the ID, otherwise the request will be rejected. 2. the consistency for whether to use custom ID or not under a project to better ensure uniqueness.
func (o ConversationOutput) ConversationId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringPtrOutput { return v.ConversationId }).(pulumi.StringPtrOutput)
}
// The Conversation Profile to be used to configure this Conversation. This field cannot be updated. Format: `projects//locations//conversationProfiles/`.
func (o ConversationOutput) ConversationProfile() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.ConversationProfile }).(pulumi.StringOutput)
}
// The stage of a conversation. It indicates whether the virtual agent or a human agent is handling the conversation. If the conversation is created with the conversation profile that has Dialogflow config set, defaults to ConversationStage.VIRTUAL_AGENT_STAGE; Otherwise, defaults to ConversationStage.HUMAN_ASSIST_STAGE. If the conversation is created with the conversation profile that has Dialogflow config set but explicitly sets conversation_stage to ConversationStage.HUMAN_ASSIST_STAGE, it skips ConversationStage.VIRTUAL_AGENT_STAGE stage and directly goes to ConversationStage.HUMAN_ASSIST_STAGE.
func (o ConversationOutput) ConversationStage() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.ConversationStage }).(pulumi.StringOutput)
}
// The time the conversation was finished.
func (o ConversationOutput) EndTime() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.EndTime }).(pulumi.StringOutput)
}
// The current state of the Conversation.
func (o ConversationOutput) LifecycleState() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.LifecycleState }).(pulumi.StringOutput)
}
func (o ConversationOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// The unique identifier of this conversation. Format: `projects//locations//conversations/`.
func (o ConversationOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// It will not be empty if the conversation is to be connected over telephony.
func (o ConversationOutput) PhoneNumber() GoogleCloudDialogflowV2ConversationPhoneNumberResponseOutput {
return o.ApplyT(func(v *Conversation) GoogleCloudDialogflowV2ConversationPhoneNumberResponseOutput {
return v.PhoneNumber
}).(GoogleCloudDialogflowV2ConversationPhoneNumberResponseOutput)
}
func (o ConversationOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// The time the conversation was started.
func (o ConversationOutput) StartTime() pulumi.StringOutput {
return o.ApplyT(func(v *Conversation) pulumi.StringOutput { return v.StartTime }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ConversationInput)(nil)).Elem(), &Conversation{})
pulumi.RegisterOutputType(ConversationOutput{})
}