@gradientedge/cdk-utils 9.66.0 → 9.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib/azure/common/constants.js +1 -1
- package/dist/src/lib/azure/services/storage/main.d.ts +8 -15
- package/dist/src/lib/azure/services/storage/main.js +14 -19
- package/dist/src/lib/azure/services/storage/types.d.ts +3 -5
- package/package.json +4 -4
- package/src/lib/azure/common/constants.ts +1 -1
- package/src/lib/azure/services/storage/main.ts +23 -28
- package/src/lib/azure/services/storage/types.ts +5 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StorageAccount } from '@cdktf/provider-azurerm/lib/storage-account';
|
|
2
2
|
import { StorageBlob } from '@cdktf/provider-azurerm/lib/storage-blob';
|
|
3
3
|
import { StorageContainer } from '@cdktf/provider-azurerm/lib/storage-container';
|
|
4
|
-
import { CommonAzureConstruct } from '../../common';
|
|
5
|
-
import { StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types';
|
|
6
4
|
import { DataAzurermStorageAccountBlobContainerSas } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas';
|
|
5
|
+
import { CommonAzureConstruct } from '../../common';
|
|
6
|
+
import { StorageAccountProps, StorageBlobProps, StorageContainerProps, DataAzurermStorageAccountBlobContainerSasProps } from './types';
|
|
7
7
|
/**
|
|
8
8
|
* @classdesc Provides operations on Azure Storage
|
|
9
9
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -55,23 +55,16 @@ export declare class AzureStorageManager {
|
|
|
55
55
|
*
|
|
56
56
|
* @param id - Unique scoped identifier for the SAS token resource
|
|
57
57
|
* @param scope - CDKTF construct scope in which the resource will be created
|
|
58
|
-
* @param props -
|
|
59
|
-
* -
|
|
60
|
-
* - storageContainerName: The name of the container within the storage account
|
|
61
|
-
* - resourceGroupName: The name of the resource group containing the storage account
|
|
62
|
-
* - sasStart: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
58
|
+
* @param props - SAS options:
|
|
59
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
63
60
|
* To avoid diffs on every deploy, it is recommended to supply a fixed value.
|
|
64
|
-
* -
|
|
61
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
|
|
62
|
+
* @param storageAccount
|
|
63
|
+
* @param storageContainer
|
|
65
64
|
*
|
|
66
65
|
* @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
|
|
67
66
|
*
|
|
68
67
|
* @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
|
|
69
68
|
*/
|
|
70
|
-
generateContainerSasToken(id: string, scope: CommonAzureConstruct, props:
|
|
71
|
-
storageAccountName: string;
|
|
72
|
-
storageContainerName: string;
|
|
73
|
-
resourceGroupName: string;
|
|
74
|
-
sasStart?: string;
|
|
75
|
-
sasExpiry?: string;
|
|
76
|
-
}): DataAzurermStorageAccountBlobContainerSas;
|
|
69
|
+
generateContainerSasToken(id: string, scope: CommonAzureConstruct, props: DataAzurermStorageAccountBlobContainerSasProps, storageAccount: StorageAccount, storageContainer?: StorageContainer): DataAzurermStorageAccountBlobContainerSas;
|
|
77
70
|
}
|
|
@@ -7,8 +7,8 @@ const data_azurerm_storage_container_1 = require("@cdktf/provider-azurerm/lib/da
|
|
|
7
7
|
const storage_account_1 = require("@cdktf/provider-azurerm/lib/storage-account");
|
|
8
8
|
const storage_blob_1 = require("@cdktf/provider-azurerm/lib/storage-blob");
|
|
9
9
|
const storage_container_1 = require("@cdktf/provider-azurerm/lib/storage-container");
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
10
|
const data_azurerm_storage_account_blob_container_sas_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
12
|
/**
|
|
13
13
|
* @classdesc Provides operations on Azure Storage
|
|
14
14
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -127,30 +127,25 @@ class AzureStorageManager {
|
|
|
127
127
|
*
|
|
128
128
|
* @param id - Unique scoped identifier for the SAS token resource
|
|
129
129
|
* @param scope - CDKTF construct scope in which the resource will be created
|
|
130
|
-
* @param props -
|
|
131
|
-
* -
|
|
132
|
-
* - storageContainerName: The name of the container within the storage account
|
|
133
|
-
* - resourceGroupName: The name of the resource group containing the storage account
|
|
134
|
-
* - sasStart: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
130
|
+
* @param props - SAS options:
|
|
131
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
135
132
|
* To avoid diffs on every deploy, it is recommended to supply a fixed value.
|
|
136
|
-
* -
|
|
133
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
|
|
134
|
+
* @param storageAccount
|
|
135
|
+
* @param storageContainer
|
|
137
136
|
*
|
|
138
137
|
* @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
|
|
139
138
|
*
|
|
140
139
|
* @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
|
|
141
140
|
*/
|
|
142
|
-
generateContainerSasToken(id, scope, props) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
httpsOnly: true,
|
|
151
|
-
start: props.sasStart ?? new Date().toISOString().split('T')[0],
|
|
152
|
-
expiry: props.sasExpiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
153
|
-
permissions: {
|
|
141
|
+
generateContainerSasToken(id, scope, props, storageAccount, storageContainer) {
|
|
142
|
+
const containerSas = new data_azurerm_storage_account_blob_container_sas_1.DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sc-sas`, {
|
|
143
|
+
connectionString: storageAccount.primaryConnectionString,
|
|
144
|
+
containerName: props.containerName ?? storageContainer?.name,
|
|
145
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
146
|
+
start: props.start ?? new Date().toISOString().split('T')[0],
|
|
147
|
+
expiry: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
148
|
+
permissions: props.permissions ?? {
|
|
154
149
|
read: true,
|
|
155
150
|
add: false,
|
|
156
151
|
create: false,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { StorageAccountConfig } from '@cdktf/provider-azurerm/lib/storage-account';
|
|
2
2
|
import { StorageBlobConfig } from '@cdktf/provider-azurerm/lib/storage-blob';
|
|
3
3
|
import { StorageContainerConfig } from '@cdktf/provider-azurerm/lib/storage-container';
|
|
4
|
+
import { DataAzurermStorageAccountBlobContainerSasConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas';
|
|
4
5
|
import { BaseAzureConfigProps } from '../../types';
|
|
5
6
|
export interface StorageAccountProps extends StorageAccountConfig {
|
|
6
7
|
}
|
|
7
8
|
export interface StorageContainerProps extends BaseAzureConfigProps, StorageContainerConfig {
|
|
8
9
|
}
|
|
9
10
|
export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Format: 'YYYY-MM-DD' (e.g., '2025-05-01')
|
|
13
|
-
*/
|
|
14
|
-
sasExpiry?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DataAzurermStorageAccountBlobContainerSasProps extends DataAzurermStorageAccountBlobContainerSasConfig {
|
|
15
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.68.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"@aws-sdk/credential-providers": "^3.817.0",
|
|
55
55
|
"@aws-sdk/types": "^3.804.0",
|
|
56
56
|
"@cdktf/provider-aws": "^19.63.0",
|
|
57
|
-
"@cdktf/provider-azurerm": "^
|
|
58
|
-
"@cdktf/provider-cloudflare": "^
|
|
57
|
+
"@cdktf/provider-azurerm": "^14.4.0",
|
|
58
|
+
"@cdktf/provider-cloudflare": "^13.1.0",
|
|
59
59
|
"@types/lodash": "^4.17.16",
|
|
60
60
|
"@types/node": "^22.15.17",
|
|
61
61
|
"@types/uuid": "^10.0.0",
|
|
62
62
|
"app-root-path": "^3.1.0",
|
|
63
63
|
"aws-cdk-lib": "^2.195.0",
|
|
64
|
-
"cdktf": "^0.
|
|
64
|
+
"cdktf": "^0.21.0",
|
|
65
65
|
"cdktf-local-exec": "^0.5.71",
|
|
66
66
|
"constructs": "^10.4.2",
|
|
67
67
|
"lodash": "^4.17.21",
|
|
@@ -4,10 +4,15 @@ import { DataAzurermStorageContainer } from '@cdktf/provider-azurerm/lib/data-az
|
|
|
4
4
|
import { StorageAccount } from '@cdktf/provider-azurerm/lib/storage-account'
|
|
5
5
|
import { StorageBlob } from '@cdktf/provider-azurerm/lib/storage-blob'
|
|
6
6
|
import { StorageContainer } from '@cdktf/provider-azurerm/lib/storage-container'
|
|
7
|
+
import { DataAzurermStorageAccountBlobContainerSas } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas'
|
|
7
8
|
import { CommonAzureConstruct } from '../../common'
|
|
8
9
|
import { createAzureTfOutput } from '../../utils'
|
|
9
|
-
import {
|
|
10
|
-
|
|
10
|
+
import {
|
|
11
|
+
StorageAccountProps,
|
|
12
|
+
StorageBlobProps,
|
|
13
|
+
StorageContainerProps,
|
|
14
|
+
DataAzurermStorageAccountBlobContainerSasProps,
|
|
15
|
+
} from './types'
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* @classdesc Provides operations on Azure Storage
|
|
@@ -140,13 +145,12 @@ export class AzureStorageManager {
|
|
|
140
145
|
*
|
|
141
146
|
* @param id - Unique scoped identifier for the SAS token resource
|
|
142
147
|
* @param scope - CDKTF construct scope in which the resource will be created
|
|
143
|
-
* @param props -
|
|
144
|
-
* -
|
|
145
|
-
* - storageContainerName: The name of the container within the storage account
|
|
146
|
-
* - resourceGroupName: The name of the resource group containing the storage account
|
|
147
|
-
* - sasStart: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
148
|
+
* @param props - SAS options:
|
|
149
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to today’s date.
|
|
148
150
|
* To avoid diffs on every deploy, it is recommended to supply a fixed value.
|
|
149
|
-
* -
|
|
151
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
|
|
152
|
+
* @param storageAccount
|
|
153
|
+
* @param storageContainer
|
|
150
154
|
*
|
|
151
155
|
* @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
|
|
152
156
|
*
|
|
@@ -155,26 +159,17 @@ export class AzureStorageManager {
|
|
|
155
159
|
public generateContainerSasToken(
|
|
156
160
|
id: string,
|
|
157
161
|
scope: CommonAzureConstruct,
|
|
158
|
-
props:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
const containerSas = new DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sas`, {
|
|
172
|
-
connectionString: storageAccountLookup.primaryConnectionString,
|
|
173
|
-
containerName: props.storageContainerName,
|
|
174
|
-
httpsOnly: true,
|
|
175
|
-
start: props.sasStart ?? new Date().toISOString().split('T')[0],
|
|
176
|
-
expiry: props.sasExpiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
177
|
-
permissions: {
|
|
162
|
+
props: DataAzurermStorageAccountBlobContainerSasProps,
|
|
163
|
+
storageAccount: StorageAccount,
|
|
164
|
+
storageContainer?: StorageContainer
|
|
165
|
+
) {
|
|
166
|
+
const containerSas = new DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sc-sas`, {
|
|
167
|
+
connectionString: storageAccount.primaryConnectionString,
|
|
168
|
+
containerName: props.containerName ?? storageContainer?.name,
|
|
169
|
+
httpsOnly: props.httpsOnly ?? true,
|
|
170
|
+
start: props.start ?? new Date().toISOString().split('T')[0],
|
|
171
|
+
expiry: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
172
|
+
permissions: props.permissions ?? {
|
|
178
173
|
read: true,
|
|
179
174
|
add: false,
|
|
180
175
|
create: false,
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { StorageAccountConfig } from '@cdktf/provider-azurerm/lib/storage-account'
|
|
2
2
|
import { StorageBlobConfig } from '@cdktf/provider-azurerm/lib/storage-blob'
|
|
3
3
|
import { StorageContainerConfig } from '@cdktf/provider-azurerm/lib/storage-container'
|
|
4
|
+
import { DataAzurermStorageAccountBlobContainerSasConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas'
|
|
4
5
|
import { BaseAzureConfigProps } from '../../types'
|
|
5
6
|
|
|
6
7
|
export interface StorageAccountProps extends StorageAccountConfig {}
|
|
7
8
|
|
|
8
9
|
export interface StorageContainerProps extends BaseAzureConfigProps, StorageContainerConfig {}
|
|
9
10
|
|
|
10
|
-
export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
sasExpiry?: string
|
|
16
|
-
}
|
|
11
|
+
export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {}
|
|
12
|
+
|
|
13
|
+
export interface DataAzurermStorageAccountBlobContainerSasProps
|
|
14
|
+
extends DataAzurermStorageAccountBlobContainerSasConfig {}
|