Subscribing to Densify Recommendations

Subscribing to Densify Recommendations

#340700

This use case showcases how to subscribe to a set of Densify recommendation notifications using the Densify Subscription Service (DSS) API framework.

The DSS is a flexible framework that offers you the ability to customize the content of your Densify recommendations for targeted distribution. DSS features include:

  • ability to filter recommendation systems based on recommendation fields (property filter);
  • ability to filter recommendation systems based on attribute tags (tag filter);
  • ability to suppress recommendation systems, for a period of time, based on recommendation fields and/or attribute tags via suppression filters;
  • ability to customize the notification output format;
  • ability to send the notification to an external webhook;
  • ability to schedule the notification;
  • ability to have private subscription definitions, as well as global subscription definitions for shared usage;
  • supports both cloud and containers system recommendations.

To use these features, you need to create an instance of the Subscription resource.

Creating a Subscription

The diagram below provides a high-level overview of creating an instance of the Subscription resource through the Densify API:

An instance of the Subscriptions resource is created using the POST /subscriptions/<platformType> request. You must identify the <platformType> of the subscription and use similar platform resources to define the subscription. For instance, you need to use container resources for a subscription to container recommendations. After identifying the subscription platform resources to use, define the parameter components below to customize your subscription.

  1. Define the Subscription—Specify the subscriptionName, description, and owner.
  2. The subscriptionName is used as a key identifier, so it needs to be unique for global subscriptions as well as unique within a private-scoped group of subscriptions. The description parameter is for documentation purposes, so its content should be as descriptive as possible to indicate the purpose of the subscription.

    See Example: Defining the Subscription.

  3. Property Filter—Specify propertyReferences to filter the recommendation systems you are interested in receiving based on recommendation fields.

    This feature is similar to the Recommendation Filter Menu from the Densify Console, where you can filter recommendation systems based on the selected fields from the menu. In the propertyReferences filter condition, fields are selected by referencing property elements from the platform-specific Subscriptions Properties catalog. The platform of properties you reference must correspond with the platform of your subscription. Refer to Subscriptions Properties Catalogs for details on referencing properties.

    See Example: Specifying Property Filters for an example of a property filter condition block in a POST /subscriptions/<platformType> request.

  4. Tag Filter—Specify tagReferences to filter the recommendation systems you are interested in receiving based on attribute fields.

    This feature is similar to the Guest Filter from the Densify Console, but it also extends to filter platform-specific attribute tags. In the tagReferences filter condition, attributes are selected by referencing tag elements from the platform-specific Subscriptions Tags catalog. The platform of tags you reference must correspond with the platform of your subscription. Refer to Subscriptions Tags Catalogs for details.

    Note: You must ensure that the selected Densify attributes are marked as searchable for use with DSS. Contact Densify support (support@Densify.com) to confirm that the selected attributes are searchable in your Densify instance.

    See Example: Specifying Tag Filters for an example of a tag filter condition block in a POST /subscriptions/<platformType> request.

  5. Suppress Filter—Specify the suppressionReferences condition to suppress recommendation systems you are not interested in receiving based on recommendation or attribute fields.

    This feature allows you to suppress groups of recommendation systems for a period of time when the notification is actively scheduled. Suppression conditions are created by referencing suppression elements from the platform-specific Subscriptions Suppressions catalog. The platform of suppressions you reference must correspond with the platform of your subscription. Refer to Subscriptions Suppressions Catalogs for an explanation of referencing the catalog.

    See Example: Specifying Suppression Conditions for an example of a suppression condition block in a POST /subscriptions/<platformType> request.

  6. Return Structure—Specify the returnStructure to personalize the output of the notification.

    If you do not specify the returnStructure parameter in your subscription, all recommendation fields applicable to the platform-specific system are returned. To return specific fields, you can specify elements from the platform-specific Subscriptions Properties Catalogs and Subscriptions Tags Catalogs that are within your scope.

    See Example: Specifying the Return Structure for an example of a returnStructure block in a POST /subscriptions/<platformType> request.

  7. Schedule Notification to Webhook—Specify when and where to send your notification by configuring the schedule parameter and the webhook parameter.

    If you do not specify the schedule parameter, the notification is triggered each night after data collection, analysis, and reporting database update processes. See Example: Specifying the Notification Schedule for an example of specifying a schedule block in a POST /subscriptions/<platformType> request.

    The webhook parameter is mandatory if you want notifications to be triggered. See Example: Specifying the Webhook for an example of specifying a webhook block in a POST /subscriptions/<platformType> request.

    Note: You can test the subscription and request an on-demand results output by using the Subscriptions: Results resource, even if the webhook is not defined.

