Product Documentation

Retrieve private StyleBooks

Mar 15, 2018

Citrix StyleBooks can be marked as private when they must not appear on the NetScaler MAS. StyleBooks are also marked as private when they must not be used directly but serve as a building block for another StyleBook. You can set the private attribute in the header section of a StyleBook as shown below. This prevents the StyleBook from being listed on the NetScaler MAS.

name: basic-lb-config
description: This stylebook defines a simple load balancing configuration.
display-name: Load Balancing Configuration
namespace: com.example.stylebooks
private: true
schema-version: "1.0"
version: "0.1"

The public StyleBooks that appear on NetScaler MAS are often built by using a set of private StyleBooks. You may sometimes want to view and inspect these private StyleBooks to understand what they do and how they are used by the public StyleBooks. You can later use them when you construct your own StyleBooks. The StyleBooks are visible on NetScaler MAS and are also available through the API. You can use them to construct configuration packs just like the public StyleBooks.

Viewing private StyleBooks

You can now view all private StyleBooks in NetScaler MAS. Navigate to Applications > Configurations > Stylebooks. At the top right-side of the page, you can see an option to sort the StyleBooks. There are three options - all, public, or private StyleBooks. Click “Private.” NetScaler MAS displays all available private StyleBooks.

localized image

Using APIs to retrieve private StyleBooks

You can also use the StyleBooks REST API to retrieve the list of NetScaler MAS private StyleBooks and use them in your own StyleBooks.

GET https://<mas-server>/stylebook/nitro/v1/config/stylebooks?filter=private:true

Specify the URL query text string “filter=private:true”

This REST API call retrieves information (including the source YAML definition) of all the private StyleBooks that are available in the NetScaler MAS.

The response to this request is similar to the one shown below:

