Skip to content

Commit

Permalink
remove default arn
Browse files Browse the repository at this point in the history
  • Loading branch information
meln1k committed Oct 8, 2024
1 parent c32fdd1 commit dd181a0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ class AwsBackupVault(BackupResourceTaggable, AwsResource, HasResourcePolicy):
vault_policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.vault_policy:
if not self.vault_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, uri=self.arn or ""), self.vault_policy or {})]
return [(PolicySource(PolicySourceKind.resource, uri=self.arn), self.vault_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
8 changes: 4 additions & 4 deletions plugins/aws/fix_plugin_aws/resource/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ class AwsDynamoDbTable(DynamoDbTaggable, AwsResource, HasResourcePolicy):
dynamodb_policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.dynamodb_policy:
if not self.dynamodb_policy or not self.arn:
return []
return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.dynamodb_policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.dynamodb_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down Expand Up @@ -531,10 +531,10 @@ class AwsDynamoDbGlobalTable(DynamoDbTaggable, AwsResource, HasResourcePolicy):
dynamodb_policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.dynamodb_policy:
if not self.dynamodb_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.dynamodb_policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.dynamodb_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/efs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ class AwsEfsFileSystem(EfsTaggable, AwsResource, BaseNetworkShare, HasResourcePo
file_system_policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.file_system_policy:
if not self.file_system_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.file_system_policy or {})]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.file_system_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/kms.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ class AwsKmsKey(AwsResource, BaseAccessKey, HasResourcePolicy):
kms_key_policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.kms_key_policy:
if not self.kms_key_policy or not self.arn:
return []
return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.kms_key_policy or {})]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.kms_key_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/lambda_.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ class AwsLambdaFunction(AwsResource, BaseServerlessFunction, HasResourcePolicy):
function_url_config: Optional[AwsLambdaFunctionUrlConfig] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.function_policy:
if not self.function_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.function_policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.function_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/secretsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ class AwsSecretsManagerSecret(HasResourcePolicy, AwsResource):
policy: Optional[Json] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.policy:
if not self.policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class AwsSnsTopic(AwsResource, HasResourcePolicy):
topic_content_based_deduplication: Optional[bool] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.topic_policy:
if not self.topic_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.topic_policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.topic_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down
4 changes: 2 additions & 2 deletions plugins/aws/fix_plugin_aws/resource/sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ class AwsSqsQueue(AwsResource, BaseQueue, HasResourcePolicy):
sqs_managed_sse_enabled: Optional[bool] = field(default=None)

def resource_policy(self, builder: Any) -> List[Tuple[PolicySource, Dict[str, Any]]]:
if not self.sqs_policy:
if not self.sqs_policy or not self.arn:
return []

return [(PolicySource(PolicySourceKind.resource, self.arn or ""), self.sqs_policy)]
return [(PolicySource(PolicySourceKind.resource, self.arn), self.sqs_policy)]

@classmethod
def called_collect_apis(cls) -> List[AwsApiSpec]:
Expand Down

0 comments on commit dd181a0

Please sign in to comment.