Skip to content

Commit

Permalink
Align Credentials for GoogleCloudTranslate, Google Vision API, Google…
Browse files Browse the repository at this point in the history
… Resource Manager (demisto#27560)

* GoogleCloudTranslate complete

* GoogleVisionAPI complete

* GoogleResourceManager complete

* GoogleResourceManager complete

* Fixed GoogleVisionAPI.py
  • Loading branch information
jlevypaloalto authored and xsoar-bot committed Jul 26, 2023
1 parent b8886ca commit 13e2166
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 85 deletions.
6 changes: 2 additions & 4 deletions Packs/GoogleCloudTranslate/.pack-ignore
@@ -1,5 +1,3 @@
[file:GoogleCloudTranslate.yml]
ignore=IN145

[file:GoogleCloudTranslate_image.png]
ignore=IM111
ignore=IM111

Expand Up @@ -188,7 +188,7 @@ def translate_text(client, args):
result['detected_language_code']
)

id_ = hashlib.md5(f'{target}-{source}-{text}'.encode('utf-8')).hexdigest() # nosec
id_ = hashlib.md5(f'{target}-{source}-{text}'.encode()).hexdigest() # nosec

outputs = {
'GoogleCloudTranslate.TranslateText(val.ID && val.ID==obj.ID)': {
Expand All @@ -212,13 +212,14 @@ def main():
"""
PARSE AND VALIDATE INTEGRATION PARAMS
"""
service_account_json = demisto.params().get('service_account_json')
service_account_json = demisto.params().get('project_creds', {}).get('password')\
or demisto.params().get('service_account_json')
try:
service_account = json.loads(service_account_json)
except Exception:
return_error('Invalid JSON provided')

project = demisto.params().get('project', None)
project = demisto.params().get('project_creds', {}).get('identifier') or demisto.params().get('project', None)

verify_certificate = not demisto.params().get('insecure', False)

Expand Down
Expand Up @@ -5,12 +5,19 @@ commonfields:
configuration:
- display: Service Account Private Key file contents (JSON)
name: service_account_json
required: true
required: false
type: 4
hidden: true
- display: Project in Google Cloud Translate
name: project_creds
required: false
type: 9
displaypassword: Service Account Private Key file contents (JSON)
- display: Project in Google Cloud Translate
name: project
required: false
type: 0
hidden: true
- display: Use system proxy settings
name: proxy
required: false
Expand All @@ -19,6 +26,7 @@ configuration:
name: insecure
required: false
type: 8

description: A Google API cloud based translation service.
display: Google Cloud Translate
name: GoogleCloudTranslate
Expand Down Expand Up @@ -72,7 +80,7 @@ script:
- contextPath: GoogleCloudTranslate.TranslateText.translated_text
description: The translated text.
type: String
dockerimage: demisto/google-cloud-translate:1.0.0.45872
dockerimage: demisto/google-cloud-translate:1.0.0.63615
isfetch: false
runonce: false
script: '-'
Expand Down
9 changes: 9 additions & 0 deletions Packs/GoogleCloudTranslate/ReleaseNotes/1_0_8.md
@@ -0,0 +1,9 @@

#### Integrations

##### Google Cloud Translate

- You can now use credentials when configuring the following fields:
- *Project in Google Cloud Translate*
- *Service Account Private Key file contents (JSON)*
- Updated the Docker image to: *demisto/google-cloud-translate:1.0.0.63615*.
2 changes: 1 addition & 1 deletion Packs/GoogleCloudTranslate/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Google Cloud Translate",
"description": "A Google API cloud based translation service.",
"support": "xsoar",
"currentVersion": "1.0.7",
"currentVersion": "1.0.8",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
2 changes: 1 addition & 1 deletion Packs/GoogleResourceManager/.pack-ignore
@@ -1,5 +1,5 @@
[file:GoogleResourceManager.yml]
ignore=IN145,BA124
ignore=BA124

[file:GoogleResourceManager_image.png]
ignore=IM111
Expand Down
Expand Up @@ -18,10 +18,10 @@
# Params for assembling object of the Service Account Credentials File Contents
PARAMS = demisto.params()
SERVICE_ACT_PROJECT_ID = PARAMS.get('project_id')
PRIVATE_KEY_ID = PARAMS.get('private_key_id')
PRIVATE_KEY = PARAMS.get('private_key')
CLIENT_EMAIL = PARAMS.get('client_email')
CLIENT_ID = PARAMS.get('client_id')
PRIVATE_KEY_ID = PARAMS.get('private_key_id_creds', {}).get('password') or PARAMS.get('private_key_id')
PRIVATE_KEY = PARAMS.get('private_key_creds', {}).get('password') or PARAMS.get('private_key')
CLIENT_EMAIL = PARAMS.get('client_email_creds', {}).get('identifier') or PARAMS.get('client_email')
CLIENT_ID = PARAMS.get('client_email_creds', {}).get('password') or PARAMS.get('client_id')
CLIENT_X509_CERT_URL = PARAMS.get('client_x509_cert_url')
PROXY = PARAMS.get('proxy')
DISABLE_SSL = PARAMS.get('insecure')
Expand Down
Expand Up @@ -9,23 +9,42 @@ configuration:
type: 0
- display: Private Key ID
name: private_key_id
required: true
required: false
type: 4
hidden: true
- name: private_key_id_creds
required: false
type: 9
displaypassword: Private Key ID
hiddenusername: true
- defaultvalue: ''
display: Private Key
name: private_key
required: true
required: false
type: 4
hidden: true
- name: private_key_creds
required: false
type: 9
displaypassword: Private Key
hiddenusername: true
- defaultvalue: ''
display: Client Email
name: client_email
required: true
required: false
type: 0
- defaultvalue: ''
display: Client ID
hidden: true
- display: Client ID
name: client_id
required: true
required: false
type: 4
defaultvalue: ''
hidden: true
- display: Client Email
name: client_email_creds
required: false
type: 9
displaypassword: Client ID
- defaultvalue: ''
display: Client X509 Cert URL
name: client_x509_cert_url
Expand All @@ -39,6 +58,7 @@ configuration:
name: insecure
required: false
type: 8

description: Google Cloud Platform Resource Manager
display: Google Resource Manager
name: Google Resource Manager
Expand All @@ -56,10 +76,7 @@ script:
required: true
- default: false
defaultValue: ''
description: The ID of the parent resource. Organizations' Name output is in
the format "organizations/12345" where the numbers after the forward slash
are the ID of the organization. To find Organization IDs available to assign
as a parent resource try running the grm-search-organization command.
description: The ID of the parent resource. Organizations' Name output is in the format "organizations/12345" where the numbers after the forward slash are the ID of the organization. To find Organization IDs available to assign as a parent resource try running the grm-search-organization command.
isArray: false
name: parent_id
predefined: []
Expand All @@ -85,8 +102,7 @@ script:
required: false
- default: false
defaultValue: ''
description: 'Represents the resource type the parent_id is for. Valid resource
types: "organization" and "folder".'
description: 'Represents the resource type the parent_id is for. Valid resource types: "organization" and "folder".'
isArray: false
name: parent_type
predefined: [organization, folder]
Expand All @@ -101,17 +117,15 @@ script:
name: label_values
predefined: []
required: false
description: Request that new Project resource be created with the user-specified
values passed as command arguments.
description: Request that new Project resource be created with the user-specified values passed as command arguments.
execution: false
name: grm-create-project
outputs:
- contextPath: GRM.Project.Name
description: The user-assigned display name of the Project.
type: String
- contextPath: GRM.Project.ID
description: 'The unique, user-assigned ID of
the Project.'
description: 'The unique, user-assigned ID of the Project.'
type: String
- contextPath: GRM.Project.Number
description: The number uniquely identifying the project.
Expand Down Expand Up @@ -187,33 +201,27 @@ script:
name: filter
predefined: []
required: false
description: Lists projects that are visible to the user and satisfies the specified
filter. Projects are returned in an unspecified order.
description: Lists projects that are visible to the user and satisfies the specified filter. Projects are returned in an unspecified order.
execution: false
name: grm-list-projects
outputs:
- contextPath: GRM.Project.Name
description: The user-assigned display name
of the Project.
description: The user-assigned display name of the Project.
type: String
- contextPath: GRM.Project.ID
description: 'The unique, user-assigned ID of
the Project.'
description: 'The unique, user-assigned ID of the Project.'
type: String
- contextPath: GRM.Project.Number
description: The number uniquely identifying
the project.
description: The number uniquely identifying the project.
type: String
- contextPath: GRM.Project.State
description: The Project lifecycle state.
type: String
- contextPath: GRM.Project.CreateTime
description: The time the resource was
created
description: The time the resource was created
type: Date
- contextPath: GRM.Project.Label
description: The labels associated with this
Project.
description: The labels associated with this Project.
type: Unknown
- contextPath: GRM.Project.Parent.ID
description: ID of the parent resource.
Expand Down Expand Up @@ -242,18 +250,14 @@ script:
required: false
- default: false
defaultValue: ''
description: The ID of the parent resource. Organizations' Name output is in
the format `organizations/12345` where the numbers after the forward slash
are the ID of the organization. To find Organization IDs available to assign
as a parent resource try running the grm-search-organization command.
description: The ID of the parent resource. Organizations' Name output is in the format `organizations/12345` where the numbers after the forward slash are the ID of the organization. To find Organization IDs available to assign as a parent resource try running the grm-search-organization command.
isArray: false
name: parent_id
predefined: []
required: true
- default: false
defaultValue: ''
description: 'The resource type the parent_id is for. Valid resource types:
"organization" and "folder".'
description: 'The resource type the parent_id is for. Valid resource types: "organization" and "folder".'
isArray: false
name: parent_type
predefined: [organization, folder]
Expand All @@ -278,15 +282,12 @@ script:
name: label_values
predefined: []
required: false
description: Updates the attributes of the Project identified by the specified
project_id. Currently the only fields that can be updated are the project name
and labels.
description: Updates the attributes of the Project identified by the specified project_id. Currently the only fields that can be updated are the project name and labels.
execution: false
name: grm-update-project
outputs:
- contextPath: GRM.Project.Name
description: The user-assigned display name
of the Project.
description: The user-assigned display name of the Project.
type: String
- contextPath: GRM.Project.ID
description: The unique, user-assigned ID of the Project.
Expand Down Expand Up @@ -321,34 +322,24 @@ script:
required: false
- default: false
defaultValue: ''
description: A pagination token returned from a previous call to "organizations.search"
that indicates from where listing should continue.
description: A pagination token returned from a previous call to "organizations.search" that indicates from where listing should continue.
isArray: false
name: page_token
predefined: []
required: false
- default: false
defaultValue: ''
description: "An expression for filtering the Organizations returned in the\
\ results. Filter rules are case-insensitive.\n\nOrganizations may be filtered\
\ by 'owner.directoryCustomerId' or by 'domain', where the domain is a G Suite\
\ domain, for example:\n\nowner.directorycustomerid:123456789\tOrganizations\
\ with owner.directory_customer_id equal to 123456789.\ndomain:google.com\t\
Organizations corresponding to the domain google.com."
description: "An expression for filtering the Organizations returned in the results. Filter rules are case-insensitive.\n\nOrganizations may be filtered by 'owner.directoryCustomerId' or by 'domain', where the domain is a G Suite domain, for example:\n\nowner.directorycustomerid:123456789\tOrganizations with owner.directory_customer_id equal to 123456789.\ndomain:google.com\tOrganizations corresponding to the domain google.com."
isArray: false
name: filter
predefined: []
required: false
description: Searches Organization resources that are visible to the user and
satisfies the specified filter. Organizations are returned in an unspecified
order. New Organizations do not necessarily appear at the end of the results.
description: Searches Organization resources that are visible to the user and satisfies the specified filter. Organizations are returned in an unspecified order. New Organizations do not necessarily appear at the end of the results.
execution: false
name: grm-search-organizations
outputs:
- contextPath: GRM.Organization.Name
description: 'The resource name of the
organization. This is the organization''s relative path in the API. Its format
is "organizations/[organization_id]" e.g. "organizations/1234".'
description: 'The resource name of the organization. This is the organization''s relative path in the API. Its format is "organizations/[organization_id]" e.g. "organizations/1234".'
type: String
- contextPath: GRM.Organization.State
description: The organization's current lifecycle state.
Expand All @@ -367,15 +358,12 @@ script:
name: name
predefined: []
required: true
description: Fetches an Organization resource identified by the specified resource
name.
description: Fetches an Organization resource identified by the specified resource name.
execution: false
name: grm-get-organization
outputs:
- contextPath: GRM.Organization.Name
description: 'The resource name of the
organization. This is the organization''s relative path in the API. Its format
is "organizations/[organization_id]" e.g. "organizations/1234".'
description: 'The resource name of the organization. This is the organization''s relative path in the API. Its format is "organizations/[organization_id]" e.g. "organizations/1234".'
type: String
- contextPath: GRM.Organization.State
description: The organization's current lifecycle state.
Expand All @@ -396,8 +384,7 @@ script:
name: project_id
predefined: []
required: true
description: Marks the Project identified by the specified project_id to be deleted,
e.g., my-project-123.
description: Marks the Project identified by the specified project_id to be deleted, e.g., my-project-123.
execution: true
name: grm-delete-project
outputs:
Expand Down Expand Up @@ -435,8 +422,7 @@ script:
name: project_id
predefined: []
required: true
description: Restores the Project identified by the specified project_id, e.g.,
my-project-123.
description: Restores the Project identified by the specified project_id, e.g., my-project-123.
execution: false
name: grm-undelete-project
outputs:
Expand Down Expand Up @@ -464,12 +450,12 @@ script:
- contextPath: GRM.Project.Parent.Type
description: Type of the parent resource.
type: String
dockerimage: demisto/googleapi-python3:1.0.0.36486
dockerimage: demisto/googleapi-python3:1.0.0.63869
isfetch: false
runonce: false
script: ''
type: python
subtype: python3
fromversion: 5.0.0
tests:
- GoogleResourceManager-Test
- GoogleResourceManager-Test
11 changes: 11 additions & 0 deletions Packs/GoogleResourceManager/ReleaseNotes/1_0_4.md
@@ -0,0 +1,11 @@

#### Integrations

##### Google Resource Manager

- You can now use credentials when configuring the following fields:
- *Private Key ID*
- *Private Key*
- *Client Email*
- *Client ID*
- Updated the Docker image to: *demisto/googleapi-python3:1.0.0.63869*.

0 comments on commit 13e2166

Please sign in to comment.