See Example: Creating a Subscription (Putting It All Together) for a complete example of the POST /subscriptions/<platformType> request with all the combined parameter components; then review the on-demand results of the subscription in Example: Getting On-Demand Results.

Refer to Subscriptions for the complete subscription resource reference.

Subscriptions Properties Catalogs

The platform-specific Subscriptions Properties catalogs are resources that provides you with a list of recommendation fields to use for filtering and for personalizing the notification output. The platform of the Subscriptions Properties catalog you use for filtering must correspond with the platform of your subscription.

By default, the platform-specific Subscriptions Properties catalogs already have a list of recommendation fields for you to use. You can also add additional recommendation fields to the catalogs. The list of possible recommendation fields to add corresponds to the response elements from the Densify supported cloud and container recommendations (see Analysis: AWS Recommendations: Response, Analysis: Azure Recommendations: Response, Analysis: GCP Recommendations: Response, and Analysis: Kubernetes Container Recommendations: Response).

Note: Some recommendation elements are not common to all technologies. For example, propertyName="minGroupRecommended" only applies to AWS Auto Scaling group recommendations.

When you create property filter conditions for your subscription, you need to reference properties from the corresponding platform Subscriptions Properties catalog (see the Subscriptions: propertyReferences parameter). Similarly, you need to reference properties from the corresponding platform Subscriptions Properties catalog to personalize the notification output (see the Subscriptions: returnStructure parameter).

You can only reference properties that are accessible to the Densify username you use to authorize the API request. Property accessibility depends on the scope of the property: if the property is global, then the property is accessible to all API Densify users; if the property is private, then the property is accessible to the owner of the private property. If you are an administrative userClosedAn administrative user is a Densify user in the Administrator user group or with the Analysis Admin role., then you can override the property scope rule and access all properties from the catalog. See Subscriptions: Properties: owner for more property scope details.

Refer to Subscriptions: Properties for the full resource definition.

Subscriptions Tags Catalogs

The platform-specific Subscriptions Tags catalogs are resources that provides you with a list of system attribute fields to use for filtering and for personalizing the notification output. The platform of the Subscriptions Tags catalog you use for filtering must correspond with the platform of your subscription.

By default, the platform-specific Subscriptions Tags catalogs already have a list of common attributes for you to use. You can also add additional attribute fields to the catalogs. The possible attribute fields you can add comes from the set of Densify standard attributes or technology-specific attributes.

When you create tag filter conditions for your subscription, you need to reference tags from the corresponding platform Subscriptions Tags catalog (see the Subscriptions: tagReferences parameter). Similarly, you need to reference tags from the corresponding platform Subscriptions Tags catalog to personalize the notification output (see the returnStructure parameter).

You can only reference tags that are accessible to the Densify username you use to authorize the API request. Access to a particular tag in the catalog depends on its scope: if the tag is global, then the tag is accessible to all API Densify users; if the tag is private, then the tag is accessible to the owner of the private tag. If you are an administrative userClosedAn administrative user is a Densify user in the Administrator user group or with the Analysis Admin role., then you can override the tag scope rule and access all tags from the catalog. See Subscriptions: Tags: owner for additional details of tag scope.

Refer to Subscriptions: Tags for the full resource definition.

Subscriptions Suppressions Catalogs

The platform-specific Subscriptions Suppressions catalogs are resources that provides you with a list of recommendation and system attribute fields to use for creating suppression conditions in your subscription. The platform of the Subscriptions Suppressions catalog you use for suppressing recommendations must correspond with the platform of your subscription.

By default, the platform-specific Subscriptions Suppressions catalog already has a list of recommendation and attribute field suppressions for you to use. You can also add additional suppression fields. The list of possible recommendation fields correspond to the response elements from the Densify supported cloud recommendations (see Analysis: AWS Recommendations: Response, Analysis: Azure Recommendations: Response, Analysis: GCP Recommendations: Response, and Analysis: Kubernetes Container Recommendations: Response). The possible attribute fields you can add to a Subscriptions Suppressions catalog comes from the set of Densify standard attributes or technology-specific attributes.

When you create suppression conditions for your subscription, you need to reference suppressions from the corresponding platform Subscriptions Suppressions catalog (see the Subscriptions: suppressionReferences parameter).

