Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update resource docs for Hugo #642

Merged
merged 2 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
---
title: About the azure_migrate_project_database_instance Resource
platform: azure
---

# azure_migrate_project_database_instance
+++
title = "azure_migrate_project_database_instance Resource"
platform = "azure"
draft = false
gh_repo = "inspec-azure"

[menu.inspec]
title = "azure_migrate_project_database_instance"
identifier = "inspec/resources/azure/azure_migrate_project_database_instance Resource"
parent = "inspec/resources/azure"
+++

Use the `azure_migrate_project_database_instance` InSpec audit resource to test properties of a single Azure Migrate project database instance.

## 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).
## Azure REST API Version, Endpoint, and HTTP Client Parameters

## Availability
{{% inspec_azure_common_parameters %}}

### Installation
## 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).
{{% inspec_azure_install %}}

## Syntax

Expand All @@ -46,47 +42,78 @@ end

`name` _(required)_

Unique name of a database in Azure migration hub.
: Unique name of a database in Azure migration hub.

`resource_group` _(required)_

Name of the Azure Resource Group that migrate project is part of.
: Name of the Azure Resource Group that migrate project is part of.

`project_name` _(required)_

Name of the Azure Migrate project.
: Name of the Azure Migrate project.

## Properties

| Property | Description |
|--------------------------|------------------------------------------------------------------|
| id | Path reference to the Migrate project database instance. |
| name | Unique name of an Migrate project database instance. |
| type | Type of the object. `Microsoft.Migrate/MigrateProjects/Databases`|
| properties | The properties of the machine. |
| properties.discoveryData | The assessment details of the database instance published by various sources. |
| properties.summary | The database instances summary per solution. |
| enqueueTimes | The times the message were enqueued. |
| extendedInfos | The extended properties of the database server. |
| hostNames | The host names of the database servers. |
| instanceIds | The database instance IDs. |
| instanceNames | The database instance names. |
| instanceTypes | The database instance types. |
| instanceVersions | The database instance versions. |
| ipAddresses | The IP addresses of the database server. IP addresses could be IPv4 or IPv6.|
| lastUpdatedTimes | The time of the last modification of the database instance details.|
| portNumbers | The port numbers of the database server. |
| solutionNames | The names of the solution that sent the data. |


For properties applicable to all resources, such as `type`, `name`, `id`, `properties`, refer to [`azure_generic_resource`](azure_generic_resource.md#properties).
`id`
: Path reference to the Migrate project database instance.

`name`
: Unique name of an Migrate project database instance.

`type`
: Type of the object. `Microsoft.Migrate/MigrateProjects/Databases`.

`properties`
: The properties of the machine.

`properties.discoveryData`
: The assessment details of the database instance published by various sources.

`properties.summary`
: The database instances summary per solution.

`enqueueTimes`
: The times the message were enqueued.

`extendedInfos`
: The extended properties of the database server.

`hostNames`
: The host names of the database servers.

`instanceIds`
: The database instance IDs.

`instanceNames`
: The database instance names.

`instanceTypes`
: The database instance types.

`instanceVersions`
: The database instance versions.

`ipAddresses`
: The IP addresses of the database server. IP addresses could be IPv4 or IPv6.

`lastUpdatedTimes`
: The time of the last modification of the database instance details.

`portNumbers`
: The port numbers of the database server.

`solutionNames`
: The names of the solution that sent the data.


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/migrate/projects/databases/get-database) for other properties available.
Any attribute in the response nested within properties may be accessed with the key names separated by dots (`.`) and attributes nested in the assessment data is pluralized and listed as collection.

## Examples

### Test that the Migrate project database instance has a SQL instanceType.
**Test that the Migrate project database instance has a SQL instanceType.**

```ruby
describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
Expand All @@ -102,15 +129,17 @@ This InSpec audit resource has the following special matchers. For a full list o

```ruby
# If a Migrate project database instance is found it will exist

describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_NAME') do
it { should exist }
end
# if Migrate project database instance is not found it will not exist

