From 9f1a25d5ba2df046ecd606d9b97ea29e799a7115 Mon Sep 17 00:00:00 2001 From: Sathish Date: Mon, 13 Dec 2021 23:53:14 +0530 Subject: [PATCH 1/8] azure service fabric mesh application (s) Signed-off-by: Sathish --- .../azure_service_fabric_mesh_application.rb | 22 +++++++++++++ .../azure_service_fabric_mesh_applications.rb | 33 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 libraries/azure_service_fabric_mesh_application.rb create mode 100644 libraries/azure_service_fabric_mesh_applications.rb diff --git a/libraries/azure_service_fabric_mesh_application.rb b/libraries/azure_service_fabric_mesh_application.rb new file mode 100644 index 000000000..a9de99abd --- /dev/null +++ b/libraries/azure_service_fabric_mesh_application.rb @@ -0,0 +1,22 @@ +require 'azure_generic_resource' + +class AzureServiceFabricMeshApplication < AzureGenericResource + name 'azure_service_fabric_mesh_application' + desc 'Retrieves and verifies the settings of an Azure Service Fabric Mesh Application.' + example <<-EXAMPLE + describe azure_service_fabric_mesh_application(resource_group: 'inspec-def-rg', name: 'fabric-app') do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.ServiceFabricMesh/applications', opts) + super(opts, true) + end + + def to_s + super(AzureServiceFabricMeshApplication) + end +end diff --git a/libraries/azure_service_fabric_mesh_applications.rb b/libraries/azure_service_fabric_mesh_applications.rb new file mode 100644 index 000000000..b0463fd2a --- /dev/null +++ b/libraries/azure_service_fabric_mesh_applications.rb @@ -0,0 +1,33 @@ +require 'azure_generic_resources' + +class AzureServiceFabricMeshApplications < AzureGenericResources + name 'azure_service_fabric_mesh_applications' + desc 'Verifies settings for a collection of Azure Service Fabric Mesh Applications' + example <<-EXAMPLE + describe azure_service_fabric_mesh_applications do + it { should exist } + end + EXAMPLE + + def initialize(opts = {}) + raise ArgumentError, 'Parameters must be provided in an Hash object.' unless opts.is_a?(Hash) + + opts[:resource_provider] = specific_resource_constraint('Microsoft.ServiceFabricMesh/applications', opts) + super(opts, true) + return if failed_resource? + + populate_filter_table_from_response + end + + def to_s + super(AzureServiceFabricMeshApplications) + end + + private + + def populate_table + @resources.each do |resource| + @table << resource.merge(resource[:properties]) + end + end +end From 08f332ad9bb97f8b2a1210e82c84e0214fe92a8f Mon Sep 17 00:00:00 2001 From: Sathish Date: Mon, 13 Dec 2021 23:53:46 +0530 Subject: [PATCH 2/8] unit test azure service fabric mesh application (s) Signed-off-by: Sathish --- ...re_service_fabric_mesh_application_test.rb | 17 +++++++++++++++ ...e_service_fabric_mesh_applications_test.rb | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 test/unit/resources/azure_service_fabric_mesh_application_test.rb create mode 100644 test/unit/resources/azure_service_fabric_mesh_applications_test.rb diff --git a/test/unit/resources/azure_service_fabric_mesh_application_test.rb b/test/unit/resources/azure_service_fabric_mesh_application_test.rb new file mode 100644 index 000000000..f99024b8b --- /dev/null +++ b/test/unit/resources/azure_service_fabric_mesh_application_test.rb @@ -0,0 +1,17 @@ +require_relative 'helper' +require 'azure_service_fabric_mesh_application' + +class AzureServiceFabricMeshApplicationConstructorTest < Minitest::Test + def test_empty_param_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplication.new } + end + + # resource_provider should not be allowed. + def test_resource_provider_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplication.new(resource_provider: 'some_type') } + end + + def test_resource_group_name_alone_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplication.new(resource_group: 'test') } + end +end diff --git a/test/unit/resources/azure_service_fabric_mesh_applications_test.rb b/test/unit/resources/azure_service_fabric_mesh_applications_test.rb new file mode 100644 index 000000000..b899094c8 --- /dev/null +++ b/test/unit/resources/azure_service_fabric_mesh_applications_test.rb @@ -0,0 +1,21 @@ +require_relative 'helper' +require 'azure_service_fabric_mesh_applications' + +class AzureServiceFabricMeshApplicationsConstructorTest < Minitest::Test + # resource_type should not be allowed. + def test_resource_type_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplications.new(resource_provider: 'some_type') } + end + + def tag_value_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplications.new(tag_value: 'some_tag_value') } + end + + def tag_name_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplications.new(tag_name: 'some_tag_name') } + end + + def test_name_not_ok + assert_raises(ArgumentError) { AzureServiceFabricMeshApplications.new(name: 'some_name') } + end +end From 52fd25d88912a1f2fe8241f0018cdba3c4f40f16 Mon Sep 17 00:00:00 2001 From: Sathish Date: Mon, 13 Dec 2021 23:53:54 +0530 Subject: [PATCH 3/8] integral test azure service fabric mesh application (s) Signed-off-by: Sathish --- .../azure_service_fabric_mesh_application.rb | 13 +++++++++++++ .../azure_service_fabric_mesh_applications.rb | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/integration/verify/controls/azure_service_fabric_mesh_application.rb create mode 100644 test/integration/verify/controls/azure_service_fabric_mesh_applications.rb diff --git a/test/integration/verify/controls/azure_service_fabric_mesh_application.rb b/test/integration/verify/controls/azure_service_fabric_mesh_application.rb new file mode 100644 index 000000000..3eb8617c6 --- /dev/null +++ b/test/integration/verify/controls/azure_service_fabric_mesh_application.rb @@ -0,0 +1,13 @@ +resource_group = input(:resource_group, value: '') +location = input(:location, value: '') + +control 'test the properties of an Azure Service Fabric Mesh Application' do + describe azure_service_fabric_mesh_application(resource_group: resource_group, name: 'inspec-fb-mesh-app') do + it { should exist } + its('name') { should eq 'inspec-fb-mesh-app' } + its('properties.status') { should eq 'Ready' } + its('location') { should eq location.downcase.gsub("\s", '') } + its('properties.healthState') { should eq 'healthState' } + its('properties.provisioningState') { should eq 'Succeeded' } + end +end diff --git a/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb b/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb new file mode 100644 index 000000000..d8c8b0bcc --- /dev/null +++ b/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb @@ -0,0 +1,12 @@ +location = input(:location, value: '') + +control 'test the properties of all Azure Service Fabric Mesh Applications' do + describe azure_service_fabric_mesh_applications do + it { should exist } + its('names') { should include 'inspec-fb-mesh-app' } + its('statuses') { should include 'Ready' } + its('locations') { should include location.downcase.gsub("\s", '') } + its('healthStates') { should include 'healthState' } + its('provisioningStates') { should include 'Succeeded' } + end +end From e64fdd711b2f1715bb81bf6059f3123cded9bcaa Mon Sep 17 00:00:00 2001 From: Sathish Date: Mon, 13 Dec 2021 23:54:47 +0530 Subject: [PATCH 4/8] document azure service fabric mesh application (s) Signed-off-by: Sathish --- .../azure_service_fabric_mesh_application.md | 102 ++++++++++++++++++ .../azure_service_fabric_mesh_applications.md | 97 +++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 docs/resources/azure_service_fabric_mesh_application.md create mode 100644 docs/resources/azure_service_fabric_mesh_applications.md diff --git a/docs/resources/azure_service_fabric_mesh_application.md b/docs/resources/azure_service_fabric_mesh_application.md new file mode 100644 index 000000000..77d319d35 --- /dev/null +++ b/docs/resources/azure_service_fabric_mesh_application.md @@ -0,0 +1,102 @@ +--- +title: About the azure_service_fabric_mesh_application Resource +platform: azure +--- + +# azure_service_fabric_mesh_application + +Use the `azure_service_fabric_mesh_application` InSpec audit resource to test properties related to an Azure Service Fabric Mesh Application. + +## Azure REST API version, endpoint and http client parameters + +This resource interacts with api versions supported by the resource provider. +The `api_version` can be defined as a resource parameter. +If not provided, the latest version will be used. +For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. +For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). +For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +`name`, `resource_group` is a required parameter. + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } + its('type') { should eq 'Microsoft.ServiceFabricMesh/applications' } + its('location') { should eq 'eastus' } +end +``` + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } +end +``` +## Parameters + +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| name | Name of the Azure Service Fabric Mesh Applications to test. | +| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | + +The parameter set should be provided for a valid query: +- `resource_group` and `name` + +## Properties + +| Property | Description | +|--------------------------|------------------------------------------------------------------| +| id | Resource Id. | +| name | Resource name. | +| type | Resource type. `Microsoft.ServiceFabricMesh/applications` | +| location | The Geo-location where the resource lives. | +| properties | The properties of the Service Fabric Mesh Application. | +| properties.description | User readable description of the application. | +| properties.debugParams | Internal use. | +| properties.provisioningState | State of the resource. | +| properties.healthState | The health state of a resource such as Application, Service, or Network.| + + +For properties applicable to all resources, such as `type`, `name`, `id`, `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). + +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/servicefabric/sfmeshrp-api-application_get) for other properties available. + +## Examples + +### Test that the Service Fabric Mesh Application is provisioned successfully. + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + its('properties.provisioningState') { should eq 'Succeeded' } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](/inspec/matchers/). + +### exists + +```ruby +# If a Service Fabric Mesh Application is found it will exist +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } +end +# if Service Fabric Mesh Application is not found it will not exist +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should_not exist } +end +``` + +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file diff --git a/docs/resources/azure_service_fabric_mesh_applications.md b/docs/resources/azure_service_fabric_mesh_applications.md new file mode 100644 index 000000000..8087bd209 --- /dev/null +++ b/docs/resources/azure_service_fabric_mesh_applications.md @@ -0,0 +1,97 @@ +--- +title: About the azure_service_fabric_mesh_applications Resource +platform: azure +--- + +# azure_service_fabric_mesh_applications + +Use the `azure_service_fabric_mesh_applications` InSpec audit resource to test properties related to all Azure Service Fabric Mesh Applications. + +## Azure REST API version, endpoint and http client parameters + +This resource interacts with api versions supported by the resource provider. +The `api_version` can be defined as a resource parameter. +If not provided, the latest version will be used. +For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). + +Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. +For more information, refer to the resource pack [README](../../README.md). + +## Availability + +### Installation + +This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). +For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). + +## Syntax + +An `azure_service_fabric_mesh_applications` resource block returns all Azure Service Fabric Mesh Applications. + +```ruby +describe azure_service_fabric_mesh_applications do + #... +end +``` + +## Parameters +| Name | Description | +|----------------|----------------------------------------------------------------------------------| +| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` (Optional) | + +The parameter set optionally be provided for a valid query: +- `resource_group` + +## Properties + +|Property | Description | Filter Criteria* | +|--------------------------------|------------------------------------------------------------------------|------------------| +| ids | A list of resource IDs. | `id` | +| names | A list of resource Names. | `name` | +| types | A list of the resource types. | `type` | +| properties | A list of Properties for all the Service Fabric Mesh Applications. | `properties` | +| locations | A list of the Geo-locations. | `location` | +| provisioningStates | A list of provisioning states of the Service Fabric Mesh Applications. | `provisioningState`| +| healthStates | A list of the health states of a resource such as Application, Service, or Network.| `healthState` | +| serviceNames | A list of the services in the application. | `serviceNames` | + +* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). + +## Examples + +### Loop through Service Fabric Mesh Applications by their names. + +```ruby +azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').names.each do |name| + describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: name) do + it { should exist } + end +end +``` +### Test that there are Service Fabric Mesh Applications that are successfully provisioned. + +```ruby +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').where(provisioningState: 'Succeeded') do + it { should exist } +end +``` + +## Matchers + +This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). + +### exists + +```ruby +# Should not exist if no Service Fabric Mesh Applications are present +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do + it { should_not exist } +end +# Should exist if the filter returns at least one Service Fabric Mesh Applications +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do + it { should exist } +end +``` +## Azure Permissions + +Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file From cf0dd5b8989008a35254cdaf81c1e05a4097a9c0 Mon Sep 17 00:00:00 2001 From: Sathish Date: Mon, 13 Dec 2021 23:59:18 +0530 Subject: [PATCH 5/8] update readme with azure service fabric mesh application (s) Signed-off-by: Sathish --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 19bb73348..71ef68f33 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,8 @@ The following is a list of static resources. - [azure_role_definitions](docs/resources/azure_role_definitions.md) - [azure_security_center_policy](docs/resources/azure_security_center_policy.md) - [azure_security_center_policies](docs/resources/azure_security_center_policies.md) +- [azure_service_fabric_mesh_application](docs/resources/azure_service_fabric_mesh_application.md) +- [azure_service_fabric_mesh_applications](docs/resources/azure_service_fabric_mesh_applications.md) - [azure_sql_database](docs/resources/azure_sql_database.md) - [azure_sql_databases](docs/resources/azure_sql_databases.md) - [azure_sql_server](docs/resources/azure_sql_server.md) From 2c8cf137136b27cbd470cca4b7ae5d48250914f3 Mon Sep 17 00:00:00 2001 From: Soumyodeep Karmakar <63713087+soumyo13@users.noreply.github.com> Date: Wed, 2 Mar 2022 17:26:05 +0530 Subject: [PATCH 6/8] Update test/integration/verify/controls/azure_service_fabric_mesh_application.rb --- .../verify/controls/azure_service_fabric_mesh_application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/verify/controls/azure_service_fabric_mesh_application.rb b/test/integration/verify/controls/azure_service_fabric_mesh_application.rb index 3eb8617c6..77ac4283a 100644 --- a/test/integration/verify/controls/azure_service_fabric_mesh_application.rb +++ b/test/integration/verify/controls/azure_service_fabric_mesh_application.rb @@ -1,7 +1,7 @@ resource_group = input(:resource_group, value: '') location = input(:location, value: '') -control 'test the properties of an Azure Service Fabric Mesh Application' do +skip_control 'test the properties of an Azure Service Fabric Mesh Application' do describe azure_service_fabric_mesh_application(resource_group: resource_group, name: 'inspec-fb-mesh-app') do it { should exist } its('name') { should eq 'inspec-fb-mesh-app' } From 0c5adb3ee4792a6defa8ab6f949c628ca0115bff Mon Sep 17 00:00:00 2001 From: Soumyodeep Karmakar <63713087+soumyo13@users.noreply.github.com> Date: Wed, 2 Mar 2022 17:26:16 +0530 Subject: [PATCH 7/8] Update test/integration/verify/controls/azure_service_fabric_mesh_applications.rb --- .../verify/controls/azure_service_fabric_mesh_applications.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb b/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb index d8c8b0bcc..d8752106a 100644 --- a/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb +++ b/test/integration/verify/controls/azure_service_fabric_mesh_applications.rb @@ -1,6 +1,6 @@ location = input(:location, value: '') -control 'test the properties of all Azure Service Fabric Mesh Applications' do +skip_control 'test the properties of all Azure Service Fabric Mesh Applications' do describe azure_service_fabric_mesh_applications do it { should exist } its('names') { should include 'inspec-fb-mesh-app' } From d8fa1d818a152431d67caa33814d130204917555 Mon Sep 17 00:00:00 2001 From: Ian Maddaus Date: Fri, 11 Mar 2022 13:24:58 -0500 Subject: [PATCH 8/8] Docs edits Signed-off-by: Ian Maddaus --- .../azure_service_fabric_mesh_application.md | 113 ++++++++++++++++ .../azure_service_fabric_mesh_applications.md | 124 ++++++++++++++++++ .../azure_service_fabric_mesh_application.md | 102 -------------- .../azure_service_fabric_mesh_applications.md | 97 -------------- 4 files changed, 237 insertions(+), 199 deletions(-) create mode 100644 docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_application.md create mode 100644 docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_applications.md delete mode 100644 docs/resources/azure_service_fabric_mesh_application.md delete mode 100644 docs/resources/azure_service_fabric_mesh_applications.md diff --git a/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_application.md b/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_application.md new file mode 100644 index 000000000..1661f2747 --- /dev/null +++ b/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_application.md @@ -0,0 +1,113 @@ ++++ +title = "azure_service_fabric_mesh_application Resource" +platform = "azure" +draft = false +gh_repo = "inspec-azure" + +[menu.inspec] +title = "azure_service_fabric_mesh_application" +identifier = "inspec/resources/azure/azure_service_fabric_mesh_application Resource" +parent = "inspec/resources/azure" ++++ + +Use the `azure_service_fabric_mesh_application` InSpec audit resource to test properties of an Azure Service Fabric Mesh application. + +## Azure REST API Version, Endpoint, and HTTP Client Parameters + +{{% inspec_azure_common_parameters %}} + +## Installation + +{{% inspec_azure_install %}} + +## Syntax + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } + its('type') { should eq 'Microsoft.ServiceFabricMesh/applications' } + its('location') { should eq 'eastus' } +end +``` + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } +end +``` + +## Parameters + +`name` _(required)_ +: Name of the Azure Service Fabric Mesh applications to test. + +`resource_group` _(required)_ +: Azure resource group that the targeted resource resides in. `MyResourceGroup`. + + +## Properties + +`id` +: Resource Id. + +`name` +: Resource name. + +`type` +: Resource type. `Microsoft.ServiceFabricMesh/applications`. + +`location` +: The Geo-location where the resource lives. + +`properties` +: The properties of the Service Fabric Mesh application. + +`properties.description` +: User readable description of the application. + +`properties.debugParams` +: Internal use. + +`properties.provisioningState` +: State of the resource. + +`properties.healthState` +: The health state of a resource such as application, Service, or Network. + + +For properties applicable to all resources, such as `type`, `name`, `id`, `properties`, refer to [`azure_generic_resource`]({{< relref "azure_generic_resource.md#properties" >}}). + +Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/servicefabric/sfmeshrp-api-application_get) for other properties available. + +## Examples + +**Test that the Service Fabric Mesh application is provisioned successfully.** + +```ruby +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + its('properties.provisioningState') { should eq 'Succeeded' } +end +``` + +## Matchers + +{{% inspec_matchers_link %}} + +### exists + +```ruby +# If a Service Fabric Mesh application is found it will exist + +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should exist } +end +# if Service Fabric Mesh application is not found it will not exist + +describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do + it { should_not exist } +end +``` + +## Azure Permissions + +{{% azure_permissions_service_principal role="reader" %}} diff --git a/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_applications.md b/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_applications.md new file mode 100644 index 000000000..cc9b35607 --- /dev/null +++ b/docs-chef-io/content/inspec/resources/azure_service_fabric_mesh_applications.md @@ -0,0 +1,124 @@ ++++ +title = "azure_service_fabric_mesh_applications Resource" +platform = "azure" +draft = false +gh_repo = "inspec-azure" + +[menu.inspec] +title = "azure_service_fabric_mesh_applications" +identifier = "inspec/resources/azure/azure_service_fabric_mesh_applications Resource" +parent = "inspec/resources/azure" ++++ + +Use the `azure_service_fabric_mesh_applications` InSpec audit resource to test properties of all Azure Service Fabric Mesh applications. + +## Azure REST API Version, Endpoint, and HTTP Client Parameters + +{{% inspec_azure_common_parameters %}} + +## Installation + +{{% inspec_azure_install %}} + +## Syntax + +An `azure_service_fabric_mesh_applications` resource block returns all Azure Service Fabric Mesh applications. + +```ruby +describe azure_service_fabric_mesh_applications do + #... +end +``` + +## Parameters + +`resource_group` _(optional)_ +: Azure resource group that the targeted resource resides in. + + +## Properties + +`ids` +: A list of resource IDs. + +: **Field**: `id` + +`names` +: A list of resource Names. + +: **Field**: `name` + +`types` +: A list of the resource types. + +: **Field**: `type` + +`properties` +: A list of Properties for all the Service Fabric Mesh applications. + +: **Field**: `properties` + +`locations` +: A list of the Geo-locations. + +: **Field**: `location` + +`provisioningStates` +: A list of provisioning states of the Service Fabric Mesh applications. + +: **Field**: `provisioningState` + +`healthStates` +: A list of the health states of a resource such as application, Service, or Network. + +: **Field**: `healthState` + +`serviceNames` +: A list of the services in the application. + +: **Field**: `serviceNames` + +{{% inspec_filter_table %}} + +## Examples + +**Loop through Service Fabric Mesh applications by their names.** + +```ruby +azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').names.each do |name| + describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: name) do + it { should exist } + end +end +``` + +**Test that there are Service Fabric Mesh applications that are successfully provisioned.** + +```ruby +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').where(provisioningState: 'Succeeded') do + it { should exist } +end +``` + +## Matchers + +{{% inspec_matchers_link %}} + +### exists + +```ruby +# Should not exist if no Service Fabric Mesh applications are present + +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do + it { should_not exist } +end +# Should exist if the filter returns at least one Service Fabric Mesh applications + +describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do + it { should exist } +end +``` + +## Azure Permissions + +{{% azure_permissions_service_principal role="reader" %}} diff --git a/docs/resources/azure_service_fabric_mesh_application.md b/docs/resources/azure_service_fabric_mesh_application.md deleted file mode 100644 index 77d319d35..000000000 --- a/docs/resources/azure_service_fabric_mesh_application.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: About the azure_service_fabric_mesh_application Resource -platform: azure ---- - -# azure_service_fabric_mesh_application - -Use the `azure_service_fabric_mesh_application` InSpec audit resource to test properties related to an Azure Service Fabric Mesh Application. - -## Azure REST API version, endpoint and http client parameters - -This resource interacts with api versions supported by the resource provider. -The `api_version` can be defined as a resource parameter. -If not provided, the latest version will be used. -For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). - -Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. -For more information, refer to the resource pack [README](../../README.md). - -## Availability - -### Installation - -This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). -For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). - -## Syntax - -`name`, `resource_group` is a required parameter. - -```ruby -describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do - it { should exist } - its('type') { should eq 'Microsoft.ServiceFabricMesh/applications' } - its('location') { should eq 'eastus' } -end -``` - -```ruby -describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do - it { should exist } -end -``` -## Parameters - -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| name | Name of the Azure Service Fabric Mesh Applications to test. | -| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` | - -The parameter set should be provided for a valid query: -- `resource_group` and `name` - -## Properties - -| Property | Description | -|--------------------------|------------------------------------------------------------------| -| id | Resource Id. | -| name | Resource name. | -| type | Resource type. `Microsoft.ServiceFabricMesh/applications` | -| location | The Geo-location where the resource lives. | -| properties | The properties of the Service Fabric Mesh Application. | -| properties.description | User readable description of the application. | -| properties.debugParams | Internal use. | -| properties.provisioningState | State of the resource. | -| properties.healthState | The health state of a resource such as Application, Service, or Network.| - - -For properties applicable to all resources, such as `type`, `name`, `id`, `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties). - -Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/servicefabric/sfmeshrp-api-application_get) for other properties available. - -## Examples - -### Test that the Service Fabric Mesh Application is provisioned successfully. - -```ruby -describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do - its('properties.provisioningState') { should eq 'Succeeded' } -end -``` - -## Matchers - -This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](/inspec/matchers/). - -### exists - -```ruby -# If a Service Fabric Mesh Application is found it will exist -describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do - it { should exist } -end -# if Service Fabric Mesh Application is not found it will not exist -describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: 'SERVICE_FABRIC_MESH_APP_NAME') do - it { should_not exist } -end -``` - -## Azure Permissions - -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file diff --git a/docs/resources/azure_service_fabric_mesh_applications.md b/docs/resources/azure_service_fabric_mesh_applications.md deleted file mode 100644 index 8087bd209..000000000 --- a/docs/resources/azure_service_fabric_mesh_applications.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: About the azure_service_fabric_mesh_applications Resource -platform: azure ---- - -# azure_service_fabric_mesh_applications - -Use the `azure_service_fabric_mesh_applications` InSpec audit resource to test properties related to all Azure Service Fabric Mesh Applications. - -## Azure REST API version, endpoint and http client parameters - -This resource interacts with api versions supported by the resource provider. -The `api_version` can be defined as a resource parameter. -If not provided, the latest version will be used. -For more information, refer to [`azure_generic_resource`](azure_generic_resource.md). - -Unless defined, `azure_cloud` global endpoint, and default values for the http client will be used. -For more information, refer to the resource pack [README](../../README.md). - -## Availability - -### Installation - -This resource is available in the [InSpec Azure resource pack](https://github.com/inspec/inspec-azure). -For an example `inspec.yml` file and how to set up your Azure credentials, refer to resource pack [README](../../README.md#Service-Principal). - -## Syntax - -An `azure_service_fabric_mesh_applications` resource block returns all Azure Service Fabric Mesh Applications. - -```ruby -describe azure_service_fabric_mesh_applications do - #... -end -``` - -## Parameters -| Name | Description | -|----------------|----------------------------------------------------------------------------------| -| resource_group | Azure resource group that the targeted resource resides in. `MyResourceGroup` (Optional) | - -The parameter set optionally be provided for a valid query: -- `resource_group` - -## Properties - -|Property | Description | Filter Criteria* | -|--------------------------------|------------------------------------------------------------------------|------------------| -| ids | A list of resource IDs. | `id` | -| names | A list of resource Names. | `name` | -| types | A list of the resource types. | `type` | -| properties | A list of Properties for all the Service Fabric Mesh Applications. | `properties` | -| locations | A list of the Geo-locations. | `location` | -| provisioningStates | A list of provisioning states of the Service Fabric Mesh Applications. | `provisioningState`| -| healthStates | A list of the health states of a resource such as Application, Service, or Network.| `healthState` | -| serviceNames | A list of the services in the application. | `serviceNames` | - -* For information on how to use filter criteria on plural resources refer to [FilterTable usage](https://github.com/inspec/inspec/blob/master/dev-docs/filtertable-usage.md). - -## Examples - -### Loop through Service Fabric Mesh Applications by their names. - -```ruby -azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').names.each do |name| - describe azure_service_fabric_mesh_application(resource_group: 'RESOURCE_GROUP', name: name) do - it { should exist } - end -end -``` -### Test that there are Service Fabric Mesh Applications that are successfully provisioned. - -```ruby -describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP').where(provisioningState: 'Succeeded') do - it { should exist } -end -``` - -## Matchers - -This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our [Universal Matchers page](https://www.inspec.io/docs/reference/matchers/). - -### exists - -```ruby -# Should not exist if no Service Fabric Mesh Applications are present -describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do - it { should_not exist } -end -# Should exist if the filter returns at least one Service Fabric Mesh Applications -describe azure_service_fabric_mesh_applications(resource_group: 'RESOURCE_GROUP') do - it { should exist } -end -``` -## Azure Permissions - -Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be setup with a `reader` role on the subscription you wish to test. \ No newline at end of file