Skip to content

Commit 66cbd9e

Browse files
[plugins][feat] Proper name, icon and group for AWS, Azure and GCP (#2188)
Signed-off-by: Lukas Lösche <lukas@some.engineering> Co-authored-by: Lukas Lösche <lukas@some.engineering>
1 parent e44bb35 commit 66cbd9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1327
-233
lines changed

fixlib/fixlib/baseresources.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ class BaseResource(ABC):
267267
kind: ClassVar[str] = "resource"
268268
kind_display: ClassVar[str] = "Resource"
269269
kind_description: ClassVar[str] = "A generic resource."
270+
kind_service: ClassVar[Optional[str]] = None
270271
phantom: ClassVar[bool] = False
271272
reference_kinds: ClassVar[ModelReference] = {}
272273
metadata: ClassVar[Dict[str, Any]] = {"icon": "resource", "group": "misc"}

fixlib/fixlib/core/model_export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ def export_data_class(clazz: type) -> None:
249249
metadata = m.copy()
250250
if (s := clazz.__dict__.get("kind_display", None)) and isinstance(s, str):
251251
metadata["name"] = s
252+
if (s := getattr(clazz, "kind_service", None)) and isinstance(s, str):
253+
metadata["service"] = s
252254
if with_description and (s := clazz.__dict__.get("kind_description", None)) and isinstance(s, str):
253255
metadata["description"] = s
254256

plugins/aws/fix_plugin_aws/collector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
from concurrent.futures import Future, ThreadPoolExecutor
44
from datetime import datetime, timedelta, timezone
5-
from typing import List, Type, Optional, ClassVar, Union, cast
5+
from typing import List, Type, Optional, ClassVar, Union, cast, Dict, Any
66

77
from attrs import define
88

@@ -432,10 +432,14 @@ class AwsOrganizationalRoot(BaseOrganizationalRoot, AwsResource):
432432
kind: ClassVar[str] = "aws_organizational_root"
433433
kind_display: ClassVar[str] = "AWS Organizational Root"
434434
kind_description: ClassVar[str] = "An AWS Organizational Root is the root of an AWS Organization."
435+
kind_service = "organizations"
436+
metadata: ClassVar[Dict[str, Any]] = {"icon": "group", "group": "control"}
435437

436438

437439
@define(eq=False, slots=False)
438440
class AwsOrganizationalUnit(BaseOrganizationalUnit, AwsResource):
439441
kind: ClassVar[str] = "aws_organizational_unit"
440442
kind_display: ClassVar[str] = "AWS Organizational Unit"
441443
kind_description: ClassVar[str] = "An AWS Organizational Unit is a container for AWS Accounts."
444+
kind_service = "organizations"
445+
metadata: ClassVar[Dict[str, Any]] = {"icon": "group", "group": "control"}

plugins/aws/fix_plugin_aws/resource/acm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class AwsAcmCertificate(AwsResource, BaseCertificate):
7272
kind_display: ClassVar[str] = "AWS ACM Certificate"
7373
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/acm/home?region={region}#/certificates/{id}", "arn_tpl": "arn:{partition}:acm:{region}:{account}:certificate/{id}"} # fmt: skip
7474
kind_description: ClassVar[str] = "An AWS ACM Certificate is used to provision, manage, and deploy Secure Sockets Layer/Transport Layer Security (SSL/TLS) certificates for secure web traffic on AWS services." # fmt: skip
75+
kind_service: ClassVar[Optional[str]] = service_name
7576
api_spec: ClassVar[AwsApiSpec] = AwsApiSpec("acm", "describe-certificate", "Certificate")
7677
mapping: ClassVar[Dict[str, Bender]] = {
7778
"id": S("CertificateArn") >> F(AwsResource.id_from_arn),

plugins/aws/fix_plugin_aws/resource/amazonq.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class AwsQBusinessApplication(AmazonQTaggable, AwsResource):
5252
"Represents a QBusiness application within the AWS QBusiness service. Applications"
5353
" define a set of tasks and configuration for processing data within the QBusiness ecosystem."
5454
)
55+
kind_service: ClassVar[Optional[str]] = service_name
56+
metadata: ClassVar[Dict[str, Any]] = {"icon": "application", "group": "generative_ai"}
5557
aws_metadata: ClassVar[Dict[str, Any]] = {
5658
"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/amazonq/business/applications/{id}/details?region={region}", # fmt: skip
5759
"arn_tpl": "arn:{partition}:qbusiness:{region}:{account}:application/{id}",
@@ -316,6 +318,8 @@ class AwsQBusinessConversation(AwsResource):
316318
"Represents a conversation within the AWS QBusiness service. Conversations are"
317319
" interactions that involve a series of messages or data exchanges."
318320
)
321+
kind_service: ClassVar[Optional[str]] = service_name
322+
metadata: ClassVar[Dict[str, Any]] = {"icon": "resource", "group": "generative_ai"}
319323
# Collected via AwsQBusinessApplication()
320324
mapping: ClassVar[Dict[str, Bender]] = {
321325
"id": S("conversationId"),
@@ -348,6 +352,8 @@ class AwsQBusinessDataSource(AmazonQTaggable, AwsResource):
348352
"Represents a data source in the AWS QBusiness service. Data sources are the origins"
349353
" from which data is ingested for processing or analysis within the QBusiness framework."
350354
)
355+
kind_service: ClassVar[Optional[str]] = service_name
356+
metadata: ClassVar[Dict[str, Any]] = {"icon": "bucket", "group": "generative_ai"}
351357
# Collected via AwsQBusinessApplication()
352358
aws_metadata: ClassVar[Dict[str, Any]] = {
353359
"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/amazonq/business/applications/{app_id}/indices/{indice_id}/datasources/{id}/details?region={region}", # fmt: skip
@@ -436,6 +442,8 @@ class AwsQBusinessDataSourceSyncJob(AwsResource):
436442
"Represents a data source synchronization job in the AWS QBusiness service. Sync jobs"
437443
" ensure that data from data sources is up-to-date and correctly integrated into the system."
438444
)
445+
kind_service: ClassVar[Optional[str]] = service_name
446+
metadata: ClassVar[Dict[str, Any]] = {"icon": "job", "group": "generative_ai"}
439447
# Collected via AwsQBusinessApplication()
440448
mapping: ClassVar[Dict[str, Bender]] = {
441449
"id": S("executionId"),
@@ -476,6 +484,8 @@ class AwsQBusinessDocument(AwsResource):
476484
"Represents a document within the AWS QBusiness service. Documents are structured pieces"
477485
" of information that can be used for various purposes within the QBusiness ecosystem."
478486
)
487+
kind_service: ClassVar[Optional[str]] = service_name
488+
metadata: ClassVar[Dict[str, Any]] = {"icon": "config", "group": "generative_ai"}
479489
# Collected via AwsQBusinessApplication()
480490
mapping: ClassVar[Dict[str, Bender]] = {
481491
"id": S("documentId"),
@@ -514,6 +524,8 @@ class AwsQBusinessIndice(AmazonQTaggable, AwsResource):
514524
"Represents an index in the AWS QBusiness service. Indices are used to organize and"
515525
" facilitate efficient searching and retrieval of data within the QBusiness framework."
516526
)
527+
kind_service: ClassVar[Optional[str]] = service_name
528+
metadata: ClassVar[Dict[str, Any]] = {"icon": "config", "group": "generative_ai"}
517529
aws_metadata: ClassVar[Dict[str, Any]] = {
518530
"arn_tpl": "arn:{partition}:qbusiness:{region}:{account}:application/{application_id}/index/{id}",
519531
"extra_args": ["application_id"],
@@ -693,6 +705,8 @@ class AwsQBusinessMessage(AwsResource):
693705
"Represents a message within the AWS QBusiness service. Messages are used for communication"
694706
" or data exchange between various components or users within the QBusiness ecosystem."
695707
)
708+
kind_service: ClassVar[Optional[str]] = service_name
709+
metadata: ClassVar[Dict[str, Any]] = {"icon": "config", "group": "generative_ai"}
696710
# Collected via AwsQBusinessApplication()
697711
mapping: ClassVar[Dict[str, Bender]] = {
698712
"id": S("messageId"),
@@ -735,6 +749,8 @@ class AwsQBusinessPlugin(AmazonQTaggable, AwsResource):
735749
"Represents a plugin in the AWS QBusiness service. Plugins extend the functionality of"
736750
" the QBusiness framework by adding new features or capabilities."
737751
)
752+
kind_service: ClassVar[Optional[str]] = service_name
753+
metadata: ClassVar[Dict[str, Any]] = {"icon": "resource", "group": "generative_ai"}
738754
aws_metadata: ClassVar[Dict[str, Any]] = {
739755
"arn_tpl": "arn:{partition}:qbusiness:{region}:{account}:application/{application_id}/plugin/{id}",
740756
"extra_args": ["application_id"],
@@ -794,11 +810,13 @@ def delete_resource(self, client: AwsClient, graph: Graph) -> bool:
794810
@define(eq=False, slots=False)
795811
class AwsQBusinessRetriever(AmazonQTaggable, AwsResource):
796812
kind: ClassVar[str] = "aws_q_business_retriever"
797-
kind_display: ClassVar[str] = "AWS QBusiness Retriever"
813+
kind_display: ClassVar[str] = "AWS Q Business Retriever"
798814
kind_description: ClassVar[str] = (
799815
"Represents a retriever in the AWS QBusiness service. Retrievers are used to fetch and"
800816
" process data from various sources within the QBusiness ecosystem."
801817
)
818+
kind_service: ClassVar[Optional[str]] = service_name
819+
metadata: ClassVar[Dict[str, Any]] = {"icon": "application", "group": "generative_ai"}
802820
aws_metadata: ClassVar[Dict[str, Any]] = {
803821
"arn_tpl": "arn:{partition}:qbusiness:{region}:{account}:application/{application_id}/retriever/{id}",
804822
"extra_args": ["application_id"],
@@ -849,11 +867,13 @@ def delete_resource(self, client: AwsClient, graph: Graph) -> bool:
849867
@define(eq=False, slots=False)
850868
class AwsQBusinessWebExperience(AmazonQTaggable, AwsResource):
851869
kind: ClassVar[str] = "aws_q_business_web_experience"
852-
kind_display: ClassVar[str] = "AWS QBusiness Web Experience"
870+
kind_display: ClassVar[str] = "AWS Q Business Web Experience"
853871
kind_description: ClassVar[str] = (
854872
"Represents a web experience in the AWS QBusiness service. Web experiences define"
855873
" interactive web-based applications or interfaces within the QBusiness ecosystem."
856874
)
875+
kind_service: ClassVar[Optional[str]] = service_name
876+
metadata: ClassVar[Dict[str, Any]] = {"icon": "application", "group": "generative_ai"}
857877
aws_metadata: ClassVar[Dict[str, Any]] = {
858878
"arn_tpl": "arn:{partition}:qbusiness:{region}:{account}:application/{application_id}/web-experience/{id}",
859879
"extra_args": ["application_id"],
@@ -920,6 +940,8 @@ class AwsQAppsLibraryItem(AwsResource):
920940
"Represents a library item in the AWS QApps service. Library items include resources"
921941
" such as scripts, templates, or other components that can be used in QApps applications."
922942
)
943+
kind_service: ClassVar[Optional[str]] = service_name
944+
metadata: ClassVar[Dict[str, Any]] = {"icon": "image", "group": "generative_ai"}
923945
# Collected via AwsQBusinessApplication()
924946
reference_kinds: ClassVar[ModelReference] = {
925947
"predecessors": {"default": ["aws_q_apps"]},
@@ -999,6 +1021,8 @@ class AwsQApps(AwsResource):
9991021
"Represents an application within the AWS QApps service. QApps applications include"
10001022
" various components and configurations for developing and deploying apps within the AWS environment."
10011023
)
1024+
kind_service: ClassVar[Optional[str]] = service_name
1025+
metadata: ClassVar[Dict[str, Any]] = {"icon": "application", "group": "generative_ai"}
10021026
# Collected via AwsQBusinessApplication()
10031027
mapping: ClassVar[Dict[str, Bender]] = {
10041028
"id": S("appId"),

plugins/aws/fix_plugin_aws/resource/apigateway.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,14 @@ class AwsApiGatewayMethod:
183183
class AwsApiGatewayResource(AwsResource):
184184
# collection of resource resources happens in AwsApiGatewayRestApi.collect()
185185
kind: ClassVar[str] = "aws_apigateway_resource"
186-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": None, "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/{name}"} # fmt: skip
187186
kind_display: ClassVar[str] = "AWS API Gateway Resource"
188187
kind_description: ClassVar[str] = (
189188
"API Gateway Resource is a logical unit used in API Gateway to represent a"
190189
" part of an API's resource hierarchy."
191190
)
191+
kind_service: ClassVar[Optional[str]] = service_name
192+
metadata: ClassVar[Dict[str, Any]] = {"icon": "gateway", "group": "networking"}
193+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": None, "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/{name}"} # fmt: skip
192194
reference_kinds: ClassVar[ModelReference] = {"successors": {"default": ["aws_apigateway_authorizer"]}}
193195
mapping: ClassVar[Dict[str, Bender]] = {
194196
"id": S("id"),
@@ -247,13 +249,15 @@ def service_name(cls) -> str:
247249
class AwsApiGatewayAuthorizer(AwsResource):
248250
# collection of authorizer resources happens in AwsApiGatewayRestApi.collect()
249251
kind: ClassVar[str] = "aws_apigateway_authorizer"
250-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{api_link}/authorizers/{id}?api={api_link}&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:authorizer/{name}/{id}"} # fmt: skip
251252
kind_display: ClassVar[str] = "AWS API Gateway Authorizer"
252253
kind_description: ClassVar[str] = (
253254
"API Gateway Authorizers are mechanisms that help control access to APIs"
254255
" deployed on AWS API Gateway by authenticating and authorizing client"
255256
" requests."
256257
)
258+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{api_link}/authorizers/{id}?api={api_link}&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:authorizer/{name}/{id}"} # fmt: skip
259+
metadata: ClassVar[Dict[str, Any]] = {"icon": "access_control", "group": "networking"}
260+
kind_service: ClassVar[Optional[str]] = service_name
257261
reference_kinds: ClassVar[ModelReference] = {
258262
"successors": {"default": ["aws_lambda_function"]},
259263
"predecessors": {"default": ["aws_iam_role"], "delete": ["aws_lambda_function", "aws_iam_role"]},
@@ -339,13 +343,14 @@ class AwsApiGatewayCanarySetting:
339343
class AwsApiGatewayStage(ApiGatewayTaggable, AwsResource):
340344
# collection of stage resources happens in AwsApiGatewayRestApi.collect()
341345
kind: ClassVar[str] = "aws_apigateway_stage"
342-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{api_link}/stages?api={api_link}&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/stages/{name}"} # fmt: skip
343-
344346
kind_display: ClassVar[str] = "AWS API Gateway Stage"
345347
kind_description: ClassVar[str] = (
346348
"API Gateway Stages are environment configurations for deploying and managing"
347349
" APIs in the AWS API Gateway service."
348350
)
351+
kind_service: ClassVar[Optional[str]] = service_name
352+
metadata: ClassVar[Dict[str, Any]] = {"icon": "gateway", "group": "networking"}
353+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{api_link}/stages?api={api_link}&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/stages/{name}"} # fmt: skip
349354
mapping: ClassVar[Dict[str, Bender]] = {
350355
"id": S("syntheticId"), # created by Fix to avoid collision with duplicate stage names
351356
"name": S("stageName"),
@@ -402,12 +407,14 @@ def called_mutator_apis(cls) -> List[AwsApiSpec]:
402407
class AwsApiGatewayDeployment(AwsResource):
403408
# collection of deployment resources happens in AwsApiGatewayRestApi.collect()
404409
kind: ClassVar[str] = "aws_apigateway_deployment"
405-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": None, "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/deployments/{name}"} # fmt: skip
406410
kind_display: ClassVar[str] = "AWS API Gateway Deployment"
407411
kind_description: ClassVar[str] = (
408412
"API Gateway Deployments represents a deployment of an API to an API Gateway stage."
409413
" This allows the API to be invocable by end-users."
410414
)
415+
kind_service: ClassVar[Optional[str]] = service_name
416+
metadata: ClassVar[Dict[str, Any]] = {"icon": "gateway", "group": "networking"}
417+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": None, "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:/restapis/{id}/deployments/{name}"} # fmt: skip
411418
# edge to aws_apigateway_stage is established in AwsApiGatewayRestApi.collect()
412419
reference_kinds: ClassVar[ModelReference] = {"successors": {"default": ["aws_apigateway_stage"]}}
413420

@@ -463,11 +470,13 @@ class AwsApiGatewayEndpointConfiguration:
463470
class AwsApiGatewayRestApi(ApiGatewayTaggable, AwsResource):
464471
kind: ClassVar[str] = "aws_apigateway_rest_api"
465472
kind_display: ClassVar[str] = "AWS API Gateway REST API"
466-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{id}/resources?api={id}&experience=rest&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:restapi/{id}"} # fmt: skip
467473
kind_description: ClassVar[str] = (
468474
"API Gateway is a fully managed service that makes it easy for developers to"
469475
" create, publish, and manage APIs at any scale."
470476
)
477+
kind_service: ClassVar[Optional[str]] = service_name
478+
metadata: ClassVar[Dict[str, Any]] = {"icon": "gateway", "group": "networking"}
479+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/apis/{id}/resources?api={id}&experience=rest&region={region}", "arn_tpl": "arn:{partition}:apigateway:{region}:{account}:restapi/{id}"} # fmt: skip
471480
api_spec: ClassVar[AwsApiSpec] = AwsApiSpec(
472481
service_name, "get-rest-apis", "items", override_iam_permission="apigateway:GET"
473482
)
@@ -618,12 +627,14 @@ class AwsApiGatewayMutualTlsAuthentication:
618627
class AwsApiGatewayDomainName(ApiGatewayTaggable, AwsResource):
619628
kind: ClassVar[str] = "aws_apigateway_domain_name"
620629
kind_display: ClassVar[str] = "AWS API Gateway Domain Name"
621-
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/publish/domain-names?api=unselected&domain={name}&&region={region}", "arn_tpl": "arn:aws:apigateway:{region}:{account}:domainname/{name}"} # fmt: skip
622630
kind_description: ClassVar[str] = (
623631
"API Gateway Domain Name is a custom domain name that you can associate with"
624632
" your API in Amazon API Gateway, allowing you to have a more branded and"
625633
" user-friendly endpoint for your API."
626634
)
635+
kind_service: ClassVar[Optional[str]] = service_name
636+
metadata: ClassVar[Dict[str, Any]] = {"icon": "dns", "group": "networking"}
637+
aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/apigateway/main/publish/domain-names?api=unselected&domain={name}&&region={region}", "arn_tpl": "arn:aws:apigateway:{region}:{account}:domainname/{name}"} # fmt: skip
627638
api_spec: ClassVar[AwsApiSpec] = AwsApiSpec(
628639
service_name, "get-domain-names", "items", override_iam_permission="apigateway:GET"
629640
)

0 commit comments

Comments
 (0)