I am using the following key to create encrypted data bag. The key is loaded on the sever node in file /etc/chef/encrypted_data_bag_secret:
ERKYMi6xbv36xkrg1N4eXOuKbI6f5zogCXOGNyrs66fjRXI7wtOvK7eA5A9XJcJGdcAt0EuTQcZKtwY5mmTGn21OEOEZlcxWBekB/2NmmVSJJSoA2xlya2dm3CZ97gLES8g4z/XKfNJHP07/cDOnmpCjFWMRSE/qEld/a+YgmW2oTF4zqTHteik0ePclebh7SXSd4lf+GL1oip2aM3yXY6ZJBd6yraXm8CPWfvrswk7VmqnmMGFqR0xi7pSPCOFrmHRs1gxskrqKfbnts0Zy0UU+MNzp5rDIlKHmLL5KO014vDkukV4dIiR2CxjeldJsaqGvRvPC7VIVC2HyMJvAqW772dpi0y5wiBd5HhcjAIQrfqIvVXNLg7Zjk6Eh1xxESe2YJUF7djHAJfru6Hv5b8DsQq/z6OgLJtTkToILRNmd4sBV66CAvw3m0xC4PUhi4c+7pTBiqV1/q+dTQhx2k7G0GM9hsRosCP0Erz7H3jfyUroUPPEMWMsgqXP33fNEz3txBHDPM2L1PcObzT2FHXjHQMgsaTH+oIqlLXWmnqBAtZTIMkG49DVIjj9NrkiN5267+rlIJORAGV6CY7QX4TKuTZqcReYmLpcdMA33Tzius/ife3TOZoN8IoPb1RFLQfn3KFAwI50eOQ0KyEYDKjzwmJOkra5jcEww4GNlzd4=
I created the data bag using following command:
knife data bag create tokens masterkey --secret-file PATH_TO_SECRET
Now, within the recipe, I am using data_bag_items API to retrieve value of the data bag item as follows:
value = data_bag_item("tokens", "masterkey", "/etc/chef/encrypted_data_bag_secret")
token2_hash = lambda { token1_hash.deep_merge({ "value" => value['key'] } ) }
However, I am getting below compile time error:
ERROR: Error decrypting data bag value: 'bad decrypt'. Most likely the provided key is incorrect
Related
I need to consume and parse incoming json from a third party system in my code. I used RestTemplate to do it. So the response from the system looks like below.
{ "data": { "05AAAFW9419M11Q": { "gstin": "05AAAFW9419M11Q", "error_cd": "SWEB_9035", "message": "Invalid GSTIN / UID" } } }
Now the problem is the property name ("05AAAFW9419M11Q" in this case) in dynamic and in the next response it would be another string. In this case, how can I parse this json as this is not fixed in Oracle Integration Cloud? Response wrapper is not capturing the data apart from the one that is used for configuring the adapter which is fair enough as fieldname itself is changing.
Is there is any workaround for this?
You will have to go to PL/SQL and dynamic SQL, and if it's always the value of gstin entry, you can get the path of the key with
select '$.data.' ||
json_query(js_column, '$.data.*.gstin') into v_key path from table_with_json_column where ... conditions... ;
(assuming there is only 1 "data" per JSON payload) to later build a dynamic query based on json_table.
This is my flow file content:
{
"a":"b",
"c":"y",
"d":"z",
"e":"w",
"f":"u",
"g":"v",
"h":"o",
"x":"t"
}
The final result should look like that in Postgres :
| test |
|----------------------------------------------------------------|
|{"a":"b,"c":"y","d":"z","e":"w","f":"u","g":"v","h":"o","x":"t"}|
the table is: json_test
the column name is test
Those steps shows how i tried to solve the problem:
My method was to store the json record in a variable as string with "ExtractText":
the attribute data take only some key-values from the json not the entire record:
data = {"a":"b",
"c":"y",
"d":"z",
"e":"w",
"f":
so i have a problem in the regex expression.
next i used PutSQL with the following SQL statement:
Unfortunately the result isn't the wanted one.
I need to know the exact expression that i should set in ExtractText to get the entire json record in a variable as string.
The sql statement should be:
insert into schema.table_name(column_name) values(the_variable_where the flowfile data was stored)
I'm using service.files().list() and providing a query string to retrieve files that match the ids in a given list. Yet Calling service.files.list errors out, and GAPI returns an error code of 400. I'm using a service object created using an access token.
I get the following message:
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/drive/v3/files?pageSize=50&fields=%2A&q=id+contains+%271234%27&spaces=drive&alt=json returned "Invalid Value". Details: "Invalid Value">
Here's the code. Is it possible to query by file id in the list API? I prefer to do it this way instead of making a get request for each individual file.
# Create file query string
queryStr = ""
for i in range(len(fileIds)):
queryStr += f"id='{fileIds[i]}'"
if i != len(fileIds) - 1:
queryStr += " or "
# Build files array
results = service.files().list(
pageSize=50,
fields="*",
q=queryStr,
spaces="drive"
).execute()
print(results.get("files", [0])[0])
You appear to be trying to search on id contains
If you check the documentation File query terms
You will find that Id is not a searchable field.
Try something like name contains car for example
I have a table I created in the Hasura console. A few of the columns are integer int types and I get the expected data type: Maybe<Scalars['Int']>.
However, a few needed to be an array of integers so I created those in the Hasura SQL tab:
ALTER TABLE my_table
add my_ids integer[];
If I populate those in GraphiQL with the following query variable everything works just fine:
{
"my_ids": "{1200, 1201, 1202}",
}
However, when I try to make the same request from my front-end client, I received the following error: A string is expected for type : _int4. Looking at the datatype, it is slightly different than the preset (in the data type dropdown) integer types: Maybe<Scalars['_int4']>.
Is there a way to get the array of integers to be Maybe<Scalars['Int']> like the preset integer types? Or if there isn't, how can resolve the issue with my request throwing errors for this _int4 type?
Hasura cannot process array but it can process array literals.
I've written a function to help you to transform your array into array literal before mutation:
const toArrayLiteral = (arr) => (JSON.stringify(arr).replace('[', '{').replace(']', '}'))
...
myObject.array = toArrayLiteral(myObject.array) // will make ['friend'] to {'friend'}
Good luck
Decrypt the Particular column(i.e.Email) of a list from a list using linq.
Here is the code:
List<sp_Ticketlist_Result> _dbData;
_dbData = _repository.GetTicket(UserId).ToList();
In this _dbData a column name Email.This email is decrypted.
Here is the class to encypt the Email (AESCryptography.AES256_Decrypt).
I am try this code :
_dbData = (decrypted.ToList().Select(u => AESCryptography.AES256_Decrypt(u.Email))).ToList();
but not working.
I want to Fetch the list with the email column decrypted value.