diff --git a/plugins/azure/resoto_plugin_azure/resource/base.py b/plugins/azure/resoto_plugin_azure/resource/base.py index a112ebee3..b7f267bf2 100644 --- a/plugins/azure/resoto_plugin_azure/resource/base.py +++ b/plugins/azure/resoto_plugin_azure/resource/base.py @@ -274,6 +274,35 @@ def connect_in_graph(self, builder: GraphBuilder, source: Json) -> None: builder.add_edge(self, edge_type=EdgeType.default, clazz=AzureResource, id=resource_id) +@define(eq=False, slots=False) +class AzureExtendedLocation: + kind: ClassVar[str] = "azure_extended_location" + mapping: ClassVar[Dict[str, Bender]] = {"name": S("name"), "type": S("type")} + name: Optional[str] = field(default=None, metadata={"description": "The name of the extended location."}) + type: Optional[str] = field(default=None, metadata={"description": "The type of extendedlocation."}) + + +@define(eq=False, slots=False) +class AzurePrincipalidClientid: + kind: ClassVar[str] = "azure_principalid_clientid" + mapping: ClassVar[Dict[str, Bender]] = {"client_id": S("clientId"), "principal_id": S("principalId")} + client_id: Optional[str] = field(default=None, metadata={'description': 'The client id of user assigned identity.'}) # fmt: skip + principal_id: Optional[str] = field(default=None, metadata={'description': 'The principal id of user assigned identity.'}) # fmt: skip + + +@define(eq=False, slots=False) +class AzurePrivateLinkServiceConnectionState: + kind: ClassVar[str] = "azure_private_link_service_connection_state" + mapping: ClassVar[Dict[str, Bender]] = { + "actions_required": S("actionsRequired"), + "description": S("description"), + "status": S("status"), + } + actions_required: Optional[str] = field(default=None, metadata={'description': 'A message indicating if changes on the service provider require any updates on the consumer.'}) # fmt: skip + description: Optional[str] = field(default=None, metadata={'description': 'The reason for approval/rejection of the connection.'}) # fmt: skip + status: Optional[str] = field(default=None, metadata={"description": "The private endpoint connection status."}) + + @define(eq=False, slots=False) class AzureSubscriptionPolicies: kind: ClassVar[str] = "azure_subscription_policies" diff --git a/plugins/azure/resoto_plugin_azure/resource/compute.py b/plugins/azure/resoto_plugin_azure/resource/compute.py index 93277edf2..cdaf2aa96 100644 --- a/plugins/azure/resoto_plugin_azure/resource/compute.py +++ b/plugins/azure/resoto_plugin_azure/resource/compute.py @@ -4,7 +4,16 @@ from attr import define, field from resoto_plugin_azure.azure_client import AzureApiSpec -from resoto_plugin_azure.resource.base import AzureResource, GraphBuilder, AzureSubResource, AzureSystemData, AzureSku +from resoto_plugin_azure.resource.base import ( + AzureResource, + GraphBuilder, + AzureSubResource, + AzureSystemData, + AzureSku, + AzureExtendedLocation, + AzurePrincipalidClientid, + AzurePrivateLinkServiceConnectionState, +) from resotolib.json_bender import Bender, S, Bend, MapEnum, ForallBend, K, F from resotolib.types import Json from resotolib.baseresources import ( @@ -458,14 +467,6 @@ class AzureDiskSku: tier: Optional[str] = field(default=None, metadata={"description": "The sku tier."}) -@define(eq=False, slots=False) -class AzureExtendedLocation: - kind: ClassVar[str] = "azure_extended_location" - mapping: ClassVar[Dict[str, Bender]] = {"name": S("name"), "type": S("type")} - name: Optional[str] = field(default=None, metadata={"description": "The name of the extended location."}) - type: Optional[str] = field(default=None, metadata={"description": "The type of extendedlocation."}) - - @define(eq=False, slots=False) class AzurePurchasePlan: kind: ClassVar[str] = "azure_purchase_plan" @@ -719,21 +720,8 @@ def connect_in_graph(self, builder: GraphBuilder, source: Json) -> None: @define(eq=False, slots=False) -class AzurePrivateLinkServiceConnectionState: - kind: ClassVar[str] = "azure_private_link_service_connection_state" - mapping: ClassVar[Dict[str, Bender]] = { - "actions_required": S("actionsRequired"), - "description": S("description"), - "status": S("status"), - } - actions_required: Optional[str] = field(default=None, metadata={'description': 'A message indicating if changes on the service provider require any updates on the consumer.'}) # fmt: skip - description: Optional[str] = field(default=None, metadata={'description': 'The reason for approval/rejection of the connection.'}) # fmt: skip - status: Optional[str] = field(default=None, metadata={"description": "The private endpoint connection status."}) - - -@define(eq=False, slots=False) -class AzurePrivateEndpointConnection: - kind: ClassVar[str] = "azure_private_endpoint_connection" +class AzureDiskAccessPrivateEndpointConnection: + kind: ClassVar[str] = "azure_disk_access_private_endpoint_connection" mapping: ClassVar[Dict[str, Bender]] = { "id": S("id"), "name": S("name"), @@ -772,24 +760,16 @@ class AzureDiskAccess(AzureResource): "atime": K(None), "extended_location": S("extendedLocation") >> Bend(AzureExtendedLocation.mapping), "private_endpoint_connections": S("properties", "privateEndpointConnections") - >> ForallBend(AzurePrivateEndpointConnection.mapping), + >> ForallBend(AzureDiskAccessPrivateEndpointConnection.mapping), "provisioning_state": S("properties", "provisioningState"), "time_created": S("properties", "timeCreated"), } extended_location: Optional[AzureExtendedLocation] = field(default=None, metadata={'description': 'The complex type of the extended location.'}) # fmt: skip - private_endpoint_connections: Optional[List[AzurePrivateEndpointConnection]] = field(default=None, metadata={'description': 'A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported.'}) # fmt: skip + private_endpoint_connections: Optional[List[AzureDiskAccessPrivateEndpointConnection]] = field(default=None, metadata={'description': 'A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported.'}) # fmt: skip provisioning_state: Optional[str] = field(default=None, metadata={'description': 'The disk access resource provisioning state.'}) # fmt: skip time_created: Optional[datetime] = field(default=None, metadata={'description': 'The time when the disk access was created.'}) # fmt: skip -@define(eq=False, slots=False) -class AzurePrincipalidClientid: - kind: ClassVar[str] = "azure_principalid_clientid" - mapping: ClassVar[Dict[str, Bender]] = {"client_id": S("clientId"), "principal_id": S("principalId")} - client_id: Optional[str] = field(default=None, metadata={'description': 'The client id of user assigned identity.'}) # fmt: skip - principal_id: Optional[str] = field(default=None, metadata={'description': 'The principal id of user assigned identity.'}) # fmt: skip - - @define(eq=False, slots=False) class AzureEncryptionSetIdentity: kind: ClassVar[str] = "azure_encryption_set_identity" diff --git a/plugins/azure/resoto_plugin_azure/resource/network.py b/plugins/azure/resoto_plugin_azure/resource/network.py index 151974f80..dd2e8f7ae 100644 --- a/plugins/azure/resoto_plugin_azure/resource/network.py +++ b/plugins/azure/resoto_plugin_azure/resource/network.py @@ -3,7 +3,14 @@ from attr import define, field from resoto_plugin_azure.azure_client import AzureApiSpec -from resoto_plugin_azure.resource.base import AzureResource, AzureSubResource, AzureSku +from resoto_plugin_azure.resource.base import ( + AzureResource, + AzureSubResource, + AzureSku, + AzureExtendedLocation, + AzurePrincipalidClientid, + AzurePrivateLinkServiceConnectionState, +) from resotolib.json_bender import Bender, S, Bend, ForallBend, K, AsInt, StringToUnitNumber @@ -753,27 +760,6 @@ class AzureApplicationGatewayPrivateLinkConfiguration(AzureSubResource): type: Optional[str] = field(default=None, metadata={"description": "Type of the resource."}) -@define(eq=False, slots=False) -class AzureExtendedLocation: - kind: ClassVar[str] = "azure_extended_location" - mapping: ClassVar[Dict[str, Bender]] = {"name": S("name"), "type": S("type")} - name: Optional[str] = field(default=None, metadata={"description": "The name of the extended location."}) - type: Optional[str] = field(default=None, metadata={'description': 'The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network resources.'}) # fmt: skip - - -@define(eq=False, slots=False) -class AzurePrivateLinkServiceConnectionState: - kind: ClassVar[str] = "azure_private_link_service_connection_state" - mapping: ClassVar[Dict[str, Bender]] = { - "actions_required": S("actionsRequired"), - "description": S("description"), - "status": S("status"), - } - actions_required: Optional[str] = field(default=None, metadata={'description': 'A message indicating if changes on the service provider require any updates on the consumer.'}) # fmt: skip - description: Optional[str] = field(default=None, metadata={'description': 'The reason for approval/rejection of the connection.'}) # fmt: skip - status: Optional[str] = field(default=None, metadata={'description': 'Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.'}) # fmt: skip - - @define(eq=False, slots=False) class AzurePrivateLinkServiceConnection(AzureSubResource): kind: ClassVar[str] = "azure_private_link_service_connection" @@ -958,14 +944,6 @@ class AzureApplicationGatewayGlobalConfiguration: enable_response_buffering: Optional[bool] = field(default=None, metadata={'description': 'Enable response buffering.'}) # fmt: skip -@define(eq=False, slots=False) -class AzurePrincipalidClientid: - kind: ClassVar[str] = "azure_principalid_clientid" - mapping: ClassVar[Dict[str, Bender]] = {"client_id": S("clientId"), "principal_id": S("principalId")} - client_id: Optional[str] = field(default=None, metadata={'description': 'The client id of user assigned identity.'}) # fmt: skip - principal_id: Optional[str] = field(default=None, metadata={'description': 'The principal id of user assigned identity.'}) # fmt: skip - - @define(eq=False, slots=False) class AzureManagedServiceIdentity: kind: ClassVar[str] = "azure_managed_service_identity" @@ -2487,8 +2465,8 @@ class AzurePrivateLinkServiceIpConfiguration(AzureSubResource): @define(eq=False, slots=False) -class AzurePrivateEndpointConnection(AzureSubResource): - kind: ClassVar[str] = "azure_private_endpoint_connection" +class AzureLinkServicePrivateEndpointConnection(AzureSubResource): + kind: ClassVar[str] = "azure_link_service_private_endpoint_connection" mapping: ClassVar[Dict[str, Bender]] = AzureSubResource.mapping | { "etag": S("etag"), "link_identifier": S("properties", "linkIdentifier"), @@ -2535,7 +2513,7 @@ class AzurePrivateLinkService: "location": S("location"), "name": S("name"), "private_endpoint_connections": S("properties", "privateEndpointConnections") - >> ForallBend(AzurePrivateEndpointConnection.mapping), + >> ForallBend(AzureLinkServicePrivateEndpointConnection.mapping), "provisioning_state": S("properties", "provisioningState"), "tags": S("tags"), "type": S("type"), @@ -2552,7 +2530,7 @@ class AzurePrivateLinkService: load_balancer_frontend_ip_configurations: Optional[List[AzureFrontendIPConfiguration]] = field(default=None, metadata={'description': 'An array of references to the load balancer IP configurations.'}) # fmt: skip location: Optional[str] = field(default=None, metadata={"description": "Resource location."}) name: Optional[str] = field(default=None, metadata={"description": "Resource name."}) - private_endpoint_connections: Optional[List[AzurePrivateEndpointConnection]] = field(default=None, metadata={'description': 'An array of list about connections to the private endpoint.'}) # fmt: skip + private_endpoint_connections: Optional[List[AzureLinkServicePrivateEndpointConnection]] = field(default=None, metadata={'description': 'An array of list about connections to the private endpoint.'}) # fmt: skip provisioning_state: Optional[str] = field(default=None, metadata={'description': 'The current provisioning state.'}) # fmt: skip tags: Optional[Dict[str, str]] = field(default=None, metadata={"description": "Resource tags."}) type: Optional[str] = field(default=None, metadata={"description": "Resource type."})