Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>
  • Loading branch information
dkumaras committed Sep 9, 2021
1 parent 9b58f9c commit 9087c63
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 49 deletions.
47 changes: 21 additions & 26 deletions docs/resources/azure_migrate_project_solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,38 @@ platform: azure

# azure_migrate_project_solution

Use the `azure_migrate_project_solution` InSpec audit resource to test properties related to an Azure Migrate Project Solution.
Use the `azure_migrate_project_solution` InSpec audit resource to test the properties related to an Azure Migrate Project Solution.

## Azure REST API version, endpoint and http client parameters
## 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).
This resource interacts with API versions supported by the resource provider. The `api_version` is defined as a resource parameter. If not provided, the latest version is 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).
Unless defined, `azure_cloud` global endpoint and default values for the HTTP client is 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).
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` and `resource_group` is a required parameter.

```ruby
describe azure_migrate_project_solution(resource_group: 'migrate_vms', project_name: 'zoneA_migrate_project', name: 'zoneA_machines_migrate_solution') do
describe azure_migrate_project_solution(resource_group: 'MIGRATE_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: 'zoneA_machines_migrate_solution') do
it { should exist }
its('name') { should cmp 'zoneA_machines_migrate_solution' }
its('name') { should cmp 'ZONEA_MACHINES_MIGRATE_SOLUTION' }
its('type') { should cmp 'Microsoft.Migrate/MigrateProjects/Solutions' }
end
```

```ruby
describe azure_migrate_project_solution(resource_group: 'migrate_vms', project_name: 'zoneA_migrate_project', name: 'zoneA_machines_migrate_solution') do
describe azure_migrate_project_solution(resource_group: 'MIGRATE_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: 'zoneA_machines_migrate_solution') do
it { should exist }
end
```

## Parameters

| Name | Description |
Expand All @@ -50,6 +46,7 @@ end
| project_name | Azure Migrate Project. |

The parameter set should be provided for a valid query:

- `resource_group` and `project_name` and `name`

## Properties
Expand All @@ -58,27 +55,25 @@ The parameter set should be provided for a valid query:
|-------------------------------|------------------------------------------------------------------|
| id | Path reference to the Project Solution. |
| name | Unique name of the Project Solution. |
| type | Type of the object. `Microsoft.Migrate/MigrateProjects/Solutions`|
| type | Object type. `Microsoft.Migrate/MigrateProjects/Solutions`|
| eTag | For optimistic concurrency control. |
| properties | Properties of the project Solution. |
| properties.cleanupState | The cleanup state of the solution. |
| properties.details | The details of the solution. |
| properties.summary | The summary of the solution. |
| properties.purpose | The purpose of the solution. |

For properties applicable to all resources, such as `type`, `name`, `id`, and `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties).

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/migrate/projects/solutions/get-solution) for other properties available.
Any attribute in the response may be accessed with the key names separated by dots (`.`).
Also, refer to [Azure documentation](https://docs.microsoft.com/en-us/rest/api/migrate/projects/solutions/get-solution) for other properties available. Any attribute in the response is accessed with the key names separated by dots (`.`).

## Examples

### Test that the Migrate Project Solution is defined for Assessment purpose.
### Test that the Migrate Project Solution is defined for Assessment purpose

```ruby
describe azure_migrate_project_solution(resource_group: 'migrate_vms', project_name: 'zoneA_migrate_project', name: 'zoneA_machines_migrate_solution') do
its('properties.purpose') { should eq 'Assessment' }
describe azure_migrate_project_solution(resource_group: 'MIGRATE_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: 'ZONEA_MACHINES_MIGRATE_SOLUTION') do
its('properties.purpose') { should eq 'ASSESSMENT' }
end
```

Expand All @@ -89,17 +84,17 @@ This InSpec audit resource has the following special matchers. For a full list o
### exists

```ruby
# If a Migrate Project Solution is found it will exist
describe azure_migrate_project_solution(resource_group: 'migrate_vms', project_name: 'zoneA_migrate_project', name: 'zoneA_machines_migrate_solution') do
# If a Migrate Project Solution is found, it will exist
describe azure_migrate_project_solution(resource_group: 'MIGRATE_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: 'ZONEA_MACHINES_MIGRATE_SOLUTION') do
it { should exist }
end

# if Migrate Project Solution are not found it will not exist
describe azure_migrate_project_solution(resource_group: 'migrate_vms', project_name: 'zoneA_migrate_project', name: 'zoneA_machines_migrate_solution') do
# if Migrate Project Solution are not found, it will not exist
describe azure_migrate_project_solution(resource_group: 'MIGRATE_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: 'zoneA_machines_migrate_solution') 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 `contributor` role on the subscription you wish to test.
Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test.
43 changes: 20 additions & 23 deletions docs/resources/azure_migrate_project_solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@ platform: azure

# azure_migrate_project_solutions

Use the `azure_migrate_project_solutions` InSpec audit resource to test properties related to all Azure Migrate Project Solutions within a project.
Use the `azure_migrate_project_solutions` InSpec audit resource to test the properties related to all Azure Migrate Project Solutions within a project.

## Azure REST API version, endpoint and http client parameters
## 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).
This resource interacts with api versions supported by the resource provider. The `api_version` is defined as a resource parameter.
If not provided, the latest version is 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).
Unless defined, `azure_cloud` global endpoint and default values for the HTTP client is 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).
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_migrate_project_solutions` resource block returns all Azure Migrate Project Solutions within a project.

```ruby
describe azure_migrate_project_solutions(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project') do
describe azure_migrate_project_solutions(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT') do
#...
end
```
Expand All @@ -41,6 +37,7 @@ end
| project_name | Azure Migrate Project. |

The parameter set should be provided for a valid query:

- `resource_group` and `project_name`

## Properties
Expand All @@ -52,7 +49,7 @@ The parameter set should be provided for a valid query:
| types | Type of the objects. | `type` |
| eTags | A list of eTags for all the Project Solutions. | `eTag` |
| properties | A list of Properties for all the Project Solutions. | `properties` |
| tools | The tool being used in all the solutions. | `tool` |
| tools | The tool used in all the solutions. | `tool` |
| purposes | The purpose of all the solutions. | `purpose` |
| goals | The goals of all the solutions. | `goal` |
| statuses | The current status of all the solutions. | `status` |
Expand All @@ -67,25 +64,24 @@ The parameter set should be provided for a valid query:
| assessmentCounts | The count of assessments reported by all the solutions. | `assessmentCount`|
| extendedDetails | The extended details reported by all the solutions. | `extendedDetails`|

<superscript>*</superscript> 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). Also for further reference of the properties please refer [Azure Documentation](https://docs.microsoft.com/en-us/rest/api/migrate/projects/solutions/enumerate-solutions)


<superscript>*</superscript> 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).
Also for further reference of the properties please refer [Azure Documentation](https://docs.microsoft.com/en-us/rest/api/migrate/projects/solutions/enumerate-solutions)
## Examples

### Loop through Migrate Project Solutions by their names.
### Loop through Migrate Project Solutions by their names

```ruby
azure_migrate_project_solutions(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project').names.each do |name|
describe azure_migrate_project_solution(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project', name: name) do
azure_migrate_project_solutions(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT').names.each do |name|
describe azure_migrate_project_solution(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT', name: name) do
it { should exist }
end
end
```
### Test that there are Migrate Project Solutions for Assessment purpose.

### Test to ensure the Migrate Project Solutions for Assessment purpose

```ruby
describe azure_migrate_project_solutions(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project').where(purpose: 'Assessment') do
describe azure_migrate_project_solutions(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT').where(purpose: 'Assessment') do
it { should exist }
end
```
Expand All @@ -98,14 +94,15 @@ This InSpec audit resource has the following special matchers. For a full list o

```ruby
# Should not exist if no Migrate Project Solutions are present in the project and in the resource group
describe azure_migrate_project_solutions(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project') do
describe azure_migrate_project_solutions(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT') do
it { should_not exist }
end
# Should exist if the filter returns at least one Migrate Project Solutions in the project and in the resource group
describe azure_migrate_project_solutions(resource_group: 'migrated_vms', project_name: 'zoneA_migrate_project') do
describe azure_migrate_project_solutions(resource_group: 'MIGRATED_VMS', project_name: 'ZONEA_MIGRATE_PROJECT') 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 `contributor` role on the subscription you wish to test.
Your [Service Principal](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal) must be set up with a `contributor` role on the subscription you wish to test.

0 comments on commit 9087c63

Please sign in to comment.