describe azure_migrate_project_database_instance(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME', name: 'DB_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 `contributor` role on the subscription you wish to test.
{{% azure_permissions_service_principal role="contributor" %}}
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
---
title: About the azure_migrate_project_database_instances Resource
platform: azure
---

# azure_migrate_project_database_instances
+++
title = "azure_migrate_project_database_instances Resource"
platform = "azure"
draft = false
gh_repo = "inspec-azure"

[menu.inspec]
title = "azure_migrate_project_database_instances"
identifier = "inspec/resources/azure/azure_migrate_project_database_instances Resource"
parent = "inspec/resources/azure"
+++

Use the `azure_migrate_project_database_instances` InSpec audit resource to test properties of all Azure Migrate project database instances in a migrate project.

## 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).
## Azure REST API Version, Endpoint, and HTTP Client Parameters

## Availability
{{% inspec_azure_common_parameters %}}

### Installation
## 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).
{{% inspec_azure_install %}}

## Syntax

Expand All @@ -38,39 +34,104 @@ end

`resource_group` _(required)_

Name of the Azure Resource Group that migrate project is part of.
: Name of the Azure Resource Group that migrate project is part of.

`project_name` _(required)_

Name of the Azure Migrate project.
: Name of the Azure Migrate project.

## Properties

|Property | Description | Filter Criteria<superscript>*</superscript> |
|--------------------------------|------------------------------------------------------------------------|------------------|
| ids | Path reference to the project database instances. | `id` |
| names | Unique names for all project database instances. | `name` |
| types | Type of the objects. | `type` |
| properties | A list of properties for all the project database instances. | `properties` |
| discoveryDatas | The assessment details of the database published by various sources. | `assessmentData` |
| summaries | The database instances summaries per solution. | `summary` |
| lastUpdatedTimes | The time of the last modification of the database instance details. | `lastUpdatedTime`|
| enqueueTimes | The times the message were enqueued. | `enqueueTimes` |
| extendedInfos | The extended properties of the database servers. | `extendedInfos` |
| hostNames | The host names of the database servers. | `hostNames` |
| instanceIds | The database instance IDs. | `instanceIds` |
| instanceNames | The database instance names. | `instanceNames` |
| instanceTypes | The database instance types. | `instanceTypes` |
| instanceVersions | The database instance versions. | `instanceVersions`|
| ipAddresses | The IP addresses of the database server. IP addresses could be IPV4 or IPV6.| `ipAddresses` |
| portNumbers | The port numbers of the database server. | `portNumbers` |
| solutionNames | The names of the solution that sent the data. | `solutionNames` |

<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).
`ids`
: Path reference to the project database instances.

: **Field**: `id`

`names`
: Unique names for all project database instances.

: **Field**: `name`

`types`
: Type of the objects.

: **Field**: `type`

`properties`
: A list of properties for all the project database instances.

: **Field**: `properties`

`discoveryDatas`
: The assessment details of the database published by various sources.

: **Field**: `assessmentData`

`summaries`
: The database instances summaries per solution.

: **Field**: `summary`

`lastUpdatedTimes`
: The time of the last modification of the database instance details.

: **Field**: `lastUpdatedTime`

`enqueueTimes`
: The times the message were enqueued.

: **Field**: `enqueueTimes`

`extendedInfos`
: The extended properties of the database servers.

: **Field**: `extendedInfos`

`hostNames`
: The host names of the database servers.

: **Field**: `hostNames`

`instanceIds`
: The database instance IDs.

: **Field**: `instanceIds`

`instanceNames`
: The database instance names.

: **Field**: `instanceNames`

`instanceTypes`
: The database instance types.

: **Field**: `instanceTypes`

`instanceVersions`
: The database instance versions.

: **Field**: `instanceVersions`

`ipAddresses`
: The IP addresses of the database server. IP addresses could be IPV4 or IPV6.

: **Field**: `ipAddresses`

`portNumbers`
: The port numbers of the database server.

: **Field**: `portNumbers`

`solutionNames`
: The names of the solution that sent the data.

: **Field**: `solutionNames`

{{% inspec_filter_table %}}

## Examples

### Loop through Migrate project database instances by their names.
**Loop through Migrate project database instances by their names.**

```ruby
azure_migrate_project_database_instances(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME').names.each do |name|
Expand All @@ -80,7 +141,7 @@ azure_migrate_project_database_instances(resource_group: 'RESOURCE_GROUP', proje
end
```

### Test that there are Migrate project database instances that are of SQL instance types.
**Test that there are Migrate project database instances that are of SQL instance types.**

```ruby
describe azure_migrate_project_database_instances(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME').where{ instanceTypes.include?('SQL') } do
Expand All @@ -96,14 +157,17 @@ This InSpec audit resource has the following special matchers. For a full list o

```ruby
# Should not exist if no Migrate project database instances are present in the project and in the resource group

describe azure_migrate_project_database_instances(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME') do
it { should_not exist }
end
# Should exist if the filter returns at least one Migrate project database instances in the project and in the resource group

describe azure_migrate_project_database_instances(resource_group: 'RESOURCE_GROUP', project_name: 'PROJECT_NAME') 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.
{{% azure_permissions_service_principal role="contributor" %}}