AWS ConfigService- how to append account IDs - json

I am trying to append the list of account Ids since I don't have access to organization, but whenever i am doing it, previous accounts get replaced with new account ID and i only want to append them.
Please let me know how to do it.
aws configservice put-configuration-aggregator --configuration-aggregator-name test-config --account-aggregation-sources "[{\"AccountIds\": [\"xxxxxx\",\"xxxx\"],\"AwsRegions\": [\"us-east-1\"]}]"

From the documentation
accountIds that are passed will be replaced with existing accounts. If you want to add additional accounts into the aggregator, call DescribeAggregator to get the previous accounts and then append new ones.
References :
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configservice/put-configuration-aggregator.html
So you can first call DescribeAggregator1 to get the previous accounts and store them in some variable.
Then append new accounts to previous accounts variable via jq.
Append JSON Object via jq
Note - I have added links for AWS CLI V2.

Related

Azure Data Factory - Passing lookup value/id into ForEach copy task not working

I'm attempting to pass the ID from one storage routine into another copy task, which requires a for each to recursively process each ID. I've setup the Lookup ID task, which is working. It's passing these objects into my for each, in which the settings are "sequential" with items set to the following: #activity('LookupUID').output.value
foreach
In my for each, I have 1 activity to copy data from another API call to an Azure SQL Database. I have a linked service, with a parameter that is being passed. I'm attempting to use a dynamic content operator to pass the current item from the for each into this parameter, which then gets sent to the API call for the ID parameter. When I manually plug in a value here, it works fine. However, trying to pass the value from the for each into this copy task parameter doesn't produce a data row when running the task.
copy task
output
You must mention the column name along with the current item in copy activity like #item().ID
Example:
I have a lookup activity to get the IDs from a source. Below is the output of the Lookup activity with a list of IDs.
Lookup Output:
I am looping these IDs in the ForEach activity and passing the current item to a variable.
ForEach activity setting: Items- #activity('Lookup1').output.value
I have a string variable in which I am passing the current item as below using Set Variable activity.
#string(item().ID)
Output:
Use this code and replace with your column name
#activity('lookup1').output.firstrow.columnname

How to include SR related work log long description when using maximo oslc rest api?

I am doing an HTTP GET request to /maximo/oslc/os/mxsr and using the oslc.select query string parameter to choose:
*,doclinks{*},worklog{*},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
This lets me get related data, including related worklogs, but the worklog does not include the 'description_longdescription' field.
The only way I seem to be able to get that field is if I do a separate HTTP GET to query a worklog id directly through /maxrest/rest/mbo/worklog . Then it provides the description_longdescription field.
I understand this field is stored separately through the linked longdescription table, but I was hoping to get the data through the "next gen" oslc api with one http get request.
I've tried putting in 'worklog{*,description_longdescription}', as I read somewhere that longdescription is a "non-persistent" field and must be explicitly named for inclusion, but it had no effect.
I figured out that for the /maximo/oslc/os/mxsr object in the API, I needed to reference the related MODIFYWORKLOG object through the rel.modifyworklog syntax in the oslc.select query string:
oslc.select=*,doclinks{*},rel.modifyworklog{*,description_longdescription},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
I also had to explicitly name the non-persistent field description_longdescription for it to be included.
Ref. for the "rel." syntax: https://developer.ibm.com/static/site-id/155/maximodev/restguide/Maximo_Nextgen_REST_API.html#_querying_maximo_asset_management_by_using_the_rest_api

Azure Pipeline - Importing Taskgroup via json always creates a new one instead of changing the existing

I have created a Task Group in Azure Pipeline via the GUI.
Then, I exported the JSON.
Next, I have changed the inputs in the json.
Afterward, I wanted to import this new json to change the existing TaskGroup.
Result:
It didn't update the existing TaskGroup, instead, it created a new task group called the same but as postfix " - Copy".
Analyzed:
When I downloaded the new imported Task Group I have seen that the value of Id has changed.
Anyway, I could not found a way to update the existing TaskGroup, what do I have to change in my Json in order to alter and not to create a new one?
Thanks!
Try using the Taskgroups Update API.

Get the IP address related to a RecentChange entry

I have an extension that needs to access the IP addresses associated with a recent change entry.
From the revision ID, I can access the Revision object and in turn the associated RecentChange but neither have any obvious methods to get the originating IP. It can only get the IP if it was an anonymous edit.
I have set $wgPutIPinRC so the IPs will be in the recentchanges table.
How can I get the IP address for the change?
It is not directly exposed as a property, but it is stored in the class as an attribute.
These can be read using the RecentChange::getAttribute() method passing the field name of rc_ip:
$ip_address = $this->recentchange->getAttribute( 'rc_ip' );
This still requires $wgPutIPinRC to be set for the data to be recorded in the first place.

Anyway to get dkims records for verifying ses domain in boto?

Tinkering around with verifying a couple of domains and found the manual process rather tedius. My DNS controller offers API access so I figured why not script the whole thing.
Trick is I can't figure out how to access the required TXT & CNAME records for DKIMS verification from boto, when I punch in
dkims = conn.verify_domain_dkim('DOMAIN.COM')
it adds DOMAIN.COM to the list of domains pending verification but doesn't provide the needed records, the returned value of dkims is
{'VerifyDomainDkimResponse': {
'ResponseMetadata': {'RequestId': 'REQUEST_ID_STRING'},
'VerifyDomainDkimResult': {'DkimTokens': {
'member': 'DKIMS_TOKEN_STRING'}}}}
Is there some undocumented way to take the REQUEST_ID or TOKEN_STRING to pull up these records?
UPDATE
If you have an aws account you can see the records I'm after at
https://console.aws.amazon.com/ses/home?region=us-west-2#verified-senders:domain
tab: Details:: Record Type: TXT (Text)
tab: DKIM:: DNS Record 1, 2, 3
these are the records required to add to the DNS controller to validate & allow DKIM signatures to take place
This is how I do it with python.
DOMINIO = 'mydomain.com'
from boto3 import Session
session = Session(
aws_access_key_id=MY_AWS_ACCESS_KEY_ID,
aws_secret_access_key=MY_AWS_SECRET_ACCESS_KEY,
region_name=MY_AWS_REGION_NAME)
client = session.client('ses')
# gets VerificationToken for the domain, that will be used to add a TXT record to the DNS
result = client.verify_domain_identity(Domain=DOMINIO)
txt = result.get('VerificationToken')
# gets DKIM tokens that will be used to add 3 CNAME records
result = client.verify_domain_dkim(Domain=DOMINIO)
dkim_tokens = result.get('DkimTokens') # this is a list
At the end of the code, you will have "txt" and "dkim_tokens" variables, a string and a list respectively.
You will need to add a TXT record to your dns, where the host name is "_amazonses" and the value is the value of "txt" variable.
Also you will need to add 3 CNAME records to your dns, one for each token present in "dkim_tokens" list, where the host name of each record is of the form of [dkimtoken]._domainkey and the target is [dkimtoken].dkim.amazonses.com
After adding the dns records, after some minutes (maybe a couple of hours), Amazon will detect and verify the domain, and will send you an email notification. After that, you can enable Dkim signature by doing this call:
client.set_identity_dkim_enabled(Identity=DOMINIO, DkimEnabled=True)
The methods used here are verify_domain_identity, verify_domain_dkim and set_identity_dkim_enabled.
You may also want to take a look a get_identity_verification_attributes and get_identity_dkim_attributes.
I think the get_identity_dkim_attributes method will return the information you are looking for. You pass in the domain name(s) you are interested in and it returns the status for that identity as well as the DKIM tokens.