Skip to content

Commit

Permalink
feat: update managed provider version
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Apr 5, 2024
1 parent 2e80abe commit 289f35c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 38 deletions.
5 changes: 4 additions & 1 deletion src/spaceone/identity/managed_resource/provider/aws.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
provider: aws
name: AWS
version: '1.0'
plugin_info:
plugin_id: 'plugin-aws-identity-account-collector'
version: '1.1'
color: '#FF9900'
icon: 'https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/aws.svg'
order: 1
options:
support_trusted_account: true
support_auto_sync: true
4 changes: 2 additions & 2 deletions src/spaceone/identity/manager/schema_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _create_managed_schema(self, domain_id: str) -> bool:
return True

def validate_data_by_schema(
self, provider: str, domain_id: str, schema_type: str, data: dict
self, provider: str, domain_id: str, schema_type: str, data: dict
) -> None:
schema_vos = self.filter_schemas(
provider=provider, domain_id=domain_id, schema_type=schema_type
Expand All @@ -107,7 +107,7 @@ def validate_data_by_schema(
)

def validate_secret_data_by_schema_id(
self, schema_id: str, domain_id: str, data: dict, schema_type: str
self, schema_id: str, domain_id: str, data: dict, schema_type: str
) -> None:
schema_vos = self.filter_schemas(
schema_id=schema_id,
Expand Down
71 changes: 36 additions & 35 deletions src/spaceone/identity/service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_jobs_by_trusted_account(self, params):

# todo check provider sync condition
for trusted_account_vo in self._get_all_schedule_enabled_trusted_accounts(
current_hour
current_hour
):
try:
self.created_service_account_job(trusted_account_vo, {})
Expand Down Expand Up @@ -324,7 +324,7 @@ def sync_service_accounts(self, params: dict) -> None:
)

def created_service_account_job(
self, trusted_account_vo: TrustedAccount, job_options: dict
self, trusted_account_vo: TrustedAccount, job_options: dict
) -> Union[Job, dict]:
resource_group = trusted_account_vo.resource_group
provider = trusted_account_vo.provider
Expand Down Expand Up @@ -423,10 +423,10 @@ def _get_trusted_secret_data(self, trusted_secret_id: str, domain_id: str) -> di
return secret_data

def _check_duplicate_job(
self,
domain_id: str,
trusted_account_id: str,
this_job_vo: Job,
self,
domain_id: str,
trusted_account_id: str,
this_job_vo: Job,
) -> bool:
query = {
"filter": [
Expand All @@ -450,7 +450,7 @@ def _check_duplicate_job(
return False

def _is_job_failed(
self, job_id: str, domain_id: str, workspace_id: str = None
self, job_id: str, domain_id: str, workspace_id: str = None
) -> bool:
job_vo: Job = self.job_mgr.get_job(domain_id, job_id, workspace_id)

Expand All @@ -460,10 +460,10 @@ def _is_job_failed(
return False

def _close_job(
self,
job_id: str,
domain_id: str,
workspace_id: str = None,
self,
job_id: str,
domain_id: str,
workspace_id: str = None,
):
job_vo: Job = self.job_mgr.get_job(domain_id, job_id, workspace_id)
if job_vo.status == "IN_PROGRESS":
Expand Down Expand Up @@ -495,12 +495,12 @@ def _create_workspace(self, domain_id: str, location_info: dict) -> Workspace:
return workspace_vo

def _create_project_group(
self,
domain_id: str,
workspace_id: str,
trusted_account_id: str,
location_info: dict,
parent_group_id: str = None,
self,
domain_id: str,
workspace_id: str,
trusted_account_id: str,
location_info: dict,
parent_group_id: str = None,
) -> ProjectGroup:
name = location_info["name"]
reference_id = location_info["resource_id"]
Expand Down Expand Up @@ -552,14 +552,14 @@ def _create_project_group(
return project_group_vo

def _create_project(
self,
result: dict,
domain_id: str,
workspace_id: str,
trusted_account_id: str,
project_group_id: str = None,
sync_options: dict = None,
project_type: str = "PRIVATE",
self,
result: dict,
domain_id: str,
workspace_id: str,
trusted_account_id: str,
project_group_id: str = None,
sync_options: dict = None,
project_type: str = "PRIVATE",
) -> Project:
name = result["name"]
reference_id = result["resource_id"]
Expand Down Expand Up @@ -595,13 +595,13 @@ def _create_project(
return project_vo

def _create_service_account(
self,
result: dict,
project_vo: Project,
trusted_account_id: str,
trusted_secret_id: str,
provider: str,
sync_options: dict = None,
self,
result: dict,
project_vo: Project,
trusted_account_id: str,
trusted_secret_id: str,
provider: str,
sync_options: dict = None,
) -> Union[ServiceAccount, None]:
domain_id = project_vo.domain_id
workspace_id = project_vo.workspace_id
Expand Down Expand Up @@ -692,8 +692,9 @@ def _get_location(result: dict, resource_group: str, sync_options: dict) -> list
if not sync_options.get("skip_project_group", False):
location = result.get("location", [])
if resource_group == "DOMAIN" and not location:
raise ERROR_REQUIRED_PARAMETER(
key="location", reason="location is required"
)
_LOGGER.debug(f"[_get_location] location is empty: {result} => SKIP")
# raise ERROR_REQUIRED_PARAMETER(
# key="location", reason="location is required"
# )

return location

0 comments on commit 289f35c

Please sign in to comment.