in src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nic/_create.py [0:0]
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("extendedLocation", AAZObjectType, ".extended_location")
_builder.set_prop("location", AAZStrType, ".location")
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_builder.set_prop("tags", AAZDictType, ".tags")
extended_location = _builder.get(".extendedLocation")
if extended_location is not None:
extended_location.set_prop("name", AAZStrType, ".name")
extended_location.set_prop("type", AAZStrType, ".type")
properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("auxiliaryMode", AAZStrType, ".auxiliary_mode")
properties.set_prop("auxiliarySku", AAZStrType, ".auxiliary_sku")
properties.set_prop("dnsSettings", AAZObjectType)
properties.set_prop("enableAcceleratedNetworking", AAZBoolType, ".accelerated_networking")
properties.set_prop("enableIPForwarding", AAZBoolType, ".ip_forwarding")
properties.set_prop("ipConfigurations", AAZListType, ".ip_configurations")
properties.set_prop("networkSecurityGroup", AAZObjectType, ".nsg")
dns_settings = _builder.get(".properties.dnsSettings")
if dns_settings is not None:
dns_settings.set_prop("dnsServers", AAZListType, ".dns_servers")
dns_settings.set_prop("internalDnsNameLabel", AAZStrType, ".internal_dns_name")
dns_servers = _builder.get(".properties.dnsSettings.dnsServers")
if dns_servers is not None:
dns_servers.set_elements(AAZStrType, ".")
ip_configurations = _builder.get(".properties.ipConfigurations")
if ip_configurations is not None:
ip_configurations.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_elements.set_prop("type", AAZStrType, ".type")
properties = _builder.get(".properties.ipConfigurations[].properties")
if properties is not None:
properties.set_prop("applicationGatewayBackendAddressPools", AAZListType, ".application_gateway_backend_address_pools")
properties.set_prop("applicationSecurityGroups", AAZListType, ".application_security_groups")
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("gatewayLoadBalancer", AAZObjectType, ".gateway_load_balancer"))
properties.set_prop("loadBalancerBackendAddressPools", AAZListType, ".load_balancer_backend_address_pools")
properties.set_prop("loadBalancerInboundNatRules", AAZListType, ".load_balancer_inbound_nat_rules")
properties.set_prop("primary", AAZBoolType, ".primary")
properties.set_prop("privateIPAddress", AAZStrType, ".private_ip_address")
properties.set_prop("privateIPAddressPrefixLength", AAZIntType, ".private_ip_address_prefix_length", typ_kwargs={"nullable": True})
properties.set_prop("privateIPAddressVersion", AAZStrType, ".private_ip_address_version")
properties.set_prop("privateIPAllocationMethod", AAZStrType, ".private_ip_allocation_method")
properties.set_prop("publicIPAddress", AAZObjectType, ".public_ip_address")
_CreateHelper._build_schema_subnet_create(properties.set_prop("subnet", AAZObjectType, ".subnet"))
application_gateway_backend_address_pools = _builder.get(".properties.ipConfigurations[].properties.applicationGatewayBackendAddressPools")
if application_gateway_backend_address_pools is not None:
application_gateway_backend_address_pools.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.applicationGatewayBackendAddressPools[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
properties = _builder.get(".properties.ipConfigurations[].properties.applicationGatewayBackendAddressPools[].properties")
if properties is not None:
properties.set_prop("backendAddresses", AAZListType, ".backend_addresses")
backend_addresses = _builder.get(".properties.ipConfigurations[].properties.applicationGatewayBackendAddressPools[].properties.backendAddresses")
if backend_addresses is not None:
backend_addresses.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.applicationGatewayBackendAddressPools[].properties.backendAddresses[]")
if _elements is not None:
_elements.set_prop("fqdn", AAZStrType, ".fqdn")
_elements.set_prop("ipAddress", AAZStrType, ".ip_address")
application_security_groups = _builder.get(".properties.ipConfigurations[].properties.applicationSecurityGroups")
if application_security_groups is not None:
_CreateHelper._build_schema_application_security_group_create(application_security_groups.set_elements(AAZObjectType, "."))
load_balancer_backend_address_pools = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools")
if load_balancer_backend_address_pools is not None:
load_balancer_backend_address_pools.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
properties = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties")
if properties is not None:
properties.set_prop("drainPeriodInSeconds", AAZIntType, ".drain_period_in_seconds")
properties.set_prop("loadBalancerBackendAddresses", AAZListType, ".load_balancer_backend_addresses")
properties.set_prop("location", AAZStrType, ".location")
properties.set_prop("syncMode", AAZStrType, ".sync_mode")
properties.set_prop("tunnelInterfaces", AAZListType, ".tunnel_interfaces")
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("virtualNetwork", AAZObjectType, ".virtual_network"))
load_balancer_backend_addresses = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties.loadBalancerBackendAddresses")
if load_balancer_backend_addresses is not None:
load_balancer_backend_addresses.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties.loadBalancerBackendAddresses[]")
if _elements is not None:
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
properties = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties.loadBalancerBackendAddresses[].properties")
if properties is not None:
properties.set_prop("adminState", AAZStrType, ".admin_state")
properties.set_prop("ipAddress", AAZStrType, ".ip_address")
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("loadBalancerFrontendIPConfiguration", AAZObjectType, ".load_balancer_frontend_ip_configuration"))
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("subnet", AAZObjectType, ".subnet"))
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("virtualNetwork", AAZObjectType, ".virtual_network"))
tunnel_interfaces = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties.tunnelInterfaces")
if tunnel_interfaces is not None:
tunnel_interfaces.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.loadBalancerBackendAddressPools[].properties.tunnelInterfaces[]")
if _elements is not None:
_elements.set_prop("identifier", AAZIntType, ".identifier")
_elements.set_prop("port", AAZIntType, ".port")
_elements.set_prop("protocol", AAZStrType, ".protocol")
_elements.set_prop("type", AAZStrType, ".type")
load_balancer_inbound_nat_rules = _builder.get(".properties.ipConfigurations[].properties.loadBalancerInboundNatRules")
if load_balancer_inbound_nat_rules is not None:
load_balancer_inbound_nat_rules.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.loadBalancerInboundNatRules[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
properties = _builder.get(".properties.ipConfigurations[].properties.loadBalancerInboundNatRules[].properties")
if properties is not None:
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("backendAddressPool", AAZObjectType, ".backend_address_pool"))
properties.set_prop("backendPort", AAZIntType, ".backend_port")
properties.set_prop("enableFloatingIP", AAZBoolType, ".enable_floating_ip")
properties.set_prop("enableTcpReset", AAZBoolType, ".enable_tcp_reset")
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("frontendIPConfiguration", AAZObjectType, ".frontend_ip_configuration"))
properties.set_prop("frontendPort", AAZIntType, ".frontend_port")
properties.set_prop("frontendPortRangeEnd", AAZIntType, ".frontend_port_range_end")
properties.set_prop("frontendPortRangeStart", AAZIntType, ".frontend_port_range_start")
properties.set_prop("idleTimeoutInMinutes", AAZIntType, ".idle_timeout_in_minutes")
properties.set_prop("protocol", AAZStrType, ".protocol")
public_ip_address = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress")
if public_ip_address is not None:
_CreateHelper._build_schema_extended_location_create(public_ip_address.set_prop("extendedLocation", AAZObjectType, ".extended_location"))
public_ip_address.set_prop("id", AAZStrType, ".id")
public_ip_address.set_prop("location", AAZStrType, ".location")
public_ip_address.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
public_ip_address.set_prop("sku", AAZObjectType, ".sku")
public_ip_address.set_prop("tags", AAZDictType, ".tags")
public_ip_address.set_prop("zones", AAZListType, ".zones")
properties = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties")
if properties is not None:
properties.set_prop("ddosSettings", AAZObjectType, ".ddos_settings")
properties.set_prop("deleteOption", AAZStrType, ".delete_option")
properties.set_prop("dnsSettings", AAZObjectType, ".dns_settings")
properties.set_prop("idleTimeoutInMinutes", AAZIntType, ".idle_timeout_in_minutes")
properties.set_prop("ipAddress", AAZStrType, ".ip_address")
properties.set_prop("ipTags", AAZListType, ".ip_tags")
properties.set_prop("migrationPhase", AAZStrType, ".migration_phase")
properties.set_prop("natGateway", AAZObjectType, ".nat_gateway")
properties.set_prop("publicIPAddressVersion", AAZStrType, ".public_ip_address_version")
properties.set_prop("publicIPAllocationMethod", AAZStrType, ".public_ip_allocation_method")
_CreateHelper._build_schema_sub_resource_create(properties.set_prop("publicIPPrefix", AAZObjectType, ".public_ip_prefix"))
ddos_settings = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.ddosSettings")
if ddos_settings is not None:
_CreateHelper._build_schema_sub_resource_create(ddos_settings.set_prop("ddosProtectionPlan", AAZObjectType, ".ddos_protection_plan"))
ddos_settings.set_prop("protectionMode", AAZStrType, ".protection_mode")
dns_settings = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.dnsSettings")
if dns_settings is not None:
dns_settings.set_prop("domainNameLabel", AAZStrType, ".domain_name_label")
dns_settings.set_prop("domainNameLabelScope", AAZStrType, ".domain_name_label_scope")
dns_settings.set_prop("fqdn", AAZStrType, ".fqdn")
dns_settings.set_prop("reverseFqdn", AAZStrType, ".reverse_fqdn")
ip_tags = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.ipTags")
if ip_tags is not None:
ip_tags.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.ipTags[]")
if _elements is not None:
_elements.set_prop("ipTagType", AAZStrType, ".ip_tag_type")
_elements.set_prop("tag", AAZStrType, ".tag")
nat_gateway = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway")
if nat_gateway is not None:
nat_gateway.set_prop("id", AAZStrType, ".id")
nat_gateway.set_prop("location", AAZStrType, ".location")
nat_gateway.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
nat_gateway.set_prop("sku", AAZObjectType, ".sku")
nat_gateway.set_prop("tags", AAZDictType, ".tags")
nat_gateway.set_prop("zones", AAZListType, ".zones")
properties = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.properties")
if properties is not None:
properties.set_prop("idleTimeoutInMinutes", AAZIntType, ".idle_timeout_in_minutes")
properties.set_prop("publicIpAddresses", AAZListType, ".public_ip_addresses")
properties.set_prop("publicIpPrefixes", AAZListType, ".public_ip_prefixes")
public_ip_addresses = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.properties.publicIpAddresses")
if public_ip_addresses is not None:
_CreateHelper._build_schema_sub_resource_create(public_ip_addresses.set_elements(AAZObjectType, "."))
public_ip_prefixes = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.properties.publicIpPrefixes")
if public_ip_prefixes is not None:
_CreateHelper._build_schema_sub_resource_create(public_ip_prefixes.set_elements(AAZObjectType, "."))
sku = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.sku")
if sku is not None:
sku.set_prop("name", AAZStrType, ".name")
tags = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
zones = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.properties.natGateway.zones")
if zones is not None:
zones.set_elements(AAZStrType, ".")
sku = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.sku")
if sku is not None:
sku.set_prop("name", AAZStrType, ".name")
sku.set_prop("tier", AAZStrType, ".tier")
tags = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
zones = _builder.get(".properties.ipConfigurations[].properties.publicIPAddress.zones")
if zones is not None:
zones.set_elements(AAZStrType, ".")
network_security_group = _builder.get(".properties.networkSecurityGroup")
if network_security_group is not None:
network_security_group.set_prop("id", AAZStrType, ".id")
network_security_group.set_prop("location", AAZStrType, ".location")
network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
network_security_group.set_prop("tags", AAZDictType, ".tags")
properties = _builder.get(".properties.networkSecurityGroup.properties")
if properties is not None:
properties.set_prop("flushConnection", AAZBoolType, ".flush_connection")
properties.set_prop("securityRules", AAZListType, ".security_rules")
security_rules = _builder.get(".properties.networkSecurityGroup.properties.securityRules")
if security_rules is not None:
security_rules.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.networkSecurityGroup.properties.securityRules[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_elements.set_prop("type", AAZStrType, ".type")
properties = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties")
if properties is not None:
properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}})
properties.set_prop("description", AAZStrType, ".description")
properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix")
properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes")
properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups")
properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range")
properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges")
properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}})
properties.set_prop("priority", AAZIntType, ".priority", typ_kwargs={"flags": {"required": True}})
properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}})
properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix")
properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes")
properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups")
properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range")
properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges")
destination_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationAddressPrefixes")
if destination_address_prefixes is not None:
destination_address_prefixes.set_elements(AAZStrType, ".")
destination_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationApplicationSecurityGroups")
if destination_application_security_groups is not None:
_CreateHelper._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, "."))
destination_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationPortRanges")
if destination_port_ranges is not None:
destination_port_ranges.set_elements(AAZStrType, ".")
source_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceAddressPrefixes")
if source_address_prefixes is not None:
source_address_prefixes.set_elements(AAZStrType, ".")
source_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceApplicationSecurityGroups")
if source_application_security_groups is not None:
_CreateHelper._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, "."))
source_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourcePortRanges")
if source_port_ranges is not None:
source_port_ranges.set_elements(AAZStrType, ".")
tags = _builder.get(".properties.networkSecurityGroup.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
tags = _builder.get(".tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
return self.serialize_content(_content_value)