Skip to content

Commit

Permalink
Add unique values endpoints for cloud and Kubernetes accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
kooomix committed Dec 30, 2024
1 parent 144f39c commit 4604e89
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 32 deletions.
39 changes: 36 additions & 3 deletions infrastructure/backend_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class NotExistingCustomer(Exception):
API_ACCOUNTS_CLOUD_LIST = "/api/v1/accounts/cloud/list"
API_ACCOUNTS_KUBERNETES_LIST = "/api/v1/accounts/kubernetes/list"
API_ACCOUNTS_AWS_REGIONS = "/api/v1/accounts/aws/regions"
API_ACCOUNTS_CLOUD_UNIQUEVALUES = "/api/v1/accounts/cloud/uniquevalues"
API_ACCOUNTS_KUBERNETES_UNIQUEVALUES = "/api/v1/accounts/kubernetes/uniquevalues"
API_UNIQUEVALUES_ACCOUNTS_CLOUD= "/api/v1/uniqueValues/accounts/cloud"
API_UNIQUEVALUES_ACCOUNTS_KUBERNETES = "/api/v1/uniqueValues/accounts/kubernetes"



Expand Down Expand Up @@ -3123,6 +3123,32 @@ def get_kubernetes_accounts(self, body=None, **kwargs):
return r.json()


def get_cloud_accounts_uniquevalues(self, body):
params = {"customerGUID": self.selected_tenant_id}

Logger.logger.info("get_cloud_accounts_uniquevalues body: %s" % body)

r = self.post(API_UNIQUEVALUES_ACCOUNTS_CLOUD, params=params, json=body)

if not 200 <= r.status_code < 300:
raise Exception(
'Error accessing dashboard. Request: get_cloud_accounts_uniquevalues "%s" (code: %d, message: %s)' % (
self.customer, r.status_code, r.text))
return r.json()

def get_kubernetes_accounts_uniquevalues(self, body):
params = {"customerGUID": self.selected_tenant_id}

Logger.logger.info("get_kubernetes_accounts_uniquevalues body: %s" % body)

r = self.post(API_UNIQUEVALUES_ACCOUNTS_KUBERNETES, params=params, json=body)

if not 200 <= r.status_code < 300:
raise Exception(
'Error accessing dashboard. Request: get_kubernetes_accounts_uniquevalues "%s" (code: %d, message: %s)' % (
self.customer, r.status_code, r.text))
return r.json()

def create_cloud_account(self, body, provider):
url = API_ACCOUNTS
params = {"customerGUID": self.selected_tenant_id,
Expand Down Expand Up @@ -3165,7 +3191,14 @@ def update_cloud_account(self, body, provider):
return r.json()



def get_aws_regions(self):
url = API_ACCOUNTS_AWS_REGIONS
r = self.get(url, params={"customerGUID": self.selected_tenant_id})
if not 200 <= r.status_code < 300:
raise Exception(
'Error accessing AWS regions. Customer: "%s" (code: %d, message: %s)' % (
self.customer, r.status_code, r.text))
return r.json()



Expand Down
7 changes: 4 additions & 3 deletions system_test_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -1695,11 +1695,12 @@
"Backend"
],
"target_repositories": [
"cadashboardbe",
"config-service"
"config-service-dummy",
"cadashboardbe-dummy",
"event-ingester-service-dummy"
],
"description": "Checks accounts",
"skip_on_environment": "",
"owner": ""
"owner": "[email protected]"
}
}
Loading

0 comments on commit 4604e89

Please sign in to comment.