azure_data_lake_storage_gen2_path Resource
Use the azure_data_lake_storage_gen2_path
InSpec audit resource to test the properties related to Azure Data Lake Storage Gen2 Filesystem.
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, this resource uses the latest version.
For more information, refer to the azure_generic_resource
document.
Unless defined, this resource uses the azure_cloud
global endpoint and default values for the HTTP client.
For more information, refer to the resource pack README.
Installation
This resource is available in the Chef InSpec Azure resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your Azure environment for InSpec and creating an InSpec profile that uses the InSpec Azure resource pack.
Syntax
describe azure_data_lake_storage_gen2_path(account_name: 'ACCOUNT_NAME', filesystem: 'FILE_SYSTEM', name: 'PATHNAME') do
it { should exist }
end
describe azure_data_lake_storage_gen2_path(account_name: 'ACCOUNT_NAME', filesystem: 'FILE_SYSTEM', name: 'PATH') do
it { should exist }
end
Parameters
filesystem
(required)- The filesystem identifier.
account_name
(required)- Azure Storage Account Name.
name
(required)- The file or directory path.
dns_suffix
(optional)- The DNS suffix for the Azure Data Lake Storage endpoint.
Properties
last_modified
- Last Modified Timestamp of the resource.
etag
- HTTP strong entity tag value.
x_ms_properties
- Properties of the filesystem.
x_ms_request_id
- Request ID.
x_ms_version
- Version of the API.
date
- Date String of the request.
content_length
- Content Length of the file.
content_type
- Content Type.
content_md5
- MD5 of the Content uploaded.
accept_ranges
- File size described measurement.
bytes
. x_ms_resource_type
- Resource Type of the uploaded.
file
. x_ms_lease_state
- If the file is available or not.
x_ms_lease_status
- Status of lease.
x_ms_server_encrypted
- If the file is encrypted on the server.
For properties applicable to all resources, such as type
, name
, id
, and properties
, refer to azure_generic_resource
.
Also, refer to Azure documentation for other properties available.
Examples
Test that the Data Lake Storage Gen 2 Filesystem Path is server encrypted.
describe azure_data_lake_storage_gen2_path(account_name: 'ACCOUNT_NAME', filesystem: 'FILE_SYSTEM', name: 'PATHNAME') do
its('x_ms_server_encrypted') { should eq 'true' }
end
Matchers
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.
exists
# If the Data Lake Storage Gen 2 Filesystem is found, it will exist
describe azure_data_lake_storage_gen2_path(account_name: 'ACCOUNT_NAME', filesystem: 'FILE_SYSTEM', name: 'PATHNAME') do
it { should exist }
end
# if the Data Lake Storage Gen 2 Filesystem is not found, it will not exist
describe azure_data_lake_storage_gen2_path(account_name: 'ACCOUNT_NAME', filesystem: 'FILE_SYSTEM', name: 'PATHNAME') do
it { should_not exist }
end
Azure Permissions
Your Service Principal must be set up with a contributor
role on the subscription and Storage Blob Data Contributor
role on the ADLS Gen2 Storage Account you wish to test.