Skip to content

Commit

Permalink
Merge pull request #31 from ImMin5/feature-azure-billing
Browse files Browse the repository at this point in the history
feat: modify default currency to KRW
  • Loading branch information
ImMin5 authored Oct 12, 2023
2 parents 4328c75 + b7a83ca commit b21791b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/cloudforet/cost_analysis/conf/cost_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
GROUPING = [
{'type': 'Dimension', 'name': 'ResourceGroup'},
{'type': 'Dimension', 'name': 'ResourceType'},
# {'type': 'Dimension', 'name': 'ResourceId'},
{'type': 'Dimension', 'name': 'ResourceId'},
{'type': 'Dimension', 'name': 'ResourceLocation'},
{'type': 'Dimension', 'name': 'SubscriptionId'},
{'type': 'Dimension', 'name': 'SubscriptionName'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from datetime import datetime
from cloudforet.cost_analysis.conf.cost_conf import *
from spaceone.core import utils
from spaceone.core.connector import BaseConnector
from spaceone.core.error import *
from cloudforet.cost_analysis.error.cost import *
Expand Down Expand Up @@ -193,21 +192,4 @@ def _check_secret_data(secret_data):
raise ERROR_REQUIRED_PARAMETER(key='secret_data.client_id')

if 'client_secret' not in secret_data:
raise ERROR_REQUIRED_PARAMETER(key='secret_data.client_secret')

# @staticmethod
# def _get_access_token(secret_data):
# tenant_id = secret_data.get('tenant_id', '')
#
# get_token_url = f'https://login.microsoftonline.com/{tenant_id}/oauth2/token'
# get_token_data = {
# 'client_id': secret_data.get('client_id', ''),
# 'client_secret': secret_data.get('client_secret', ''),
# 'grant_type': 'client_credentials',
# 'resource': 'https://management.azure.com/'
# }
# get_token_response = requests.post(url=get_token_url, data=get_token_data)
# access_token = get_token_response.json().get('access_token')
# if access_token is None:
# raise ERROR_INVALID_TOKEN(token=get_token_response.json())
# return access_token
raise ERROR_REQUIRED_PARAMETER(key='secret_data.client_secret')
2 changes: 0 additions & 2 deletions src/cloudforet/cost_analysis/manager/job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ def __init__(self, *args, **kwargs):
def get_tasks(self, options, secret_data, schema, start, last_synchronized_at, domain_id):

start_month = self._get_start_month(start, last_synchronized_at)
print(f'tart_month {start_month}=======')

self.azure_cm_connector.create_session(options, secret_data, schema)
secret_type = options.get('secret_type', SECRET_TYPE_DEFAULT)

if secret_type == 'MANUAL':
print(self.azure_cm_connector.get_billing_account())
billing_account_info = self.azure_cm_connector.get_billing_account()
billing_account_agreement_type = getattr(billing_account_info, 'agreement_type', '')

Expand Down
2 changes: 1 addition & 1 deletion src/cloudforet/cost_analysis/model/data_source_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ class DataSourceRule(Model):
class PluginMetadata(Model):
data_source_rules = ListType(ModelType(DataSourceRule), default=_DEFAULT_DATA_SOURCE_RULES)
supported_secret_types = ListType(StringType, default=['MANUAL'])
currency = StringType(default='USD')
currency = StringType(default='KRW')

0 comments on commit b21791b

Please sign in to comment.