Skip to content

Commit

Permalink
feat: added support to configure security settings, language code and…
Browse files Browse the repository at this point in the history
… time zone on conversation profile (#895)

* feat: added support to configure security settings, language code and time zone on conversation profile

PiperOrigin-RevId: 407663596

Source-Link: googleapis/googleapis@f9acb37

Source-Link: googleapis/googleapis-gen@aa54a75
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWE1NGE3NTcwNjhmMDA1YWIyMTA2NGZiMjA4YTVlYzU5N2U0OWE5YSJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 8, 2021
1 parent 6222e50 commit 50614f8
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,24 @@ message ConversationProfile {
// Settings for speech transcription.
SpeechToTextConfig stt_config = 9;

// Language which represents the conversationProfile.
// If unspecified, the default language code en-us applies. Users need to
// create a ConversationProfile for each language they want to support.
// Language code for the conversation profile. If not specified, the language
// is en-US. Language at ConversationProfile should be set for all non en-US
// languages.
// This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
// language tag. Example: "en-US".
string language_code = 10;

// The time zone of this conversational profile from the
// [time zone database](https://www.iana.org/time-zones), e.g.,
// America/New_York, Europe/Paris. Defaults to America/New_York.
string time_zone = 14;

// Name of the CX SecuritySettings reference for the agent.
// Format: `projects/<Project ID>/locations/<Location
// ID>/securitySettings/<Security Settings ID>`.
string security_settings = 13 [(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/CXSecuritySettings"
}];
}

// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
Expand Down Expand Up @@ -263,11 +277,16 @@ message AutomatedAgentConfig {
// Number>@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API
// Service Agent` role in this project.
//
// Format: `projects/<Project ID>/locations/<Location
// - For ES agents, use format: `projects/<Project ID>/locations/<Location
// ID>/agent/environments/<Environment ID or '-'>`. If environment is not
// specified, the default `draft` environment is used. Refer to
// [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest)
// for more details.
//
// - For CX agents, use format `projects/<Project ID>/locations/<Location
// ID>/agents/<Agent ID>/environments/<Environment ID
// or '-'>`. If environment is not specified, the default `draft` environment
// is used.
string agent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down Expand Up @@ -430,7 +449,7 @@ message HumanAgentAssistantConfig {
// If this field is not set, it defaults to 0.0, which means that all
// suggestions are returned.
//
// Supported features: ARTICLE_SUGGESTION.
// Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE.
float confidence_threshold = 5;

// Determines how recent conversation context is filtered when generating
Expand Down Expand Up @@ -537,13 +556,13 @@ message HumanAgentHandoffConfig {
message NotificationConfig {
// Format of cloud pub/sub message.
enum MessageFormat {
// If it is unspeified, PROTO will be used.
// If it is unspecified, PROTO will be used.
MESSAGE_FORMAT_UNSPECIFIED = 0;

// Pubsub message will be serialized proto.
// Pub/Sub message will be serialized proto.
PROTO = 1;

// Pubsub message will be json.
// Pub/Sub message will be json.
JSON = 2;
}

Expand Down
12 changes: 12 additions & 0 deletions packages/google-cloud-dialogflow/protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions packages/google-cloud-dialogflow/protos/protos.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions packages/google-cloud-dialogflow/protos/protos.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export class ConversationProfilesClient {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this.pathTemplates = {
cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}/locations/{location}/securitySettings/{security_settings}'
),
projectPathTemplate: new this._gaxModule.PathTemplate(
'projects/{project}'
),
Expand Down Expand Up @@ -1068,6 +1071,67 @@ export class ConversationProfilesClient {
// -- Path templates --
// --------------------

/**
* Return a fully-qualified cXSecuritySettings resource name string.
*
* @param {string} project
* @param {string} location
* @param {string} security_settings
* @returns {string} Resource name string.
*/
cXSecuritySettingsPath(
project: string,
location: string,
securitySettings: string
) {
return this.pathTemplates.cXSecuritySettingsPathTemplate.render({
project: project,
location: location,
security_settings: securitySettings,
});
}

/**
* Parse the project from CXSecuritySettings resource.
*
* @param {string} cXSecuritySettingsName
* A fully-qualified path representing CXSecuritySettings resource.
* @returns {string} A string representing the project.
*/
matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) {
return this.pathTemplates.cXSecuritySettingsPathTemplate.match(
cXSecuritySettingsName
).project;
}

/**
* Parse the location from CXSecuritySettings resource.
*
* @param {string} cXSecuritySettingsName
* A fully-qualified path representing CXSecuritySettings resource.
* @returns {string} A string representing the location.
*/
matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) {
return this.pathTemplates.cXSecuritySettingsPathTemplate.match(
cXSecuritySettingsName
).location;
}

/**
* Parse the security_settings from CXSecuritySettings resource.
*
* @param {string} cXSecuritySettingsName
* A fully-qualified path representing CXSecuritySettings resource.
* @returns {string} A string representing the security_settings.
*/
matchSecuritySettingsFromCXSecuritySettingsName(
cXSecuritySettingsName: string
) {
return this.pathTemplates.cXSecuritySettingsPathTemplate.match(
cXSecuritySettingsName
).security_settings;
}

/**
* Return a fully-qualified project resource name string.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,84 @@ describe('v2.ConversationProfilesClient', () => {
});

describe('Path templates', () => {
describe('cXSecuritySettings', () => {
const fakePath = '/rendered/path/cXSecuritySettings';
const expectedParameters = {
project: 'projectValue',
location: 'locationValue',
security_settings: 'securitySettingsValue',
};
const client =
new conversationprofilesModule.v2.ConversationProfilesClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
client.initialize();
client.pathTemplates.cXSecuritySettingsPathTemplate.render = sinon
.stub()
.returns(fakePath);
client.pathTemplates.cXSecuritySettingsPathTemplate.match = sinon
.stub()
.returns(expectedParameters);

it('cXSecuritySettingsPath', () => {
const result = client.cXSecuritySettingsPath(
'projectValue',
'locationValue',
'securitySettingsValue'
);
assert.strictEqual(result, fakePath);
assert(
(
client.pathTemplates.cXSecuritySettingsPathTemplate
.render as SinonStub
)
.getCall(-1)
.calledWith(expectedParameters)
);
});

it('matchProjectFromCXSecuritySettingsName', () => {
const result = client.matchProjectFromCXSecuritySettingsName(fakePath);
assert.strictEqual(result, 'projectValue');
assert(
(
client.pathTemplates.cXSecuritySettingsPathTemplate
.match as SinonStub
)
.getCall(-1)
.calledWith(fakePath)
);
});

it('matchLocationFromCXSecuritySettingsName', () => {
const result = client.matchLocationFromCXSecuritySettingsName(fakePath);
assert.strictEqual(result, 'locationValue');
assert(
(
client.pathTemplates.cXSecuritySettingsPathTemplate
.match as SinonStub
)
.getCall(-1)
.calledWith(fakePath)
);
});

it('matchSecuritySettingsFromCXSecuritySettingsName', () => {
const result =
client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath);
assert.strictEqual(result, 'securitySettingsValue');
assert(
(
client.pathTemplates.cXSecuritySettingsPathTemplate
.match as SinonStub
)
.getCall(-1)
.calledWith(fakePath)
);
});
});

describe('project', () => {
const fakePath = '/rendered/path/project';
const expectedParameters = {
Expand Down

0 comments on commit 50614f8

Please sign in to comment.