{
  "stylebooks": [
    {
      "author": null,
      "builtin": "false",
      "builtins": "{}",
      "description": "This StyleBook defines advanced settings for CS or LB Vservers.",
      "display_name": "vserver-advanced-params",
      "filename": "vserver-advanced-params.yaml",
      "hide": null,
      "id": "vserf6db6a7f66b73aa2b660955dbd81e376",
      "imported_by": "",
      "imported_datetime": "2017-07-31 20:16:28.832204",
      "name": "vserver-advanced-params",
      "namespace": "com.citrix.adc.commontypes",
      "pkg_id": "vserf6db6a7f66b73aa2b660955dbd81e376",
      "primary_keys": "[]",
      "private": "true",
      "recompile": "false",
      "schema_version": "1.0",
      "source": "LS0tIApuYW1lOiB2c2V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AgIC AgdHlwZTogbnVtYmVyICAgICAgIAogICAgICAtIAogICAgICAgIG5hbWU6IGNvbW1lbnQKICAgICA gICBsYWJlbDogIkxvYWQgQmFsYW5jZWQgQXBwIENvbW1lbnQiCiAgICAgICAgZGVzY3JpcHRpb 246ICJBbnkgY29tbWVudHMgdGhhdCB5b3UgbWlnaHQgd2FudCB0byBhc3NvY2lhdGUgd2l0aC B0aGUgdmlydHVhbCBzZXJ2ZXIuIgogICAgICAgIHR5cGU6IHN0cmluZwogICAgICAtCiAgICAgIC AgbmFtZTogaHR0cC1wcm9maWxlCiAgICAgICAgbGFiZWw6ICJOYW1lIG9mIEhUVFAgUHJvZm lsZSIKICAgICAgICBkZXNjcmlwdGlvbjogIk5hbWUgb2YgSFRUUCBQcm9maWxlIHRvIHVzZSBmb 3IgdGhpcyBWSVAiCiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgIC0KICAgICAgICBuYW1lOiBmbH VzaC1vbi1zdGF0ZS1kb3duCiAgICAgICAgbGFiZWw6ICJDbGVhbnVwIENvbm5lY3Rpb25zIHdoZW 4gZG93biIKICAgICAgICBkZXNjcmlwdGlvbjogIkNsZWFudXAgYWxsIGNvbm5lY3Rpb25zIG9uIHR oaXMgVklQIHdoZW4gaXQgZ29lcyBkb3duIgogICAgICAgIHR5cGU6IHN0cmluZwogICAgICAgIGR lZmF1bHQ6IEVOQUJMRUQKICAgICAgICBhbGxvd2VkLXZhbHVlczoKICAgICAgICAgICAgLSBFTk FCTEVECiAgICAgICAgICAgIC0gRElTQUJMRUQKICAgICAgLQogICAgICAgIG5hbWU6IGF1dGgtcG FyYW1zCiAgICAgICAgbGFiZWw6ICJBdXRoZW50aWNhdGlvbiBQYXJhbWV0ZXJzIgogICAgICAgI GRlc2NyaXB0aW9uOiAiUGFyYW1ldGVycyByZWxhdGVkIHRvIGVuYWJsaW5nIGF1dGhlbnRpY2F 0aW9uIG9uIHRoaXMgdmlydHVhbCBJUCIKICAgICAgICB0eXBlOiBvYmplY3QKICAgICAgICBwYX JhbWV0ZXJzOgogICAgICAgICAgICAtCiAgICAgICAgICAgICAgICBuYW1lOiBhdXRoZW50aWNhdG lvbgogICAgICAgICAgICAgICAgbGFiZWw6ICJFbmFibGUgQXV0aGVudGljYXRpb24iCiAgICAgICAg ICAgICAgICBkZXNjcmlwdGlvbjogIkF1dGhlbnRpY2F0ZSB1c2VycyB3aG8gcmVxdWVzdCBhIGNvb m5lY3Rpb24gdG8gdGhpcyB2aXJ0dWFsIElQIgogICAgICAgICAgICAgICAgdHlwZTogc3RyaW5nCi AgICAgICAgICAgICAgICBkZWZhdWx0OiAiT0ZGIgogICAgICAgICAgICAgICAgYWxsb3dlZC12YWx 1ZXM6CiAgICAgICAgICAgICAgICAgICAgLSAiT04iCiAgICAgICAgICAgICAgICAgICAgLSAiT0ZGIgo gICAgICAgICAgICAtCiAgICAgICAgICAgICAgICBuYW1lOiBhdXRoZW50aWNhdGlvbi1ob3N0CiAgI CAgICAgICAgICAgICBsYWJlbDogIkZRRE4gb2YgQXV0aCBWU2VydmVyIgogICAgICAgICAgICAgI CAgZGVzY3JpcHRpb246ICJUaGUgQXV0aGVudGljYXRpb24gVlNlcnZlciBGUUROIHRvIHdoaWN oIHVzZXJzIHRvIHRoaXMgVklQIGFyZSByZWRpcmVjdGVkIHRvIGZvciBhdXRoZW50aWNhdGlvb iIKICAgICAgICAgICAgICAgIHR5cGU6IHN0cmluZwogICAgICAgICAgICAtIAogICAgICAgICAgICAgI CAgbmFtZTogYXV0aGVudGljYXRpb24tdnNlcnZlci1uYW1lCiAgICAgICAgICAgICAgICBsYWJlbDog Ik5hbWUgb2YgQXV0aCBWU2VydmVyIgogICAgICAgICAgICAgICAgdHlwZTogc3RyaW5nCiAgICA gICAgICAgIC0gCiAgICAgICAgICAgICAgICBuYW1lOiBhdXRoZW50aWNhdGlvbi1odHRwLTQwMQ ogICAgICAgICAgICAgICAgbGFiZWw6ICJFbmFibGUgSFRUUCA0MDEgQXV0aCIKICAgICAgICAgI CAgICAgIHR5cGU6IHN0cmluZwogICAgICAgICAgICAgICAgZGVmYXVsdDogIk9GRiIKICAgICAgIC AgICAgICAgIGFsbG93ZWQtdmFsdWVzOgogICAgICAgICAgICAgICAgICAgIC0gIk9OIgogICAgICA gICAgICAgICAgICAgIC0gIk9GRiIKICAgICAgLQogICAgICAgICAgbmFtZTogYXBwZmxvdy1sb2cKIC AgICAgICAgIGxhYmVsOiAiRW5hYmxlIEFwcEZsb3ciCiAgICAgICAgICB0eXBlOiBzdHJpbmcKICAgI CAgICAgIGRlZmF1bHQ6IEVOQUJMRUQKICAgICAgICAgIGFsbG93ZWQtdmFsdWVzOgogICAgIC AgICAgICAgIC0gRU5BQkxFRAogICAgICAgICAgICAgIC0gRElTQUJMRUQ=",
      "system": null,
      "tags": "",
      "tenant_id": null,
      "user_sb": "false",
      "version": "1.0"
    },
    
  ]
}

In the example above, the first private StyleBook returned is “vserver-advanced-params.” The YAML content of this StyleBook can be retrieved from the content of the source attribute which contains the BASE64 encoding of the StyleBook contents.

Note: You can decode the contents of the source attribute back to YAML text using an online tool like www.base64decode.org. Once decoded, save the output to a local file called for example “vserver-advanced-params.yaml”.

Apart from using the REST APIs, you can also access the private StyleBooks in one other way:

If you have SSH access to the NetScaler MAS server, you can easily navigate to the location of all the Default StyleBooks (including private ones) at:

/var/mps/stylebooks/definitions.

Note: Tenant-specific custom StyleBooks (including any custom or private StyleBooks) are stored in the tenant-specific directory at:

/var/mps/tenants//stylebooks/

Removing private StyleBooks

Private StyleBooks that are not included in NetScaler MAS Default StyleBooks can be removed using the StyleBooks REST API. To remove a private StyleBook, use the following API:

DELETE https://<mas-server>/stylebook/nitro/v1/config/stylebooks/<stylebook-namespace>/<stylebook-version>/<stylebook-name>

When you receive a HTTP response status code of 200, that means the private StyleBook is successfully removed from NetScaler MAS.

Note: A private StyleBook that is used by other StyleBooks cannot be removed from NetScaler MAS as this would disrupt the dependent StyleBooks. You must first remove the dependent StyleBooks from NetScaler MAS to break that dependency, before you can remove the private StyleBook. It is a good practice to copy the StyleBooks to your local system before removing them from NetScaler MAS. This way, you can import them again if you need to.

Retrieve private StyleBooks

In this article