You can only reference suppressions that are accessible to the Densify username you use to authorize the API request. Access to a particular suppression in the catalog depends on its scope: if the suppression is global, then it is accessible to all API Densify users; if the suppression is private, then it is accessible to the owner of the private suppression. If you are an administrative userClosedAn administrative user is a Densify user in the Administrator user group or with the Analysis Admin role., then you can override the suppression scope rule and access all suppressions from the catalog. See Subscriptions: Suppressions: owner for details of suppression scope.

Note: The Subscriptions Suppressions catalogs are not used for a Subscription's return output.

Refer to Subscriptions: Suppressions for the full resource definition.

Example: Defining the Subscription

Use the POST /subscriptions/cloud request to create a cloud subscription. The first set of parameters to specify are the subscriptionName and description, which are free-form strings. The owner parameter is automatically set to your Densify username if you are not an administrative userClosedAn administrative user is a Densify user in the Administrator user group or with the Analysis Admin role.. You can also set the active parameter to indicate if the subscription is dormant or active (the default is active). Remember to specify your active authorization key for each token-based authentication request (see Authorize for details).

Example: Specifying Property Filters

To specify property filter conditions in the POST /subscriptions/<platformType> request, use the propertyReferences parameter. In this example, the property condition filters all AWS EC2s with predicted uptime between 50 -100%. The cloud subscription propertyReferences condition references the propertyID of "serviceType" and "predictedUptime" from the Cloud Subscriptions Properties catalog.

Example: Specifying Tag Filters

To specify tag filter conditions in the POST /subscriptions/<platformType> request, use the tagReferences parameter. In this example, the tag condition filters all systems belonging to the "Sales" department. The cloud subscription tagReferences condition references the tagID of "Department" from the Cloud Subscriptions Tags catalog.

Example: Specifying Suppression Conditions

To specify suppression conditions in the POST /subscriptions/<platformType> request, use the suppressionReferences parameter. In this example, the cloud suppression condition removes all terminate recommendations until April 20, 2020. After April 20, 2020 (the revokeBy date), the suppression condition is deprecated. The cloud subscription suppressionReferences condition references the suppressionID of "recommendationType" from the Cloud Subscriptions Suppressions catalog.

Example: Specifying the Return Structure

To specify a customized return structure in the POST /subscriptions/<platformType> request, use the returnStructure parameter. In this example, the return output will contain the following cloud fields: effortEstimate, entityId, name, recommendationType, savingsEstimate, serviceType, Department (attribute), Virtual Domain ("account"). These fields reference the propertyID and "tagID" from the Cloud Subscriptions Properties catalog and the Cloud Subscriptions Tags catalog, respectively. Some of these property or tag fields have the "useAlias" flag set to true, which returns the alias names instead of the property or tag names.

Example: Specifying the Webhook

For the destination of the notification, specify the webhook parameter in the POST /subscriptions/<platformType> request. If you do not specify a webhook, no subscription notifications are triggered; the subscription is considered dormant since there is no destination for the notification. You can test the subscription and request an on-demand results output by using the Subscriptions: Results resource, even if the subscription is dormant or if the webhook is not defined.

Example: Specifying the Notification Schedule

To specify a notification schedule in the POST /subscriptions/<platformType> request, use the schedule parameter. In the example below, the cloud subscription is scheduled to be triggered on Mondays and Fridays of each week (dayofWeek 1 = Monday). If you do not specify the schedule parameter, the subscription notifications are triggered nightly by default.

Example: Creating a Subscription (Putting It All Together)

This example puts all the subscription components (from the previous examples) together to create a cloud subscription.

Example: Getting On-Demand Results

This example retrieves the cloud subscription (created from the previous example) results on-demand. This request returns the cloud subscription results regardless of what is configured in the webhook, schedule, or active parameters.

Postman Collection

Examples of Densify API request for this use case can be found in the following Postman collection:

Download the Densify Public Cloud Postman Collection (v 12.1.7)

Follow the steps below to use the downloaded Postman collection:

  1. Unzip the downloaded file and import it into your Postman application. The Densify API Collection (12.1.7) collection and Densify environment are loaded into your Postman workspace.
  2. Modify the variables in the Densify environment to match your Densify and cloud-specific settings and credentials.
  3. Note: If you already have a previous Densify environment in your Postman application, you can either delete the previous version or rename it. Otherwise, you will have duplicate Densify environments after the new collection is imported.

  4. Review the Documentation section of the collection for an overview of the workflow and API requests.

Use this sample collection to familiarize yourself with Densify API requests.