Syntasa provides a utility class, synutils.secret
, for securely retrieving sensitive credentials like Google Project ID, Google Cloud credentials, AWS Access Key, and AWS Secret Key. These credentials are essential for various tasks within the Syntasa application, such as interacting with Google Cloud Platform (GCP) services or Amazon Web Services (AWS).
Here's an overview of the methods available in synutils.secret
along with code examples demonstrating their usage:
1. getGoogleProjectId()
This method retrieves the Google Project ID associated with your Syntasa application.
Python
/**
*
* @return google project id
*/
getGoogleProjectId()
Example :
projectId = getGoogleProjectId()
print(str(projectId))
Scala
/**
*
return String
*/
Example:
var projectId = synutils.secret().getGoogleProjectId()
2. getGoogleCredentials()
This method retrieves the Google Cloud credentials associated with your Syntasa application. These credentials are typically in JSON format and can be used to authenticate with various GCP services.
Python
/**
*
* @return google credentials
*/
getGoogleCrendentials()
Example :
cred = getGoogleCrendentials()
print(str(cred))
Scala
/**
*
return String
*/
Exmple:
var cred = synutils.secret().getGoogleCrendentials()
3. getAwsAccessKey()
This method retrieves the AWS Access Key ID associated with your Syntasa application.
Python
/**
*
* @return accessKey
*/
getAwsAccessKey()
Example:
accessKey = getAwsAccessKey()
print(str(accessKey))
Scala
/**
*
return String
*/
Example:
var awsacceskey = synutils.secret().getAwsAccessKey()
4. getAwsSecretKey()
This method retrieves the AWS Secret Access Key associated with your Syntasa application.
Python
/**
*
* @return secretKey
*/
getAwsSecretKey()
Example:
secretKey = getAwsSecretKey()
print(str(secretKey))
Scala
/**
*
return String
*/
Example:
var awssecretkey = synutils.secret().getAwsSecretKey()