3737 help = u"""Endpoint for VMware asset discovery and replication in the form of ```https://<host>:<port>/sdk```""" )
3838@cli_util .option ('--discovery-credentials' , type = custom_types .CLI_COMPLEX_TYPE ,
3939 help = u"""""" + custom_types .cli_complex_type .COMPLEX_TYPE_HELP )
40+ @cli_util .option ('--are-historical-metrics-collected' , type = click .BOOL ,
41+ help = u"""Flag indicating whether historical metrics are collected for assets, originating from this asset source.""" )
42+ @cli_util .option ('--are-realtime-metrics-collected' , type = click .BOOL ,
43+ help = u"""Flag indicating whether real-time metrics are collected for assets, originating from this asset source.""" )
44+ @cli_util .option ('--is-cost-information-collected' , type = click .BOOL ,
45+ help = u"""Flag indicating whether cost data collection is enabled for assets, originating from this asset source.""" )
46+ @cli_util .option ('--aws-region' , help = u"""AWS region information, from where the resources are discovered.""" )
47+ @cli_util .option ('--aws-account-key' , help = u"""The key of customer's aws account to be discovered/migrated.""" )
4048@discovery_cli .asset_source_group .command (
4149 name = cli_util .override ('discovery.create_asset_source.command_name' , 'create' ),
4250 help = u"""Creates an asset source. \n [Command Reference](createAssetSource)""" )
5967@cli_util .wrap_exceptions
6068def create_asset_source (ctx , from_json , wait_for_state , max_wait_seconds , wait_interval_seconds , type , compartment_id ,
6169 environment_id , inventory_id , assets_compartment_id , vcenter_endpoint , discovery_credentials ,
62- display_name , discovery_schedule_id , freeform_tags , defined_tags , system_tags ):
70+ are_historical_metrics_collected , are_realtime_metrics_collected , is_cost_information_collected ,
71+ display_name , discovery_schedule_id , aws_region , aws_account_key , freeform_tags , defined_tags , system_tags ):
6372 kwargs = {}
6473 kwargs ['opc_request_id' ] = cli_util .use_or_generate_request_id (ctx .obj ['request_id' ])
6574
@@ -71,6 +80,17 @@ def create_asset_source(ctx, from_json, wait_for_state, max_wait_seconds, wait_i
7180 _details ['assetsCompartmentId' ] = assets_compartment_id
7281 _details ['vcenterEndpoint' ] = vcenter_endpoint
7382 _details ['discoveryCredentials' ] = cli_util .parse_json_parameter ("discovery_credentials" , discovery_credentials )
83+ _details ['awsRegion' ] = aws_region
84+ _details ['awsAccountKey' ] = aws_account_key
85+
86+ if are_historical_metrics_collected is not None :
87+ _details ['areHistoricalMetricsCollected' ] = are_historical_metrics_collected
88+
89+ if are_realtime_metrics_collected is not None :
90+ _details ['areRealtimeMetricsCollected' ] = are_realtime_metrics_collected
91+
92+ if is_cost_information_collected is not None :
93+ _details ['isCostInformationCollected' ] = is_cost_information_collected
7494
7595 if display_name is not None :
7696 _details ['displayName' ] = display_name
@@ -91,6 +111,11 @@ def create_asset_source(ctx, from_json, wait_for_state, max_wait_seconds, wait_i
91111 if discovery_credentials is None or vcenter_endpoint is None :
92112 raise click .UsageError ('If parameter --type is VMWARE, then parameters --discovery-credentials and --vcenter-endpoint must be provided' )
93113
114+ if type .lower () == 'aws' :
115+ if discovery_credentials is None or aws_region is None or aws_account_key is None :
116+ raise click .UsageError ('If parameter --type is AWS, then parameters --discovery-credentials, '
117+ '--aws-region and --aws-account-key must be provided' )
118+
94119 client = cli_util .build_client ('cloud_bridge' , 'discovery' , ctx )
95120 result = client .create_asset_source (
96121 create_asset_source_details = _details ,
@@ -143,6 +168,8 @@ def create_asset_source(ctx, from_json, wait_for_state, max_wait_seconds, wait_i
143168 help = u"""Flag indicating whether historical metrics are collected for assets, originating from this asset source.""" )
144169@cli_util .option ('--are-realtime-metrics-collected' , type = click .BOOL ,
145170 help = u"""Flag indicating whether real-time metrics are collected for assets, originating from this asset source.""" )
171+ @cli_util .option ('--is-cost-information-collected' , type = click .BOOL ,
172+ help = u"""Flag indicating whether cost data collection is enabled for assets, originating from this asset source.""" )
146173@cli_util .option ('--discovery-schedule-id' ,
147174 help = u"""The [OCID] of the discovery schedule that is going to be assigned to an asset source.""" )
148175@json_skeleton_utils .get_cli_json_input_option (
@@ -164,8 +191,8 @@ def create_asset_source(ctx, from_json, wait_for_state, max_wait_seconds, wait_i
164191def update_asset_source (ctx , from_json , force , wait_for_state , max_wait_seconds , wait_interval_seconds , asset_source_id ,
165192 type , display_name , assets_compartment_id , freeform_tags , defined_tags , system_tags ,
166193 vcenter_endpoint , discovery_credentials , replication_credentials ,
167- are_historical_metrics_collected , are_realtime_metrics_collected , discovery_schedule_id ,
168- if_match ):
194+ are_historical_metrics_collected , are_realtime_metrics_collected , is_cost_information_collected ,
195+ discovery_schedule_id , if_match ):
169196 if isinstance (asset_source_id , six .string_types ) and len (asset_source_id .strip ()) == 0 :
170197 raise click .UsageError ('Parameter --asset-source-id cannot be whitespace or empty string' )
171198 if not force :
@@ -213,6 +240,9 @@ def update_asset_source(ctx, from_json, force, wait_for_state, max_wait_seconds,
213240 if are_realtime_metrics_collected is not None :
214241 _details ['areRealtimeMetricsCollected' ] = are_realtime_metrics_collected
215242
243+ if is_cost_information_collected is not None :
244+ _details ['isCostInformationCollected' ] = is_cost_information_collected
245+
216246 if discovery_schedule_id is not None :
217247 _details ['discoveryScheduleId' ] = discovery_schedule_id
218248
@@ -253,3 +283,19 @@ def update_asset_source(ctx, from_json, force, wait_for_state, max_wait_seconds,
253283 else :
254284 click .echo ('Unable to wait for the work request to enter the specified state' , file = sys .stderr )
255285 cli_util .render_response (result , ctx )
286+
287+
288+ # oci cloud-bridge discovery supported-cloud-region-summary list-supported-cloud-regions -> oci cloud-bridge discovery supported-cloud-region-summary list
289+ cli_util .rename_command (discovery_cli , discovery_cli .supported_cloud_region_summary_group , discovery_cli .list_supported_cloud_regions , "list" )
290+
291+
292+ # oci cloud-bridge discovery supported-cloud-region-summary -> oci cloud-bridge discovery supported-cloud-regions
293+ cli_util .rename_command (discovery_cli , discovery_cli .discovery_root_group , discovery_cli .supported_cloud_region_summary_group , "supported-cloud-regions" )
294+
295+
296+ # Remove create-asset-source-create-aws-asset-source-details from oci cloud-bridge discovery asset-source
297+ discovery_cli .asset_source_group .commands .pop (discovery_cli .create_asset_source_create_aws_asset_source_details .name )
298+
299+
300+ # Remove update-asset-source-update-aws-asset-source-details from oci cloud-bridge discovery asset-source
301+ discovery_cli .asset_source_group .commands .pop (discovery_cli .update_asset_source_update_aws_asset_source_details .name )
0 commit comments