From 6ad99fc39b5a3181cb4a5985819fc12e31f0d779 Mon Sep 17 00:00:00 2001 From: kt Date: Mon, 19 Mar 2018 00:31:31 -0700 Subject: [PATCH] Updated the azurerm_scheduler_job_collection data source with requested changes --- .../data_source_scheduler_job_collection.go | 20 ++++++++++++++++++- .../d/scheduler_job_collection.html.markdown | 14 ++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/azurerm/data_source_scheduler_job_collection.go b/azurerm/data_source_scheduler_job_collection.go index dd18506c5a66..ce1bfe1ef8fc 100644 --- a/azurerm/data_source_scheduler_job_collection.go +++ b/azurerm/data_source_scheduler_job_collection.go @@ -86,5 +86,23 @@ func dataSourceArmSchedulerJobCollectionRead(d *schema.ResourceData, meta interf d.SetId(*collection.ID) - return resourceArmSchedulerJobCollectionPopulate(d, resourceGroup, &collection) + //standard properties + d.Set("name", collection.Name) + d.Set("location", azureRMNormalizeLocation(*collection.Location)) + d.Set("resource_group_name", resourceGroup) + flattenAndSetTags(d, collection.Tags) + + //resource specific + if properties := collection.Properties; properties != nil { + if sku := properties.Sku; sku != nil { + d.Set("sku", sku.Name) + } + d.Set("state", string(properties.State)) + + if err := d.Set("quota", flattenAzureArmSchedulerJobCollectionQuota(properties.Quota)); err != nil { + return fmt.Errorf("Error flattening quota for Job Collection %q (Resource Group %q): %+v", collection.Name, resourceGroup, err) + } + } + + return nil } diff --git a/website/docs/d/scheduler_job_collection.html.markdown b/website/docs/d/scheduler_job_collection.html.markdown index 3fdb1cdbd122..83727ba78864 100644 --- a/website/docs/d/scheduler_job_collection.html.markdown +++ b/website/docs/d/scheduler_job_collection.html.markdown @@ -3,7 +3,7 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_scheduler_job_collection" sidebar_current: "docs-azurerm-datasource-scheduler_job_collection" description: |- - Get information about the specified schelduer job collection. + Get information about the specified scheduler job collection. --- # Data Source: azurerm_scheduler_job_collection @@ -27,9 +27,9 @@ output "job_collection_state" { The following arguments are supported: -* `name` - (Required) Specifies the name of the Scheduler Job Collection. Changing this forces a new resource to be created. +* `name` - (Required) Specifies the name of the Scheduler Job Collection. -* `resource_group_name` - (Required) The name of the resource group in which to create the Scheduler Job Collection. Changing this forces a new resource to be created. +* `resource_group_name` - (Required) Specifies the name of the resource group in which the Scheduler Job Collection resides. ## Attributes Reference @@ -39,11 +39,11 @@ The following attributes are exported: * `location` - The Azure location where the resource exists. -* `tags` - A mapping of tags to assign to the resource. +* `tags` - A mapping of tags assigned to the resource. -* `sku` - The Job Collection's pricing level's SKU. Possible values include: `Standard`, `Free`, `P10Premium`, `P20Premium`. +* `sku` - The Job Collection's pricing level's SKU. -* `state` - The Job Collection's state. Possible values include: `Enabled`, `Disabled`, `Suspended`. +* `state` - The Job Collection's state. * `quota` - The Job collection quotas as documented in the `quota` block below. @@ -51,6 +51,6 @@ The `quota` block supports: * `max_job_count` - Sets the maximum number of jobs in the collection. -* `max_recurrence_frequency` - The maximum frequency of recurrence. Possible values include: `Minute`, `Hour`, `Day`, `Week`, `Month` +* `max_recurrence_frequency` - The maximum frequency of recurrence. * `max_retry_interval` - The maximum interval between retries.