-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from lhhyung/main
Migration azure inventory plugin spaceone framwork 2.0
- Loading branch information
Showing
472 changed files
with
8,280 additions
and
22,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
schematics | ||
spaceone-api | ||
azure-identity | ||
azure-mgmt-resource | ||
azure-mgmt-compute | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.7.0 | ||
0.0.1 |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ICON_URL = "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/azure" |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os | ||
import logging | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.compute import ComputeManagementClient | ||
from azure.mgmt.resource import SubscriptionClient | ||
from azure.mgmt.network import NetworkManagementClient | ||
from azure.mgmt.sql import SqlManagementClient | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient | ||
from azure.mgmt.resource import ResourceManagementClient | ||
from azure.mgmt.storage import StorageManagementClient | ||
from azure.mgmt.cosmosdb import CosmosDBManagementClient | ||
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient | ||
from azure.mgmt.rdbms.postgresql_flexibleservers import PostgreSQLManagementClient as PostgreSQLFlexibleManagementClient | ||
from azure.mgmt.webpubsub import WebPubSubManagementClient | ||
from azure.mgmt.keyvault import KeyVaultManagementClient | ||
from azure.mgmt.rdbms.mysql import MySQLManagementClient | ||
from azure.mgmt.rdbms.mysql_flexibleservers import MySQLManagementClient as MySQLFlexibleManagementClient | ||
|
||
|
||
from spaceone.core.connector import BaseConnector | ||
|
||
DEFAULT_SCHEMA = 'azure_client_secret' | ||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class AzureBaseConnector(BaseConnector): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.subscription_client = None | ||
self.compute_client = None | ||
self.network_client = None | ||
self.sql_client = None | ||
self.monitor_client = None | ||
self.container_instance_client = None | ||
self.resource_client = None | ||
self.storage_client = None | ||
self.cosmosdb_client = None | ||
self.postgre_sql_client = None | ||
self.postgre_sql_flexible_client = None | ||
self.web_pubsub_service_client = None | ||
self.key_vault_client = None | ||
self.mysql_client = None | ||
self.mysql_flexible_client = None | ||
|
||
|
||
def set_connect(self, secret_data: dict): | ||
subscription_id = secret_data['subscription_id'] | ||
|
||
os.environ["AZURE_SUBSCRIPTION_ID"] = subscription_id | ||
os.environ["AZURE_TENANT_ID"] = secret_data['tenant_id'] | ||
os.environ["AZURE_CLIENT_ID"] = secret_data['client_id'] | ||
os.environ["AZURE_CLIENT_SECRET"] = secret_data['client_secret'] | ||
|
||
credential = DefaultAzureCredential() | ||
|
||
self.subscription_client = SubscriptionClient(credential=credential) | ||
self.compute_client = ComputeManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.network_client = NetworkManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.sql_client = SqlManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.monitor_client = MonitorManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.container_instance_client = ContainerInstanceManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.resource_client = ResourceManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.storage_client = StorageManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.cosmosdb_client = CosmosDBManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.postgre_sql_client = PostgreSQLManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.postgre_sql_flexible_client = PostgreSQLFlexibleManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.web_pubsub_service_client = WebPubSubManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.key_vault_client = KeyVaultManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.mysql_client = MySQLManagementClient(credential=credential, subscription_id=subscription_id) | ||
self.mysql_flexible_client = MySQLFlexibleManagementClient(credential=credential, subscription_id=subscription_id) | ||
|
||
def get_connector(self, cloud_service_group: str, cloud_service_type: str): | ||
pass |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
|
||
from plugin.connector.base import AzureBaseConnector | ||
|
||
_LOGGER = logging.getLogger("spaceone") | ||
|
||
|
||
class DisksConnector(AzureBaseConnector): | ||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self.set_connect(kwargs.get('secret_data')) | ||
|
||
def list_disks(self): | ||
return self.compute_client.disks.list() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
8 changes: 3 additions & 5 deletions
8
...ory/connector/load_balancers/connector.py → ...oad_balancers/load_balancers_connector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
src/plugin/connector/my_sql_servers/mysql_flexible_servers_connector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import logging | ||
|
||
from plugin.connector.base import AzureBaseConnector | ||
|
||
_LOGGER = logging.getLogger("spaceone") | ||
|
||
|
||
class MySQLFlexibleServersConnector(AzureBaseConnector): | ||
def __init__(self, secret_data=None, **kwargs): | ||
super().__init__(**kwargs) | ||
|
||
self.set_connect(secret_data) | ||
|
||
def list_flexible_servers(self): | ||
return self.mysql_flexible_client.servers.list() | ||
|
||
def list_firewall_rules_by_server(self, resource_group_name, server_name): | ||
return self.mysql_flexible_client.firewall_rules.list_by_server(resource_group_name=resource_group_name, server_name=server_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
9 changes: 3 additions & 6 deletions
9
...ntory/connector/nat_gateways/connector.py → ...or/nat_gateways/nat_gateways_connector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
src/plugin/connector/postgre_sql_servers/postgresql_flexible_servers_connector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import logging | ||
|
||
from plugin.connector.base import AzureBaseConnector | ||
|
||
_LOGGER = logging.getLogger("spaceone") | ||
|
||
|
||
class PostgreSQLFlexibleServersConnector(AzureBaseConnector): | ||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self.set_connect(kwargs.get("secret_data")) | ||
|
||
def list_flexible_servers(self): | ||
return self.postgre_sql_flexible_client.servers.list() | ||
|
||
def list_firewall_rules_by_server(self, resource_group_name, server_name): | ||
return self.postgre_sql_flexible_client.firewall_rules.list_by_server( | ||
resource_group_name=resource_group_name, server_name=server_name | ||
) |
Oops, something went wrong.