def take_action(self, parsed_args): resource_type = {'name': parsed_args.name} if parsed_args.attribute: resource_type['attributes'] = dict(parsed_args.attribute) res = utils.get_client(self).resource_type.create( resource_type=resource_type) utils.format_resource_type(res) return self.dict2columns(res)
def take_action(self, parsed_args): operations = [] if parsed_args.attribute: for name, attrs in parsed_args.attribute: operations.append({'op': 'add', 'path': '/attributes/%s' % name, 'value': attrs}) if parsed_args.remove_attribute: for name in parsed_args.remove_attribute: operations.append({'op': 'remove', 'path': '/attributes/%s' % name}) res = utils.get_client(self).resource_type.update( parsed_args.name, operations) utils.format_resource_type(res) return self.dict2columns(res)
def take_action(self, parsed_args): operations = [] if parsed_args.attribute: for name, attrs in parsed_args.attribute: operations.append({ 'op': 'add', 'path': '/attributes/%s' % name, 'value': attrs }) if parsed_args.remove_attribute: for name in parsed_args.remove_attribute: operations.append({ 'op': 'remove', 'path': '/attributes/%s' % name }) res = utils.get_client(self).resource_type.update( parsed_args.name, operations) utils.format_resource_type(res) return self.dict2columns(res)
def take_action(self, parsed_args): res = utils.get_client(self).resource_type.get(name=parsed_args.name) utils.format_resource_type(res) return self.dict2columns(res)