Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 32 additions & 16 deletions bin/generate-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ function createUpdateExample(serviceName, resourceName, resourceData, thisSchema

return `\n## ${mdCodeAnchor}UPDATE${mdCodeAnchor} example

Use the following StackQL query and manifest file to update a <code>${pluralize.singular(resourceName)}</code> resource, using [__${mdCodeAnchor}stack-deploy${mdCodeAnchor}__](https://pypi.org/project/stack-deploy/).

${sqlCodeBlockStart}
/*+ update */
UPDATE ${providerName}.${serviceName}.${resourceName}
Expand Down Expand Up @@ -583,13 +585,10 @@ function createResourceIndexContent(serviceName, resourceName, resourceType, res
permissionsHeadingMarkdown = schema?.['x-required-permissions'] ? '## Permissions\n' : '';
permissionsBylineMarkdown = schema?.['x-required-permissions'] ? `To operate on the <code>${resourceName}</code> resource, the following permissions are required:\n` : '';

permissionsMarkdown = Object.entries(schema?.['x-required-permissions'] ?? {})
const permissionTabs = Object.entries(schema?.['x-required-permissions'] ?? {})
.map(([permissionType, permissions]) => {
// Define which permission types to include based on the isPlural flag.

const includedTypes = ['create', 'list', 'delete', 'read', 'update'];

// Check if the current permissionType is in the includedTypes array.
if (includedTypes.includes(permissionType)) {
// update flags
if (permissionType === 'list') {
Expand All @@ -598,29 +597,46 @@ function createResourceIndexContent(serviceName, resourceName, resourceType, res
if (permissionType === 'read') {
hasGet = true;
}

if(!hasList && !hasGet){
isSelectable = false;
}

// If it is, format the permissions as before.
const sectionTitle = `### ${permissionType.charAt(0).toUpperCase() + permissionType.slice(1)}\n${jsonCodeBlockStart}\n`;
const permissionsList = permissions.join(",\n");
const sectionEnd = `\n${codeBlockEnd}\n`;

if (permissions.length === 0) {
return null;
}

return `${sectionTitle}${permissionsList}${sectionEnd}`;

const label = permissionType.charAt(0).toUpperCase() + permissionType.slice(1);
const permissionsList = permissions.join(",\n");

return { value: permissionType, label, permissionsList };
} else {
// If it's not, return an empty string (or null, which will be filtered out).
return null;
}
})
// Filter out the null entries resulting from excluded permissionTypes.
.filter(section => section !== null)
.join('\n');
.filter(section => section !== null);

if (permissionTabs.length > 0) {
const tabValues = permissionTabs.map(t => ` { label: '${t.label}', value: '${t.value}', },`).join('\n');
const tabItems = permissionTabs.map(t => `<TabItem value="${t.value}">

${jsonCodeBlockStart}
${t.permissionsList}
${codeBlockEnd}

</TabItem>`).join('\n');

permissionsMarkdown = `<Tabs
defaultValue="${permissionTabs[0].value}"
values={[
${tabValues}
]
}>
${tabItems}
</Tabs>`;
} else {
permissionsMarkdown = '';
}

