def _gen_gce_as_policy(as_params):
 asp_data = {}
 asp_data['maxNumReplicas'] = as_params['max_instances']
 if ('min_instances' in as_params):
  asp_data['minNumReplicas'] = as_params['min_instances']
 if ('cool_down_period' in as_params):
  asp_data['coolDownPeriodSec'] = as_params['cool_down_period']
 if (('cpu_utilization' in as_params) and ('target' in as_params['cpu_utilization'])):
  asp_data['cpuUtilization'] = {'utilizationTarget': as_params['cpu_utilization']['target']}
 if (('load_balancing_utilization' in as_params) and ('target' in as_params['load_balancing_utilization'])):
  asp_data['loadBalancingUtilization'] = {'utilizationTarget': as_params['load_balancing_utilization']['target']}
 return asp_data

def _gen_gce_as_policy ( as_params ) : asp_data = { } asp_data [ 'maxNumReplicas' ] = as_params [ 'max_instances' ] if ( 'min_instances' in as_params ) : asp_data [ 'minNumReplicas' ] = as_params [ 'min_instances' ] if ( 'cool_down_period' in as_params ) : asp_data [ 'coolDownPeriodSec' ] = as_params [ 'cool_down_period' ] if ( ( 'cpu_utilization' in as_params ) and ( 'target' in as_params [ 'cpu_utilization' ] ) ) : asp_data [ 'cpuUtilization' ] = { 'utilizationTarget' : as_params [ 'cpu_utilization' ] [ 'target' ] } if ( ( 'load_balancing_utilization' in as_params ) and ( 'target' in as_params [ 'load_balancing_utilization' ] ) ) : asp_data [ 'loadBalancingUtilization' ] = { 'utilizationTarget' : as_params [ 'load_balancing_utilization' ] [ 'target' ] } return asp_data
take autoscaler params and generate gce-compatible policy .