Exemplo n.º 1
0
def get_simple_gw_info(jsonObj):
	InternetGatewayId = jsonObj.get("InternetGatewayId")
	tagValue = ""
	tagKey = "Name"
	if cmdUtil.is_json_key_present(jsonObj,"Tags"):
		tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"),tagKey)
	retGwInfo = cmdUtil.nullToNoname(tagValue,"noname")+" : "+InternetGatewayId
	return retGwInfo
Exemplo n.º 2
0
def get_simple_sg_info(jsonObj):
    GroupId = jsonObj.get("GroupId")
    vpcId = jsonObj.get("VpcId")
    tagValue = "noname"
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    retVpcInfo = tagValue + " : " + GroupId + " : " + vpcId
    return retVpcInfo
Exemplo n.º 3
0
def get_simple_vpc_info(jsonObj):
    cidr = jsonObj.get("CidrBlock")
    vpcId = jsonObj.get("VpcId")
    tagValue = ""
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    retVpcInfo = tagValue + " : " + cidr + " : " + vpcId
    return retVpcInfo
Exemplo n.º 4
0
def get_simple_keys_info(jsonObj):
    KeyPairId = jsonObj.get("KeyPairId")
    KeyName = jsonObj.get("KeyName")
    tagValue = "noname"
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    retObjInfo = tagValue + " : " + KeyName + " : " + KeyPairId
    return retObjInfo
Exemplo n.º 5
0
def get_tagNmValue(jsonObj, tagKey):
	tagValue = ''
	if cmdUtil.is_json_key_present(jsonObj,"Tags"):
		tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"),tagKey)
		if tagValue == '':
			tagValue = "noname"
	else:
		tagValue = "noname"
	return tagValue
Exemplo n.º 6
0
def get_simple_routeTable_info(jsonObj):
    routeTableId = jsonObj.get("RouteTableId")
    VpcId = jsonObj.get("VpcId")
    tagValue = ""
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    else:
        tagValue = "noname"
    retRouteTableInfo = cmdUtil.nullToNoname(
        tagValue, "noname") + " : " + routeTableId + " : " + VpcId
    return retRouteTableInfo
Exemplo n.º 7
0
def get_simple_subnet_info(jsonObj):
    cidrBlock = jsonObj.get("CidrBlock")
    subnetId = jsonObj.get("SubnetId")
    VpcId = jsonObj.get("VpcId")
    availabilityZone = jsonObj.get("AvailabilityZone")
    tagValue = ""
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    else:
        tagValue = "noname"
    retSubnetInfo = tagValue + " : " + cidrBlock + " : " + availabilityZone + " : " + subnetId + " : " + VpcId
    return retSubnetInfo
Exemplo n.º 8
0
def get_simple_ec2instance_info(jsonObj):
    PublicIpAddress = cmdUtil.nullToNoname(jsonObj.get("PublicIpAddress"),
                                           "no public ip")
    PrivateIpAddress = cmdUtil.nullToNoname(jsonObj.get("PrivateIpAddress"),
                                            "no private ip")
    InstanceId = jsonObj.get("InstanceId")
    SubnetId = cmdUtil.nullToNoname(jsonObj.get("SubnetId"), "no subnet id")
    VpcId = cmdUtil.nullToNoname(jsonObj.get("VpcId"), "no vpc id")
    currentState = (jsonObj.get("State")).get("Name")
    tagValue = ""
    tagKey = "Name"
    if cmdUtil.is_json_key_present(jsonObj, "Tags"):
        tagValue = cmdUtil.getString_tagValue(jsonObj.get("Tags"), tagKey)
    else:
        tagValue = "noname"
    retInfo = cmdUtil.nullToNoname(
        tagValue, "noname"
    ) + " : " + currentState + " : " + PublicIpAddress + " : " + PrivateIpAddress + " : " + InstanceId + " : " + VpcId + " : " + SubnetId
    return retInfo