CloudObjects / Directory / Account Gateways / AccountClusterFinder
Sign in

AccountClusterFinder

a phpmae:Class in Account Gateways
Public PHP Methods
  • getForAAUID($aauid)

    No documentation available.

Source Code
<?php

/**
 * Implementation for coid://accountgateways.cloudobjects.io/AccountClusterFinder
 */
class AccountClusterFinder {

    private $awsClient;

    public function __construct(AWSClientProvider $awsClientProvider) {
        $this->awsClient = $awsClientProvider->getClient();
    }
    
    public function getForAAUID($aauid) {
        $dynamoDbApiResponse = json_decode($this->awsClient->post('https://dynamodb.eu-central-1.amazonaws.com/', [
            'headers' => [
                'X-Amz-Target' => 'DynamoDB_20120810.GetItem'
            ],
            'json' => [
                'TableName' => 'AccountGateway-AAUIDs',
                'Key' => [
                    'AAUID' => [ 'S' => $aauid ]
                ]
            ]
        ])->getBody(), true);

        if (isset($dynamoDbApiResponse['Item']) && isset($dynamoDbApiResponse['Item']['ClusterID']))
            return [
                'found' => true,
                'cluster' => $dynamoDbApiResponse['Item']['ClusterID']['S']
            ];
        else
            return [
                'found' => false
            ];
    }

}
Meta
URI / COID
coid://accountgateways.cloudobjects.io/AccountClusterFinder content_copy
Revision
6-d1ac823c49bc95e840111ba27a9e6b68 content_copy
Short ID
agws:AccountClusterFinder content_copy
Reference URL
https://coid.link/accountgateways.cloudobjects.io/AccountClusterFinder content_copy
Last updated
2021-04-22 11:27 (UTC)
Created at
2021-04-01 11:35 (UTC)