in src/resource-mover/azext_resource_mover/aaz/latest/resource_mover/move_resource/_add.py [0:0]
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"client_flatten": True}}
)
_builder.set_prop("properties", AAZObjectType)
properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("dependsOnOverrides", AAZListType, ".depends_on_overrides")
properties.set_prop("existingTargetId", AAZStrType, ".existing_target_id")
properties.set_prop("resourceSettings", AAZObjectType, ".resource_settings_generated")
properties.set_prop("sourceId", AAZStrType, ".source_id", typ_kwargs={"flags": {"required": True}})
depends_on_overrides = _builder.get(".properties.dependsOnOverrides")
if depends_on_overrides is not None:
depends_on_overrides.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.dependsOnOverrides[]")
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("targetId", AAZStrType, ".target_id")
resource_settings = _builder.get(".properties.resourceSettings")
if resource_settings is not None:
resource_settings.set_const("resourceType", "Microsoft.Compute/availabilitySets", AAZStrType, ".microsoft_compute_availability_sets", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Compute/virtualMachines", AAZStrType, ".microsoft_compute_virtual_machines", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Network/loadBalancers", AAZStrType, ".microsoft_network_load_balancers", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Network/networkInterfaces", AAZStrType, ".microsoft_network_network_interfaces", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Network/networkSecurityGroups", AAZStrType, ".microsoft_network_network_security_groups", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Network/publicIPAddresses", AAZStrType, ".microsoft_network_public_ip_addresses", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Network/virtualNetworks", AAZStrType, ".microsoft_network_virtual_networks", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Sql/servers/databases", AAZStrType, ".microsoft_sql_servers_databases", typ_kwargs={"flags": {"required": True}})
resource_settings.set_const("resourceType", "Microsoft.Sql/servers/elasticPools", AAZStrType, ".microsoft_sql_servers_elastic_pools", typ_kwargs={"flags": {"required": True}})
resource_settings.set_prop("targetResourceGroupName", AAZStrType, ".target_resource_group_name")
resource_settings.set_prop("targetResourceName", AAZStrType, ".target_resource_name")
resource_settings.discriminate_by("resourceType", "Microsoft.Compute/availabilitySets")
resource_settings.discriminate_by("resourceType", "Microsoft.Compute/virtualMachines")
resource_settings.discriminate_by("resourceType", "Microsoft.Network/loadBalancers")
resource_settings.discriminate_by("resourceType", "Microsoft.Network/networkInterfaces")
resource_settings.discriminate_by("resourceType", "Microsoft.Network/networkSecurityGroups")
resource_settings.discriminate_by("resourceType", "Microsoft.Network/publicIPAddresses")
resource_settings.discriminate_by("resourceType", "Microsoft.Network/virtualNetworks")
resource_settings.discriminate_by("resourceType", "Microsoft.Sql/servers/databases")
resource_settings.discriminate_by("resourceType", "Microsoft.Sql/servers/elasticPools")
disc_microsoft__compute_availability_sets = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Compute/availabilitySets}")
if disc_microsoft__compute_availability_sets is not None:
disc_microsoft__compute_availability_sets.set_prop("faultDomain", AAZIntType, ".microsoft_compute_availability_sets.fault_domain", typ_kwargs={"nullable": True})
disc_microsoft__compute_availability_sets.set_prop("tags", AAZDictType, ".microsoft_compute_availability_sets.tags")
disc_microsoft__compute_availability_sets.set_prop("updateDomain", AAZIntType, ".microsoft_compute_availability_sets.update_domain", typ_kwargs={"nullable": True})
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Compute/availabilitySets}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__compute_virtual_machines = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Compute/virtualMachines}")
if disc_microsoft__compute_virtual_machines is not None:
disc_microsoft__compute_virtual_machines.set_prop("tags", AAZDictType, ".microsoft_compute_virtual_machines.tags")
disc_microsoft__compute_virtual_machines.set_prop("targetAvailabilitySetId", AAZStrType, ".microsoft_compute_virtual_machines.target_availability_set_id")
disc_microsoft__compute_virtual_machines.set_prop("targetAvailabilityZone", AAZStrType, ".microsoft_compute_virtual_machines.target_availability_zone")
disc_microsoft__compute_virtual_machines.set_prop("targetVmSize", AAZStrType, ".microsoft_compute_virtual_machines.target_vm_size")
disc_microsoft__compute_virtual_machines.set_prop("userManagedIdentities", AAZListType, ".microsoft_compute_virtual_machines.user_managed_identities")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Compute/virtualMachines}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
user_managed_identities = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Compute/virtualMachines}.userManagedIdentities")
if user_managed_identities is not None:
user_managed_identities.set_elements(AAZStrType, ".")
disc_microsoft__network_load_balancers = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}")
if disc_microsoft__network_load_balancers is not None:
disc_microsoft__network_load_balancers.set_prop("backendAddressPools", AAZListType, ".microsoft_network_load_balancers.backend_address_pools")
disc_microsoft__network_load_balancers.set_prop("frontendIPConfigurations", AAZListType, ".microsoft_network_load_balancers.frontend_ip_configurations")
disc_microsoft__network_load_balancers.set_prop("sku", AAZStrType, ".microsoft_network_load_balancers.sku")
disc_microsoft__network_load_balancers.set_prop("tags", AAZDictType, ".microsoft_network_load_balancers.tags")
disc_microsoft__network_load_balancers.set_prop("zones", AAZStrType, ".microsoft_network_load_balancers.zones")
backend_address_pools = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}.backendAddressPools")
if backend_address_pools is not None:
backend_address_pools.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}.backendAddressPools[]")
if _elements is not None:
_elements.set_prop("name", AAZStrType, ".name")
frontend_ip_configurations = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}.frontendIPConfigurations")
if frontend_ip_configurations is not None:
frontend_ip_configurations.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}.frontendIPConfigurations[]")
if _elements is not None:
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("privateIpAddress", AAZStrType, ".private_ip_address")
_elements.set_prop("privateIpAllocationMethod", AAZStrType, ".private_ip_allocation_method")
_AddHelper._build_schema_subnet_reference_create(_elements.set_prop("subnet", AAZObjectType, ".subnet"))
_elements.set_prop("zones", AAZStrType, ".zones")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/loadBalancers}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__network_network_interfaces = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}")
if disc_microsoft__network_network_interfaces is not None:
disc_microsoft__network_network_interfaces.set_prop("enableAcceleratedNetworking", AAZBoolType, ".microsoft_network_network_interfaces.enable_accelerated_networking", typ_kwargs={"nullable": True})
disc_microsoft__network_network_interfaces.set_prop("ipConfigurations", AAZListType, ".microsoft_network_network_interfaces.ip_configurations")
disc_microsoft__network_network_interfaces.set_prop("tags", AAZDictType, ".microsoft_network_network_interfaces.tags")
ip_configurations = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations")
if ip_configurations is not None:
ip_configurations.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[]")
if _elements is not None:
_elements.set_prop("loadBalancerBackendAddressPools", AAZListType, ".load_balancer_backend_address_pools")
_elements.set_prop("loadBalancerNatRules", AAZListType, ".load_balancer_nat_rules")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("primary", AAZBoolType, ".primary")
_elements.set_prop("privateIpAddress", AAZStrType, ".private_ip_address")
_elements.set_prop("privateIpAllocationMethod", AAZStrType, ".private_ip_allocation_method")
_elements.set_prop("publicIp", AAZObjectType, ".public_ip")
_AddHelper._build_schema_subnet_reference_create(_elements.set_prop("subnet", AAZObjectType, ".subnet"))
load_balancer_backend_address_pools = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[].loadBalancerBackendAddressPools")
if load_balancer_backend_address_pools is not None:
load_balancer_backend_address_pools.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[].loadBalancerBackendAddressPools[]")
if _elements is not None:
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("sourceArmResourceId", AAZStrType, ".source_arm_resource_id", typ_kwargs={"flags": {"required": True}})
load_balancer_nat_rules = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[].loadBalancerNatRules")
if load_balancer_nat_rules is not None:
load_balancer_nat_rules.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[].loadBalancerNatRules[]")
if _elements is not None:
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("sourceArmResourceId", AAZStrType, ".source_arm_resource_id", typ_kwargs={"flags": {"required": True}})
public_ip = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.ipConfigurations[].publicIp")
if public_ip is not None:
public_ip.set_prop("sourceArmResourceId", AAZStrType, ".source_arm_resource_id", typ_kwargs={"flags": {"required": True}})
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkInterfaces}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__network_network_security_groups = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkSecurityGroups}")
if disc_microsoft__network_network_security_groups is not None:
disc_microsoft__network_network_security_groups.set_prop("securityRules", AAZListType, ".microsoft_network_network_security_groups.security_rules")
disc_microsoft__network_network_security_groups.set_prop("tags", AAZDictType, ".microsoft_network_network_security_groups.tags")
security_rules = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkSecurityGroups}.securityRules")
if security_rules is not None:
security_rules.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkSecurityGroups}.securityRules[]")
if _elements is not None:
_elements.set_prop("access", AAZStrType, ".access")
_elements.set_prop("description", AAZStrType, ".description")
_elements.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix")
_elements.set_prop("destinationPortRange", AAZStrType, ".destination_port_range")
_elements.set_prop("direction", AAZStrType, ".direction")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("priority", AAZIntType, ".priority")
_elements.set_prop("protocol", AAZStrType, ".protocol")
_elements.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix")
_elements.set_prop("sourcePortRange", AAZStrType, ".source_port_range")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/networkSecurityGroups}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__network_public_ip_addresses = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/publicIPAddresses}")
if disc_microsoft__network_public_ip_addresses is not None:
disc_microsoft__network_public_ip_addresses.set_prop("domainNameLabel", AAZStrType, ".microsoft_network_public_ip_addresses.domain_name_label")
disc_microsoft__network_public_ip_addresses.set_prop("fqdn", AAZStrType, ".microsoft_network_public_ip_addresses.fqdn")
disc_microsoft__network_public_ip_addresses.set_prop("publicIpAllocationMethod", AAZStrType, ".microsoft_network_public_ip_addresses.public_ip_allocation_method")
disc_microsoft__network_public_ip_addresses.set_prop("sku", AAZStrType, ".microsoft_network_public_ip_addresses.sku")
disc_microsoft__network_public_ip_addresses.set_prop("tags", AAZDictType, ".microsoft_network_public_ip_addresses.tags")
disc_microsoft__network_public_ip_addresses.set_prop("zones", AAZStrType, ".microsoft_network_public_ip_addresses.zones")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/publicIPAddresses}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__network_virtual_networks = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}")
if disc_microsoft__network_virtual_networks is not None:
disc_microsoft__network_virtual_networks.set_prop("addressSpace", AAZListType, ".microsoft_network_virtual_networks.address_space")
disc_microsoft__network_virtual_networks.set_prop("dnsServers", AAZListType, ".microsoft_network_virtual_networks.dns_servers")
disc_microsoft__network_virtual_networks.set_prop("enableDdosProtection", AAZBoolType, ".microsoft_network_virtual_networks.enable_ddos_protection", typ_kwargs={"nullable": True})
disc_microsoft__network_virtual_networks.set_prop("subnets", AAZListType, ".microsoft_network_virtual_networks.subnets")
disc_microsoft__network_virtual_networks.set_prop("tags", AAZDictType, ".microsoft_network_virtual_networks.tags")
address_space = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.addressSpace")
if address_space is not None:
address_space.set_elements(AAZStrType, ".")
dns_servers = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.dnsServers")
if dns_servers is not None:
dns_servers.set_elements(AAZStrType, ".")
subnets = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.subnets")
if subnets is not None:
subnets.set_elements(AAZObjectType, ".")
_elements = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.subnets[]")
if _elements is not None:
_elements.set_prop("addressPrefix", AAZStrType, ".address_prefix")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("networkSecurityGroup", AAZObjectType, ".network_security_group")
network_security_group = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.subnets[].networkSecurityGroup")
if network_security_group is not None:
network_security_group.set_prop("sourceArmResourceId", AAZStrType, ".source_arm_resource_id", typ_kwargs={"flags": {"required": True}})
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Network/virtualNetworks}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__sql_servers_databases = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Sql/servers/databases}")
if disc_microsoft__sql_servers_databases is not None:
disc_microsoft__sql_servers_databases.set_prop("tags", AAZDictType, ".microsoft_sql_servers_databases.tags")
disc_microsoft__sql_servers_databases.set_prop("zoneRedundant", AAZStrType, ".microsoft_sql_servers_databases.zone_redundant")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Sql/servers/databases}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
disc_microsoft__sql_servers_elastic_pools = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Sql/servers/elasticPools}")
if disc_microsoft__sql_servers_elastic_pools is not None:
disc_microsoft__sql_servers_elastic_pools.set_prop("tags", AAZDictType, ".microsoft_sql_servers_elastic_pools.tags")
disc_microsoft__sql_servers_elastic_pools.set_prop("zoneRedundant", AAZStrType, ".microsoft_sql_servers_elastic_pools.zone_redundant")
tags = _builder.get(".properties.resourceSettings{resourceType:Microsoft.Sql/servers/elasticPools}.tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
return self.serialize_content(_content_value)