-
-
-
-
Importing and synchronizing StyleBooks from GitHub repository
-
Simplified migration of Citrix ADC application configuration using StyleBooks
-
-
In-place interpolations
-
Use ADM log messages for managing and monitoring your infrastructure
-
-
Citrix ADC automation using Citrix ADM in Cisco ACI hybrid mode
-
Citrix ADC device package in Cisco ACI's cloud orchestrator mode
-
This content has been machine translated dynamically.
Dieser Inhalt ist eine maschinelle Übersetzung, die dynamisch erstellt wurde. (Haftungsausschluss)
Cet article a été traduit automatiquement de manière dynamique. (Clause de non responsabilité)
Este artículo lo ha traducido una máquina de forma dinámica. (Aviso legal)
此内容已经过机器动态翻译。 放弃
このコンテンツは動的に機械翻訳されています。免責事項
이 콘텐츠는 동적으로 기계 번역되었습니다. 책임 부인
Este texto foi traduzido automaticamente. (Aviso legal)
Questo contenuto è stato tradotto dinamicamente con traduzione automatica.(Esclusione di responsabilità))
This article has been machine translated.
Dieser Artikel wurde maschinell übersetzt. (Haftungsausschluss)
Ce article a été traduit automatiquement. (Clause de non responsabilité)
Este artículo ha sido traducido automáticamente. (Aviso legal)
この記事は機械翻訳されています.免責事項
이 기사는 기계 번역되었습니다.책임 부인
Este artigo foi traduzido automaticamente.(Aviso legal)
这篇文章已经过机器翻译.放弃
Questo articolo è stato tradotto automaticamente.(Esclusione di responsabilità))
Translation failed!
In-place interpolations
It is now possible to replace part(s) of a string using a StyleBook expression(s). When these string expressions are evaluated by the StyleBook compiler, the part of the string that uses a StyleBook expression will be replaced by value of the expression. To include StyleBook expressions in a string, we use the following notation:
“…%{…}%…”
where the characters enclosed between” %{ “ and “}%” form a StyleBook expression. These expressions are known as “in-place interpolations. “
For example, the string “lb-%{$parameters.appname}%-svc” is a string expression with in-place interpolation of a StyleBook expression. The value of string expression depends on the value of the interpolation expression. Consider that $parameters.appname is assigned with “app1.” Then, the string expression evaluates to lb-app1-svc. This allows the values to be not hard-coded in string expressions, but rather be evaluated based on the user-defined values.
A practical use case of in-place interpolations is to parameterize policy expressions in StyleBooks. Consider a scenario where you want to write a policy expression that checks if the HTTP URL contains a specific word, say, “jpeg”.
For this, you write a policy expression as follows: “HTTP.REQ.URL.CONTAINS(\“jpeg\”)”.
Now, if you want to parameterize the object in the HTTP URL, you can add a string parameter in the StyleBook, say, $parameters.url-object. The policy expression should be written based on this parameter. To do that, you use string concatenation to achieve the result. The expression would look like:
str(“HTTP.REQ.URL.CONTAINS(\”” + $parameters.url-object + “\”)”)
If $parameter.url-object is assigned “csv”, the above expression will evaluate to “HTTP.REQ.URL.CONTAINS(\“csv\”)”. However, this expression is not easy to read. To make this parameterization easy to read and understand, you can use in-place interpolations.
The expression with in-place interpolation is now:
str(“HTTP.REQ.URL.CONTAINS(%{quotewrap($parameters.url-object)}%)”)
In the above expression, you used an interpolation expression that adds the inner-quotes around the value of the $parameters.url-object. The result of this expression is same as the above, but, it looks more intuitive and closer to the actual result.
Allowed Types Inside Interpolations
You can use expressions that generates value of following types inside interpolations: boolean, number, tcp-port, ipaddress, and string. The generated value is automatically transformed to a string when the interpolations are replaced with the result.
String expressions can have 0, 1, or more interpolations. In a sequential interpolation, different parts of the string expression can be replaced by different StyleBook expressions. For example, the string lb-%{$parameters.appname}%-%{$parameters.vip}% returns “lb-app1-1.1.1.1”, if $parameters.appname is “app1” and $parameters.vip is “1.1.1.1”
String expressions also supports nested interpolations. That is, an interpolation expression can be nested inside another interpolation expression so that the value of one expression can become an input to the second expression.
For example, consider a string “%{lb-%{$parameters.port + 1}%}%”
The internal string, “%{$parameters.port + 1}%” returns “lb-81” if $parameters.port is 80. Here this expression is nested inside another interpolation expression.
The following table describes the different types of interpolations with examples and corresponding results. The value of the parameters used in the examples are:
- $parameters.appname: “lb1”
- $parameters.vip: “1.1.1.1”
- $parameters.n1: 1
- $parameters.n2: 3
Simple interpolations
Expression | Result |
---|---|
lb-%{$parameters.appname}%-def | lb-lb1-def |
Automatic type conversions
Expression | Result |
---|---|
lb-%{1}% | lb-1 |
lb-%{$parameters.vip}% | lb-1.1.1.1 |
lb-%{true}% | lb-True |
Sequential interpolations
Expression | Result |
---|---|
%{$parameters.appname}%-%{str($parameters.appname)}% | lb1-lb1 |
lb-%{1}%-%{2}% | lb-1-2 |
Nested interpolations
Expression | Result |
---|---|
%{abc-%{$parameters.n1 + 1}%}% | abc-2 |
str(“%{abc-%{$parameters.n1}%}%-%{$parameters.n2}%”) | bc-1-3 |
Interpolations with quotewrap
Expression | Result |
---|---|
str(“%{quotewrap(abcd)}%”)
str(“%{quotewrap( https://)}%+HTTP.REQ.HOSTNAME+HTTP.REQ.URL")
|
“abcd
“«code class=”language-plaintext highlighter-rouge”>https://”+HTTP.REQ.HOST NAME+HTTP.REQ.URL</code> |
Escape Characters in Interpolations
If the characters “%{“ or “}%” are part of the string, you must provide “\
” as an escape character so that the StyleBook compiler does not evaluate these as interpolation tags.
Example:
str(“%{\%{ + str($parameters.vip) + }\%}%”) returns “%{1.1.1.1}%” if $parameters.vip is 1.1.1.1
The following table describes a few more expressions and their results:
Category | Expression | Result |
---|---|---|
Escaping interpolations | str(“%{str($parameters.n1) + }\%}%”) | 1}% |
lb-%{str($parameters.n1) + }\%}% | lb-1}% | |
”%{str($parameters.n1) + \”}\%\”}%” | 1}% | |
Share
Share
This Preview product documentation is Cloud Software Group Confidential.
You agree to hold this documentation confidential pursuant to the terms of your Cloud Software Group Beta/Tech Preview Agreement.
The development, release and timing of any features or functionality described in the Preview documentation remains at our sole discretion and are subject to change without notice or consultation.
The documentation is for informational purposes only and is not a commitment, promise or legal obligation to deliver any material, code or functionality and should not be relied upon in making Cloud Software Group product purchase decisions.
If you do not agree, select I DO NOT AGREE to exit.