11import logging
22
33from spaceone .core .manager import BaseManager
4+
5+ from cloudforet .cost_analysis .connector .google_storage_collector import (
6+ GoogleStorageConnector ,
7+ )
48from cloudforet .cost_analysis .model .data_source_model import PluginMetadata
59from cloudforet .cost_analysis .connector .http_file_connector import HTTPFileConnector
610
@@ -13,10 +17,33 @@ def init_response(options):
1317 plugin_metadata = PluginMetadata ()
1418 plugin_metadata .validate ()
1519
20+ if "bucket_name" in options :
21+ return {
22+ "metadata" : {
23+ "data_source_rules" : [
24+ {
25+ "name" : "match_service_account" ,
26+ "conditions_policy" : "ALWAYS" ,
27+ "actions" : {
28+ "match_service_account" : {
29+ "source" : "additional_info.Project ID" ,
30+ "target" : "data.project_id" ,
31+ }
32+ },
33+ "options" : {"stop_processing" : True },
34+ }
35+ ],
36+ "currency" : "KRW" ,
37+ }
38+ }
39+
1640 return {"metadata" : plugin_metadata .to_primitive ()}
1741
1842 def verify_plugin (self , options , secret_data , schema ):
19- http_file_connector : HTTPFileConnector = self .locator .get_connector (
20- HTTPFileConnector
21- )
22- http_file_connector .create_session (options , secret_data , schema )
43+ if "base_url" in options :
44+ http_file_connector : HTTPFileConnector = self .locator .get_connector (
45+ HTTPFileConnector
46+ )
47+ http_file_connector .create_session (options , secret_data , schema )
48+ elif "bucket_name" in options :
49+ self .locator .get_connector (GoogleStorageConnector , secret_data = secret_data )
0 commit comments