- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们使用以下模板通过 ARM 模板部署多个资源组:
"parameters": {
"ResourceGroups": {
"type": "array",
"defaultValue": [
"RG1",
"RG2",
"RG3"
]
}
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"apiVersion": "2018-05-01",
"location": "[parameters('rgLocation')]",
"name": "[parameters('ResourceGroups')[copyIndex()])]",
"copy": {
"name": "resourcegroupcopy",
"count": "[length(parameters('ResourceGroups'))]",
"mode": "serial"
},
"properties": {},
"tags": {}
我们还想在这些资源组上编写 Azure 标记脚本。然而问题是,并非我们创建的所有资源组都需要相同的标签。它们因资源组而异。
例如:RG1需要Tag1,RG2需要Tag2等。
如何将其放入我的脚本中?
有人能指出我正确的方向吗?
谢谢!
最佳答案
答案是:这取决于你的具体要求,但通常有两种方法:if()函数、对象映射。其中任何一个都可以与 union() 函数组合。为您需要的每个标签创建一个变量:
"tag1": {
"something": "bla-bla"
},
"tag2": {
"somethingElse": "bla-bla-bla"
}
然后,您可以在资源代码中执行以下操作:
"tags": "[if(condition(something goes here, depending on your needs), variable('tag1'), variables('tag2'))]"
您可以将多个 if 语句组合在一起,也可以使用 union() 函数来合并标签(尽管不实用)。联合(变量('tag1'),变量('tag2'))。
另一种(在规模上更易于管理的方式)是使用映射器来“计算”标签属性。您希望 rg1 上有 tag1,rg2 上有 tag2,rg3 上有 tag3。简而言之,会发生什么:您正在检索一个变量,该变量的名称等于属性的值,而属性的值又等于对象的名称。令人困惑?这是一个例子。创建一个新变量:
"mapper": {
"rg1": "tag1",
"rg2": "tag2",
"rg3": "tag3",
}
然后,在您的资源中您可以执行以下操作:
"tags": "[variables(variables('mapper')[variables(parameters('ResourceGroups')[copyIndex()]))])]"
^ ^ ^ ^ name of the property would be RG1\RG2\RG3 depending on where you are in the loop. this would return value of the property, so tag1 or tag2 or tag3
^ ^ ^ access properties of the object you get from the previous function (variables('mapper'))
^ ^ get variable called 'mapper'. you will get an object
^ get variable value called tag1 or tag2 or tag3
关于json - 基于 Azure ARM JSON 的变量标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53559186/
将 ARM 处理器模式与 x86 操作模式(ring0 到 ring 3)进行比较,用户模式看起来就像 ring3,用户空间程序在其中运行。 但是,我无法将 ring0 与系统模式或主管模式联系起来。
为什么我们在 ARM 架构中有暂存寄存器?处理器如何使用它,我的意思是这个寄存器的用途是什么? 最佳答案 来自 Procedure Call Standard for the Arm Architec
我了解弱内存模型和强内存模型的基本区别。但是没有确切的弱定义,它取决于体系结构(这里是 ARM)。 我已经阅读了有关 ARM 信息中心的文档,但仍有很多内容不清楚。有人可以列出 - ARM 保证哪些内
我想在 arm 9 上分析我的代码,是否有任何分析器可以给我函数调用时间和每个函数占用的总周期?我更喜欢任何免费的分析器。我喜欢在 Linux 中使用 kcachegrind。 最佳答案 我不知道有什
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 7 年前。 Improve this qu
众所周知,对于X86架构:按下电源按钮后,机器开始执行0xFFFFFFF0处的代码,然后开始执行BIOS中的代码以进行硬件初始化。 BIOS 执行后,它使用引导加载程序将操作系统镜像加载到内存中。最后
我有 rootfs 和 klibc 文件系统。我正在创建 make 规则,而一些开发人员的编译器较旧,但没有联网。note1 我正在尝试验证所有文件都是使用 arm 仅当检测到某个版本的编译器时。我已
在部署实际应用程序之前,我们使用 ARM 模板部署 Azure 资源,作为构建过程的一部分。 到目前为止,我们所有的应用程序资源都自包含在资源组中。例如需要 SQL Server 和存储帐户的 Web
为什么 ARM Controller 在发生异常时要从 THUMB 状态返回到 ARM 状态? 最佳答案 一种解释可能是 ARM 模式是 CPU 的“ native ”操作模式,与有限的 Thumb
我正在尝试反转 128 位向量 (uint16x8) 的顺序。 例如,如果我有 a b c d e f g h 我想获得 h g f e d c b a 有没有一种简单的方法可以使用 NEON 内在函
有很多关于内存屏障的信息。大多数信息是指多核或多处理器架构。 Stackoverflow 上的某个地方还指出,单核处理器不需要内存屏障。 到目前为止,我找不到任何明确的解释,为什么单核 CPU 上不需
我想在 ARM Cortex A8 处理器上移植一小段代码。 L1 缓存和 L2 缓存都非常有限。我的程序中有 3 个数组。其中两个是顺序访问的(大小> 数组 A:6MB 和数组 B:3MB),第三个
我无法弄清楚这个 ARM 指令是做什么的: strd.w r0, r1, [r2] 我知道这是一个存储指令,它在 *r2 中存储了一些东西。但我不完全确定是什么。为什么有两个源寄存器
我很好奇为什么有些 ARM 指令(如 MUL 和 ADD)不使用桶形移位器。我想知道极限背后的理性。谢谢! 最佳答案 并不是没有使用桶形移位器;这是您无法指定它在非常具体的指令(数据处理和加载/存储)
我需要计算与 SSE 相同的操作: __m128i result1=_mm_avg_epu8 (upper, lower); 使用 NEON,我执行以下操作: uint8x16_t result1=v
我正在尝试使用 PLD 指令。我面临的问题如下: int32_t addr[10]; asm ("PLD [addr,#5]"); 我收到以下错误: Error: ARM register expec
根据 ARM 手册,应该可以访问特定 CPU 模式的存储寄存器,例如“r13_svc”。当我尝试执行此操作时,gcc 对我大喊大叫,并显示以下错误: 立即表达式需要 # 前缀 -- `mov r2,s
我正在使用 mbxxx 目标开发 Contiki 2.7。在构建我的代码时,链接器提示 .ARM.exidx 和 .data 部分的重叠 .在修改了链接器脚本 contiki-2.7/cpu/stm3
如何确定给定 ARM 处理器上是否存在 NEON 引擎?可以为此目的查询任何状态/标志寄存器吗? 最佳答案 我相信unixsmurf's answer如果使用具有特权内核的操作系统,这将与您获得的一样
如何在设备上分析我的 ARM 代码。 这是涉及 USB 和 SDH 处理的裸机代码,我看到了这个 Code Profiler for ARM但似乎很 slim ,我很熟悉DS5但如果您使用基于 lin
我是一名优秀的程序员,十分优秀!