Getting DirectoryIds via boto3 client - aws-directory-services

Trying to list the SimpleAD in my vpc but keep getting this error I am so fresh to this here is the code I'm trying to run.
import boto3
client = boto3.client ('ds')
response = client.describe_directories(
DirectoryIds=[
'string',
],
NextToken='string',
Limit=123
)
print (response)
Here is the error:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the DescribeDirectories operation: 1 validation error detected: Value '[string]' at 'directoryIds' failed to satisfy constraint: Member must satisfy constraint: [Member must satisfy regular expression pattern: ^d-[0-9a-f]{10}$]
I'm just starting my adventure with python and aws so all help is really appreciated.

In your code where you have the word 'string' you should put the directory id which will be in the form "d-" followed by 10 alphanumerics. You can find this directory id in the AWS console where you've configured your workspaces' directories.

Related

Azure Function does not resolve variable

I ve been trying to get an OAuth 2.0 token from Google Analytics via a function app in Azure.
I am following this tutorial:
https://richardswinbank.net/adf/access_google_analytics_with_azure_data_factory#get_an_oauth_token_in_adf
There is a part were an URL is extracted from a variable:
var kvClient = new SecretClient(new Uri(Environment.GetEnvironmentVariable("KEY_VAULT_URL")), new ManagedIdentityCredential());
string keyJson = kvClient.GetSecret("KEY_VAULT_URL").Value.Value;
In Azure portal, under my function app -> Settings -> Configuration -> Application settings is the definition for KEY_VAULT_URL.
But the variable does not seem to resolve, because I get this error:
2021-10-14T14:02:24.371 [Error] Executed 'GetOAuthToken' (Failed, Id=bad02220-c792-4c53-af41-621c6a9d12345, Duration=32ms)The request URI contains an invalid name: KEY_VAULT_URLStatus: 400 (Bad Request)ErrorCode: BadParameterContent:{"error":{"code":"BadParameter","message":"The request URI contains an invalid name: KEY_VAULT_URL"}}Headers:Cache-Control: no-cachePragma: no-cachex-ms-keyvault-region: germanywestcentralx-ms-client-request-id: 0344c4b6-98d9-4ade-9c7f-cb058abd123x-ms-request-id: d35bd092-faf4-4567-99e4-4aba0123d7bx-ms-keyvault-service-version: 1.9.132.3x-ms-keyvault-network-info: conn_type=Ipv4;addr=51.216.128.119;act_addr_fam=InterNetwork;X-Powered-By: REDACTEDStrict-Transport-Security: REDACTEDX-Content-Type-Options: REDACTEDDate: Thu, 14 Oct 2021 14:02:23 GMTContent-Length: 101Content-Type: application/json; charset=utf-8Expires: -1
The value of the variable looks like this:
https://mykeyvault.vault.azure.net/
Maybe there is a mistake? I removed the trailing slash, but the output is always the same.
This line is wrong in the tutorial. It should not be a variable. It has to be the name of the secret.
kvClient.GetSecret("KEY_VAULT_URL")

Terraform crash error while running terraform import on IBM cloud

