feat(Venafi TLS Protect Cloud Node): Add region parameter to Venafi protect cloud (#7689)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Ricardo Espinoza 2023-11-11 10:35:56 -05:00 committed by GitHub
parent cbc690907f
commit a08fca51d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View file

@ -13,6 +13,22 @@ export class VenafiTlsProtectCloudApi implements ICredentialType {
documentationUrl = 'venafitlsprotectcloud'; documentationUrl = 'venafitlsprotectcloud';
properties: INodeProperties[] = [ properties: INodeProperties[] = [
{
displayName: 'Region',
name: 'region',
type: 'options',
options: [
{
name: 'US',
value: 'cloud',
},
{
name: 'EU',
value: 'eu',
},
],
default: 'cloud',
},
{ {
displayName: 'API Key', displayName: 'API Key',
name: 'apiKey', name: 'apiKey',
@ -33,7 +49,7 @@ export class VenafiTlsProtectCloudApi implements ICredentialType {
test: ICredentialTestRequest = { test: ICredentialTestRequest = {
request: { request: {
baseURL: 'https://api.venafi.cloud', baseURL: '=https://api.venafi.{{$credentials.region ?? "cloud"}}',
url: '/v1/preferences', url: '/v1/preferences',
}, },
}; };

View file

@ -23,6 +23,9 @@ export async function venafiApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const operation = this.getNodeParameter('operation', 0); const operation = this.getNodeParameter('operation', 0);
const credentials = await this.getCredentials('venafiTlsProtectCloudApi');
const region = credentials.region ?? 'cloud';
const options: OptionsWithUri = { const options: OptionsWithUri = {
headers: { headers: {
@ -32,7 +35,7 @@ export async function venafiApiRequest(
method, method,
body, body,
qs, qs,
uri: `https://api.venafi.cloud${resource}`, uri: `https://api.venafi.${region}${resource}`,
json: true, json: true,
}; };