Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
balanaguharsha authored and Balanagu Harsha Vardhan committed Nov 5, 2023
2 parents fbb5d50 + d7cf6a7 commit 402fab4
Show file tree
Hide file tree
Showing 74 changed files with 1,628 additions and 309 deletions.
24 changes: 22 additions & 2 deletions mmv1/products/dialogflowcx/Flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,37 @@ timeouts: !ruby/object:Api::Timeouts
update_minutes: 40
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/dialogflowcx_flow.go.erb
pre_create: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_create: templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb
pre_update: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_delete: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_delete: templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.erb
pre_read: templates/terraform/pre_create/dialogflow_set_location.go.erb
virtual_fields:
- !ruby/object:Api::Type::Boolean
name: is_default_start_flow
immutable: true
description: |
Marks this as the [Default Start Flow](https://cloud.google.com/dialogflow/cx/docs/concept/flow#start) for an agent. When you create an agent, the Default Start Flow is created automatically.
The Default Start Flow cannot be deleted; deleting the `google_dialogflow_cx_flow` resource does nothing to the underlying GCP resources.
~> Avoid having multiple `google_dialogflow_cx_flow` resources linked to the same agent with `is_default_start_flow = true` because they will compete to control a single Default Start Flow resource in GCP.
examples:
- !ruby/object:Provider::Terraform::Examples
name: 'dialogflowcx_flow_basic'
primary_resource_id: 'basic_flow'
vars:
agent_name: 'dialogflowcx-agent'
- !ruby/object:Provider::Terraform::Examples
name: 'dialogflowcx_flow_full'
primary_resource_id: 'basic_flow'
vars:
agent_name: 'dialogflowcx-agent'
bucket_name: 'dialogflowcx-bucket'
- !ruby/object:Provider::Terraform::Examples
skip_docs: true
name: 'dialogflowcx_flow_default_start_flow'
primary_resource_id: 'default_start_flow'
vars:
agent_name: 'dialogflowcx-agent'
skip_sweeper: true
id_format: '{{parent}}/flows/{{name}}'
import_format: ['{{parent}}/flows/{{name}}']
Expand Down
34 changes: 32 additions & 2 deletions mmv1/products/dialogflowcx/Intent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,45 @@ timeouts: !ruby/object:Api::Timeouts
update_minutes: 40
custom_code: !ruby/object:Provider::Terraform::CustomCode
custom_import: templates/terraform/custom_import/dialogflowcx_intent.go.erb
pre_create: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_create: templates/terraform/pre_create/dialogflowcx_set_location_skip_default_obj.go.erb
pre_update: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_delete: templates/terraform/pre_create/dialogflow_set_location.go.erb
pre_delete: templates/terraform/pre_delete/dialogflowcx_set_location_skip_default_obj.go.erb
pre_read: templates/terraform/pre_create/dialogflow_set_location.go.erb
virtual_fields:
- !ruby/object:Api::Type::Boolean
name: is_default_welcome_intent
immutable: true
description: |
Marks this as the [Default Welcome Intent](https://cloud.google.com/dialogflow/cx/docs/concept/intent#welcome) for an agent. When you create an agent, a Default Welcome Intent is created automatically.
The Default Welcome Intent cannot be deleted; deleting the `google_dialogflow_cx_intent` resource does nothing to the underlying GCP resources.
~> Avoid having multiple `google_dialogflow_cx_intent` resources linked to the same agent with `is_default_welcome_intent = true` because they will compete to control a single Default Welcome Intent resource in GCP.
- !ruby/object:Api::Type::Boolean
name: is_default_negative_intent
immutable: true
description: |
Marks this as the [Default Negative Intent](https://cloud.google.com/dialogflow/cx/docs/concept/intent#negative) for an agent. When you create an agent, a Default Negative Intent is created automatically.
The Default Negative Intent cannot be deleted; deleting the `google_dialogflow_cx_intent` resource does nothing to the underlying GCP resources.
~> Avoid having multiple `google_dialogflow_cx_intent` resources linked to the same agent with `is_default_negative_intent = true` because they will compete to control a single Default Negative Intent resource in GCP.
examples:
- !ruby/object:Provider::Terraform::Examples
name: 'dialogflowcx_intent_full'
primary_resource_id: 'basic_intent'
vars:
agent_name: 'dialogflowcx-agent'
- !ruby/object:Provider::Terraform::Examples
skip_docs: true
name: 'dialogflowcx_intent_default_negative_intent'
primary_resource_id: 'default_negative_intent'
vars:
agent_name: 'dialogflowcx-agent'
- !ruby/object:Provider::Terraform::Examples
skip_docs: true
name: 'dialogflowcx_intent_default_welcome_intent'
primary_resource_id: 'default_welcome_intent'
vars:
agent_name: 'dialogflowcx-agent'
skip_sweeper: true
id_format: '{{parent}}/intents/{{name}}'
import_format: ['{{parent}}/intents/{{name}}']
Expand Down Expand Up @@ -144,6 +173,7 @@ properties:
description: |
Indicates whether this is a fallback intent. Currently only default fallback intent is allowed in the agent, which is added upon agent creation.
Adding training phrases to fallback intent is useful in the case of requests that are mistakenly matched, since training phrases assigned to fallback intents act as negative examples that triggers no-match event.
To manage the fallback intent, set `is_default_negative_intent = true`
- !ruby/object:Api::Type::KeyValueLabels
name: 'labels'
description: |
Expand Down
3 changes: 2 additions & 1 deletion mmv1/products/pubsub/Topic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,5 @@ properties:
For instance, it allows any attached subscription to seek to a timestamp
that is up to messageRetentionDuration in the past. If this field is not
set, message retention is controlled by settings on individual subscriptions.
Cannot be more than 31 days or less than 10 minutes.
The rotation period has the format of a decimal number, followed by the
letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
76 changes: 0 additions & 76 deletions mmv1/products/spanner/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,79 +156,3 @@ properties:
values:
- :READY
- :CREATING
- !ruby/object:Api::Type::NestedObject
name: 'autoscalingConfig'
description: |
The autoscaling configuration. Autoscaling is enabled if this field is set.
When autoscaling is enabled, num_nodes and processing_units are treated as,
OUTPUT_ONLY fields and reflect the current compute capacity allocated to
the instance.
properties:
- !ruby/object:Api::Type::NestedObject
name: 'autoscalingLimits'
description: |
Defines scale in controls to reduce the risk of response latency
and outages due to abrupt scale-in events
properties:
- !ruby/object:Api::Type::NestedObject
name: 'minLimit'
description: |
Specifies the minimum compute capacity for the instance.
properties:
- !ruby/object:Api::Type::Integer
name: 'minNodes'
exactly_one_of:
- min_nodes
- min_processing_units
description: |
Specifies minimum number of processing units allocated to the instance.
If set, this number should be greater than or equal to 1.
- !ruby/object:Api::Type::Integer
name: 'minProcessingUnits'
exactly_one_of:
- min_nodes
- min_processing_units
description: |
Specifies minimum number of processing units allocated to the instance.
If set, this number should be multiples of 1000.
- !ruby/object:Api::Type::NestedObject
name: 'maxLimit'
description: |
Specifies the maximum compute capacity for the instance.
The maximum compute capacity should be less than or equal to 10X the minimum compute capacity.
properties:
- !ruby/object:Api::Type::Integer
name: 'maxNodes'
exactly_one_of:
- max_nodes
- max_processing_units
description: |
Specifies maximum number of nodes allocated to the instance.
If set, this number should be greater than or equal to min_nodes.
- !ruby/object:Api::Type::Integer
name: 'maxProcessingUnits'
exactly_one_of:
- max_nodes
- max_processing_units
description: |
Specifies maximum number of processing units allocated to the instance.
If set, this number should be multiples of 1000 and be greater than or equal to
min_processing_units.
- !ruby/object:Api::Type::NestedObject
name: 'autoscalingTargets'
description: |
Defines scale in controls to reduce the risk of response latency
and outages due to abrupt scale-in events
properties:
- !ruby/object:Api::Type::Integer
name: 'highPriorityCpuUtilizationPercent'
description: |
Specifies the target high priority cpu utilization percentage that the autoscaler
should be trying to achieve for the instance.
This number is on a scale from 0 (no utilization) to 100 (full utilization)..
- !ruby/object:Api::Type::Integer
name: 'storageUtilizationPercent'
description: |
Specifies the target storage utilization percentage that the autoscaler
should be trying to achieve for the instance.
This number is on a scale from 0 (no utilization) to 100 (full utilization).
5 changes: 5 additions & 0 deletions mmv1/provider/terraform/virtual_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ class VirtualFields < Api::Object
# The default value for the field (defaults to false)
attr_reader :default_value

# If set to true, changes in the field's value require recreating the
# resource.
attr_reader :immutable

def validate
super
check :name, type: String, required: true
check :description, type: String, required: true
check :type, type: Class, default: Api::Type::Boolean
check :default_value, default: false
check :immutable, default: false
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ if err != nil {
}
d.SetId(id)

// Set is_default_start_flow if the resource is actually the Default Start Flow
if d.Get("name").(string) == "00000000-0000-0000-0000-000000000000" {
d.Set("is_default_start_flow", true)
}

return []*schema.ResourceData{d}, nil
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@
}
d.SetId(id)

// Set is_default_X if the resource is actually a Default Intent
if d.Get("name").(string) == "00000000-0000-0000-0000-000000000000" {
d.Set("is_default_welcome_intent", true)
}
if d.Get("name").(string) == "00000000-0000-0000-0000-000000000001" {
d.Set("is_default_negative_intent", true)
}

return []*schema.ResourceData{d}, nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
resource "google_dialogflow_cx_agent" "agent" {
display_name = "<%= ctx[:vars]["agent_name"] %>"
location = "global"
default_language_code = "en"
time_zone = "America/New_York"
}

resource "google_dialogflow_cx_intent" "default_welcome_intent" {
parent = google_dialogflow_cx_agent.agent.id
is_default_welcome_intent = true
display_name = "Default Welcome Intent"
priority = 1
training_phrases {
parts {
text = "Hello"
}
repeat_count = 1
}
}


resource "google_dialogflow_cx_flow" "<%= ctx[:primary_resource_id] %>" {
parent = google_dialogflow_cx_agent.agent.id
is_default_start_flow = true
display_name = "Default Start Flow"
description = "A start flow created along with the agent"

nlu_settings {
classification_threshold = 0.3
model_type = "MODEL_TYPE_STANDARD"
}

transition_routes {
intent = google_dialogflow_cx_intent.default_welcome_intent.id
trigger_fulfillment {
messages {
text {
text = ["Response to default welcome intent."]
}
}
}
}

event_handlers {
event = "custom-event"
trigger_fulfillment {
messages {
text {
text = ["This is a default flow."]
}
}
}
}

event_handlers {
event = "sys.no-match-default"
trigger_fulfillment {
messages {
text {
text = ["We've updated the default flow no-match response!"]
}
}
}
}

event_handlers {
event = "sys.no-input-default"
trigger_fulfillment {
messages {
text {
text = ["We've updated the default flow no-input response!"]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "google_dialogflow_cx_agent" "agent" {
display_name = "<%= ctx[:vars]["agent_name"] %>"
location = "global"
default_language_code = "en"
time_zone = "America/New_York"
}


resource "google_dialogflow_cx_intent" "<%= ctx[:primary_resource_id] %>" {
parent = google_dialogflow_cx_agent.agent.id
is_default_negative_intent = true
display_name = "Default Negative Intent"
priority = 1
is_fallback = true
training_phrases {
parts {
text = "Never match this phrase"
}
repeat_count = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_dialogflow_cx_agent" "agent" {
display_name = "<%= ctx[:vars]["agent_name"] %>"
location = "global"
default_language_code = "en"
time_zone = "America/New_York"
}


resource "google_dialogflow_cx_intent" "<%= ctx[:primary_resource_id] %>" {
parent = google_dialogflow_cx_agent.agent.id
is_default_welcome_intent = true
display_name = "Default Welcome Intent"
priority = 1
training_phrases {
parts {
text = "Hello"
}
repeat_count = 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_i
description = "tf updated description"
location = "us-central1"
service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com"
connector_version = "projects/connectors-example/locations/global/providers/zendesk/connectors/zendesk/versions/1"
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/zendesk/connectors/zendesk/versions/1"
config_variable {
key = "proxy_enabled"
boolean_value = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
data "google_project" "test_project" {
}

resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['connection_name'] %>"
location = "us-central1"
connector_version = "projects/connectors-example/locations/global/providers/gcp/connectors/pubsub/versions/1"
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/gcp/connectors/pubsub/versions/1"
description = "tf created description"
config_variable {
key = "project_id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" {
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['connection_name'] %>"
location = "us-central1"
connector_version = "projects/connectors-example/locations/global/providers/box/connectors/box/versions/1"
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1"
description = "tf created description"
config_variable {
key = "impersonate_user_mode"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" {
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['connection_name'] %>"
location = "us-central1"
connector_version = "projects/connectors-example/locations/global/providers/box/connectors/box/versions/1"
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1"
service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com"
description = "tf created description"
config_variable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "google_secret_manager_secret_iam_member" "secret_iam" {
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['connection_name'] %>"
location = "us-central1"
connector_version = "projects/connectors-example/locations/global/providers/box/connectors/box/versions/1"
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1"
service_account = "${data.google_project.test_project.number}-compute@developer.gserviceaccount.com"
description = "tf created description"
config_variable {
Expand Down
Loading

0 comments on commit 402fab4

Please sign in to comment.