I am trying to import ibm-cos-bucket and cos-instance from IBM cloud. I am able to import cos-instance however, getting error while importing ibm-cos-bucket.
Error: rpc error: code = Unavailable desc = transport is closing
*[ERROR] : eval: *terraform.EvalRefresh, err: rpc error: code = Unavailable desc = transport is closing
[ERROR] : eval: terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
[WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
[DEBUG] plugin: plugin exited
panic: runtime error: index out of range [1] with length 1
Terraform crashed!!!
here is sample resource block:-
resource "ibm_cos_bucket" "mybucket" {}
Please help me in this regards.
Thanks in advance!
Are you using CRN or ID for import?
According to doc's ID must be used.
id = $CRN:meta:$buckettype:$bucketlocation
ID can be easily find by using data. Here is an example.
data "ibm_cos_bucket" "my-bucket" {
bucket_name = "my-bucket"
resource_instance_id = data.ibm_resource_instance.my-resource.id
bucket_region = "us-south"
bucket_type = "region_location"
}
output "bucket-info" {
value = data.ibm_cos_bucket.my-bucket.id
}
This seems to be a fault/bug of IBM provider. Simillar issue for aws is here.
Thus, you can report the problem by making the issue on IBM provider's github:
https://github.com/IBM-Cloud/terraform-provider-ibm/issues

Error occurred while passing your function triggers. Reference Error: Client Id is not defined

I get a reference error to my client id.
code :
const app = dialogflow( {
clientId : XXXXXXXXXXX-XXXXXXXXXXXX1.apps.googleusercontent.com,
debug : true,
});
error
Try adding quotes around your client ID. The error tells you that a variable is not defined, so most likely it is trying to look for a variable with the same name as your client id because you haven't defined it as a string.
clientId : "XXXXXXXXXXX-XXXXXXXXXXXX1.apps.googleusercontent.com",

Python Azure function used in Data Factory returns: "Response Content is not a valid JObject"

I have created a very basic HTTP Trigger in Python that I can validate and test with success. However when I plug it in Data Factory and no matter what I do I get the message:
Response Content is not a valid JObject
From the Azure Python function I tried returning:
return func.HttpResponse(json.dumps(f"Hello Test!"), mimetype='application/json')
and also:
return json.dumps(f"Hello Test!")
But in both cases I always get the not valid JObject error message. Any ideas what is going on?
Did you write it with a mistake of "f"
return json.dumps(f"Hello Test!")
And could you please try to modify your code to
a = {'name': 'wang'}
json.dumps(a)

RabbitMQ, EasyNetQ With NodeJS?

I'm trying to understand what's reasonable for integrating these technologies. How would I go about integrating NodeJS (currently using amqplib, but that could be changed) across RabbitMQ to EasyNetQ?
I have it sort of working, except EasyNetQ is expecting an object (I think) and Node/amqplib can only send strings.
C# code:
Bus.Subscribe<BusManifestHolla>(HollaID,
msg => {
Console.WriteLine("Received Manifest Holla ID {0}", msg.ManifestID.ToString());
Console.WriteLine("Responding with Manifest Yo ID {0}", YoID_1);
Bus.Publish(new BusManifestYo { ManifestID = msg.ManifestID, ServiceName = YoID_1 });
}
);
NodeJS code:
var b = new Buffer(JSON.stringify(new dto.BusManifestHolla(uuid.v4())));
ch.publish(Play.exchangeName, '#', b);
The result:
DEBUG: HandleBasicDeliver on consumer: a60b7760-e22f-4685-9f65-039bef19f58c, deliveryTag: 1
DEBUG: Recieved
RoutingKey: '#'
CorrelationId: ''
ConsumerTag: 'a60b7760-e22f-4685-9f65-039bef19f58c'
DeliveryTag: 1
Redelivered: False
ERROR: Exception thrown by subscription callback.
Exchange: 'RabbitMon.BusManifestHolla:RabbitMon'
Routing Key: '#'
Redelivered: 'False'
Message:
{"Guid":"a6cf174d-9b77-4558-bbda-efe9d8451dff"}
BasicProperties:
ContentType=NULL, ContentEncoding=NULL, Headers=[], DeliveryMode=0, Priority=0, CorrelationId=NULL, ReplyTo=NULL, Expiration=NULL, MessageId=NULL, Timestamp=0, Type=NULL, UserId=NULL, AppId=NULL, ClusterId=
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at EasyNetQ.TypeNameSerializer.DeSerialize(String typeName)
at EasyNetQ.RabbitAdvancedBus.<>c__DisplayClass16.<Consume>b__15(Byte[] body, MessageProperties properties, MessageReceivedInfo messageRecievedInfo)
at EasyNetQ.Consumer.HandlerRunner.InvokeUserMessageHandler(ConsumerExecutionContext context)
Is there not a way to send an object across the bus? How do you integrate these two?
It's failing on the TypeNameSerializer.DeSerialize call. In your node code you'll need to populate BasicProperties.Type with the type that EasyNetQ should expect at the other end. This needs to be a fully qualified name including the assembly name. Just look at the name that EasyNetQ has given to your BusManifestHolla queue minus the HollaID value (and underscore).
Admittedly that error message isn't very helpful. It probably could be improved.

Resources