// covers non select ops for cc resources
sqlVerbsList = Object.entries(resourceData.sqlVerbs).map(([key, value]) => {
Expand Down
34 changes: 29 additions & 5 deletions website/docs/services/accessanalyzer/analyzers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ resources:

## `UPDATE` example

Use the following StackQL query and manifest file to update a <code>analyzer</code> resource, using [__`stack-deploy`__](https://pypi.org/project/stack-deploy/).

```sql
/*+ update */
UPDATE awscc.accessanalyzer.analyzers
Expand All @@ -408,7 +410,18 @@ AND region = 'us-east-1';

To operate on the <code>analyzers</code> resource, the following permissions are required:

### Create
<Tabs
defaultValue="create"
values={[
{ label: 'Create', value: 'create', },
{ label: 'Read', value: 'read', },
{ label: 'Update', value: 'update', },
{ label: 'Delete', value: 'delete', },
{ label: 'List', value: 'list', },
]
}>
<TabItem value="create">

```json
access-analyzer:CreateAnalyzer,
access-analyzer:TagResource,
Expand All @@ -417,14 +430,18 @@ organizations:ListAWSServiceAccessForOrganization,
organizations:ListDelegatedAdministrators
```

### Read
</TabItem>
<TabItem value="read">

```json
access-analyzer:ListAnalyzers,
access-analyzer:GetAnalyzer,
access-analyzer:ListArchiveRules
```

### Update
</TabItem>
<TabItem value="update">

```json
access-analyzer:CreateArchiveRule,
access-analyzer:DeleteArchiveRule,
Expand All @@ -435,12 +452,19 @@ access-analyzer:UpdateAnalyzer,
access-analyzer:UpdateArchiveRule
```

### Delete
</TabItem>
<TabItem value="delete">

```json
access-analyzer:DeleteAnalyzer
```

### List
</TabItem>
<TabItem value="list">

```json
access-analyzer:ListAnalyzers
```

</TabItem>
</Tabs>
34 changes: 29 additions & 5 deletions website/docs/services/acmpca/certificate_authorities/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ resources:

## `UPDATE` example

Use the following StackQL query and manifest file to update a <code>certificate_authority</code> resource, using [__`stack-deploy`__](https://pypi.org/project/stack-deploy/).

```sql
/*+ update */
UPDATE awscc.acmpca.certificate_authorities
Expand All @@ -687,38 +689,60 @@ AND region = 'us-east-1';

To operate on the <code>certificate_authorities</code> resource, the following permissions are required:

### Create
<Tabs
defaultValue="create"
values={[
{ label: 'Create', value: 'create', },
{ label: 'Read', value: 'read', },
{ label: 'Update', value: 'update', },
{ label: 'Delete', value: 'delete', },
{ label: 'List', value: 'list', },
]
}>
<TabItem value="create">

```json
acm-pca:CreateCertificateAuthority,
acm-pca:DescribeCertificateAuthority,
acm-pca:GetCertificateAuthorityCsr,
acm-pca:TagCertificateAuthority
```

### Read
</TabItem>
<TabItem value="read">

```json
acm-pca:DescribeCertificateAuthority,
acm-pca:GetCertificateAuthorityCsr,
acm-pca:ListTags
```

### Update
</TabItem>
<TabItem value="update">

```json
acm-pca:TagCertificateAuthority,
acm-pca:UntagCertificateAuthority,
acm-pca:UpdateCertificateAuthority
```

### Delete
</TabItem>
<TabItem value="delete">

```json
acm-pca:DeleteCertificateAuthority,
acm-pca:DescribeCertificateAuthority
```

### List
</TabItem>
<TabItem value="list">

```json
acm-pca:DescribeCertificateAuthority,
acm-pca:GetCertificateAuthorityCsr,
acm-pca:ListCertificateAuthorities,
acm-pca:ListTags
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ resources:

## `UPDATE` example

Use the following StackQL query and manifest file to update a <code>certificate_authority_activation</code> resource, using [__`stack-deploy`__](https://pypi.org/project/stack-deploy/).

```sql
/*+ update */
UPDATE awscc.acmpca.certificate_authority_activations
Expand All @@ -216,25 +218,44 @@ AND region = 'us-east-1';

To operate on the <code>certificate_authority_activations</code> resource, the following permissions are required:

### Create
<Tabs
defaultValue="create"
values={[
{ label: 'Create', value: 'create', },
{ label: 'Read', value: 'read', },
{ label: 'Delete', value: 'delete', },
{ label: 'Update', value: 'update', },
]
}>
<TabItem value="create">

```json
acm-pca:ImportCertificateAuthorityCertificate,
acm-pca:UpdateCertificateAuthority
```

### Read
</TabItem>
<TabItem value="read">

```json
acm-pca:GetCertificateAuthorityCertificate,
acm-pca:DescribeCertificateAuthority
```

### Delete
</TabItem>
<TabItem value="delete">

```json
acm-pca:UpdateCertificateAuthority
```

### Update
</TabItem>
<TabItem value="update">

```json
acm-pca:ImportCertificateAuthorityCertificate,
acm-pca:UpdateCertificateAuthority
```

</TabItem>
</Tabs>
22 changes: 19 additions & 3 deletions website/docs/services/acmpca/certificates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,34 @@ AND region = 'us-east-1';

To operate on the <code>certificates</code> resource, the following permissions are required:

### Create
<Tabs
defaultValue="create"
values={[
{ label: 'Create', value: 'create', },
{ label: 'Read', value: 'read', },
{ label: 'Delete', value: 'delete', },
]
}>
<TabItem value="create">

```json
acm-pca:IssueCertificate,
acm-pca:GetCertificate
```

### Read
</TabItem>
<TabItem value="read">

```json
acm-pca:GetCertificate
```

### Delete
</TabItem>
<TabItem value="delete">

```json
acm-pca:GetCertificate
```

</TabItem>
</Tabs>
22 changes: 19 additions & 3 deletions website/docs/services/acmpca/permissions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,34 @@ AND region = 'us-east-1';

To operate on the <code>permissions</code> resource, the following permissions are required:

### Create
<Tabs
defaultValue="create"
values={[
{ label: 'Create', value: 'create', },
{ label: 'Read', value: 'read', },
{ label: 'Delete', value: 'delete', },
]
}>
<TabItem value="create">

```json
acm-pca:CreatePermission,
acm-pca:ListPermissions
```

### Read
</TabItem>
<TabItem value="read">

```json
acm-pca:ListPermissions
```

### Delete
</TabItem>
<TabItem value="delete">

```json
acm-pca:DeletePermission
```

</TabItem>
</Tabs>
Loading