###
### Copyright 2014-2015 Boundary, Inc.
###
### Licensed under the Apache License, Version 2.0 (the "License");
### you may not use this file except in compliance with the License.
### You may obtain a copy of the License at
###
###     http://www.apache.org/licenses/LICENSE-2.0
###
### Unless required by applicable law or agreed to in writing, software
### distributed under the License is distributed on an "AS IS" BASIS,
### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
### See the License for the specific language governing permissions and
### limitations under the License.
###
from api_cli import ApiCli

class MetricCreate (ApiCli):
     
    def __init__(self):
        ApiCli.__init__(self)
        self.method = "PUT"
        
        self.metricName = None
        self.displayName = None
        self.displayNameShort = None
        self.description = None
        self.aggregate = None
        self.unit = None
        self.resolution = None
        self.isDisabled = False
        
    def addArguments(self):
        ApiCli.addArguments(self)
        self.parser.add_argument('-n', '--metric-name', dest='metricName',action='store',required=True,help='Metric identifier')
        self.parser.add_argument('-d', '--display-name', dest='displayName',action='store',help='Metric display name')
        self.parser.add_argument('-s', '--display-name-short', dest='displayNameShort',action='store',help='Metric short display name')
        self.parser.add_argument('-i', '--description', dest='description',action='store',help='Metric description')
        self.parser.add_argument('-g', '--aggregate', dest='aggregate',action='store',help='Metric default aggregate')
        self.parser.add_argument('-u', '--unit', dest='unit',action='store',choices=['sum','avg','max','min'],help='Metric unit')
        self.parser.add_argument('-r', '--resolution', dest='resolution',action='store',help='Metric default resolution')
        self.parser.add_argument('-x', '--is-disabled',dest='isDisabled', action='store_true', help='disable metric')
        
    def getArguments(self):
        '''
        Extracts the specific arguments of this CLI
        '''
        ApiCli.getArguments(self)
        if self.args.metricName != None:
            self.metricName = self.args.metricName
            
        if self.args.displayName != None:
            self.displayName = self.args.displayName
            
        if self.args.displayNameShort != None:
            self.displayNameShort = self.args.displayNameShort
            
        if self.args.description != None:
            self.description = self.args.description
        
        if self.args.aggregate != None:
            self.aggregate = self.args.aggregate
            
        if self.args.unit != None:
            self.unit = self.args.unit
            
        if self.args.resolution != None:
            self.resolution = self.args.resolution
            
        if self.args.isDisabled != None:
            self.isDisabled = self.args.isDisabled
       
        self.data = {'name': self.metricName,
                    'displayName': self.displayName,
                    'displayNameShort': self.displayNameShort,
                    'description': self.description,
                    'defaultAggregate': self.aggregate,
                    'unit': self.unit,
                    'defaultResolutionMS': self.resolution,
                    'isDisabled': self.isDisabled}
        self.path = "v1/metrics/{0}".format(self.name)
    
    def validateArguments(self):
        return ApiCli.validateArguments(self)
         
    def getDescription(self):
        return "Creates a new metric definition in an Boundary account"
    
@@ -1188,16 +1188,38 @@
 ed=True,
+metavar='metric_name',
 help='Me
@@ -1319,32 +1319,55 @@
 ,action='store',
+metavar='display_name',
 help='Metric dis
@@ -1472,32 +1472,61 @@
 ,action='store',
+metavar='display_short_name',
 help='Metric sho
@@ -1625,32 +1625,54 @@
 ,action='store',
+metavar='description',
 help='Metric des
@@ -1760,32 +1760,86 @@
 ,action='store',
+choices=%5B'sum','avg','max','min'%5D,metavar='aggregate',
 help='Metric def
@@ -1941,39 +1941,72 @@
 oices=%5B'
-sum','avg','max','min'%5D
+percent','number','bytecount','duration'%5D,metavar='unit'
 ,help='M
@@ -2106,16 +2106,37 @@
 'store',
+metavar='resolution',
 help='Me
@@ -2234,17 +2234,16 @@
 sabled',
- 
 action='
@@ -2254,17 +2254,16 @@
 e_true',
- 
 help='di
@@ -2620,24 +2620,97 @@
 displayName%0A
+        else:%0A            self.displayName = self.metricName%0A            
             
@@ -2702,32 +2702,32 @@
                %0A
-
         if self.
@@ -2820,16 +2820,82 @@
 meShort%0A
+        else:%0A            self.displayNameShort = self.metricName%0A
         
@@ -2994,33 +2994,106 @@
 ription%0A        
+else:%0A            self.description = self.metricName%0A                    
 %0A
-
         if self.
@@ -3165,16 +3165,65 @@
 gregate%0A
+        else:%0A            self.aggregate = %22ave%22%0A
         
@@ -3301,16 +3301,63 @@
 gs.unit%0A
+        else:%0A            self.unit = %22number%22%0A
         
@@ -3449,24 +3449,73 @@
 .resolution%0A
+        else:%0A            self.resolution = 1000%0A
             
@@ -3607,16 +3607,29 @@
 isabled%0A
+            %0A
        %0A
@@ -4098,17 +4098,23 @@
 at(self.
-n
+metricN
 ame)%0A   

Add default values for arguments that are not required