|
| 1 | +import { AccessLevelList } from '../../shared/access-level'; |
| 2 | +import { PolicyStatement, Operator } from '../../shared'; |
| 3 | + |
| 4 | +/** |
| 5 | + * Statement provider for service [elemental-inference](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awselementalinference.html). |
| 6 | + * |
| 7 | + * @param sid [SID](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html) of the statement |
| 8 | + */ |
| 9 | +export class ElementalInference extends PolicyStatement { |
| 10 | + public servicePrefix = 'elemental-inference'; |
| 11 | + |
| 12 | + /** |
| 13 | + * Statement provider for service [elemental-inference](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awselementalinference.html). |
| 14 | + * |
| 15 | + * @param sid [SID](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html) of the statement |
| 16 | + */ |
| 17 | + constructor(sid?: string) { |
| 18 | + super(sid); |
| 19 | + } |
| 20 | + |
| 21 | + /** |
| 22 | + * Grants permission to associate a feed with an AWS resource |
| 23 | + * |
| 24 | + * Access Level: Write |
| 25 | + * |
| 26 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_AssociateFeed.html |
| 27 | + */ |
| 28 | + public toAssociateFeed() { |
| 29 | + return this.to('AssociateFeed'); |
| 30 | + } |
| 31 | + |
| 32 | + /** |
| 33 | + * Grants permission to create a new feed |
| 34 | + * |
| 35 | + * Access Level: Write |
| 36 | + * |
| 37 | + * Possible conditions: |
| 38 | + * - .ifAwsRequestTag() |
| 39 | + * - .ifAwsTagKeys() |
| 40 | + * |
| 41 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_CreateFeed.html |
| 42 | + */ |
| 43 | + public toCreateFeed() { |
| 44 | + return this.to('CreateFeed'); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Grants permission to delete a feed |
| 49 | + * |
| 50 | + * Access Level: Write |
| 51 | + * |
| 52 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_DeleteFeed.html |
| 53 | + */ |
| 54 | + public toDeleteFeed() { |
| 55 | + return this.to('DeleteFeed'); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Grants permission to disassociate a feed from an AWS resource |
| 60 | + * |
| 61 | + * Access Level: Write |
| 62 | + * |
| 63 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_DisassociateFeed.html |
| 64 | + */ |
| 65 | + public toDisassociateFeed() { |
| 66 | + return this.to('DisassociateFeed'); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Grants permission to get feed details |
| 71 | + * |
| 72 | + * Access Level: Read |
| 73 | + * |
| 74 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_GetFeed.html |
| 75 | + */ |
| 76 | + public toGetFeed() { |
| 77 | + return this.to('GetFeed'); |
| 78 | + } |
| 79 | + |
| 80 | + /** |
| 81 | + * Grants permission to retrieve metadata for a specific feed output |
| 82 | + * |
| 83 | + * Access Level: Write |
| 84 | + * |
| 85 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_GetMetadata.html |
| 86 | + */ |
| 87 | + public toGetMetadata() { |
| 88 | + return this.to('GetMetadata'); |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * Grants permission to list feeds in the account |
| 93 | + * |
| 94 | + * Access Level: List |
| 95 | + * |
| 96 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_ListFeeds.html |
| 97 | + */ |
| 98 | + public toListFeeds() { |
| 99 | + return this.to('ListFeeds'); |
| 100 | + } |
| 101 | + |
| 102 | + /** |
| 103 | + * Grants permission to list tags on a resource |
| 104 | + * |
| 105 | + * Access Level: Read |
| 106 | + * |
| 107 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_ListTagsForResource.html |
| 108 | + */ |
| 109 | + public toListTagsForResource() { |
| 110 | + return this.to('ListTagsForResource'); |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * Grants permission to upload media data for a specified feed |
| 115 | + * |
| 116 | + * Access Level: Write |
| 117 | + * |
| 118 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_PutMedia.html |
| 119 | + */ |
| 120 | + public toPutMedia() { |
| 121 | + return this.to('PutMedia'); |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Grants permission to add tags to a resource |
| 126 | + * |
| 127 | + * Access Level: Tagging |
| 128 | + * |
| 129 | + * Possible conditions: |
| 130 | + * - .ifAwsRequestTag() |
| 131 | + * - .ifAwsTagKeys() |
| 132 | + * |
| 133 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_TagResource.html |
| 134 | + */ |
| 135 | + public toTagResource() { |
| 136 | + return this.to('TagResource'); |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Grants permission to remove tags from a resource |
| 141 | + * |
| 142 | + * Access Level: Tagging |
| 143 | + * |
| 144 | + * Possible conditions: |
| 145 | + * - .ifAwsTagKeys() |
| 146 | + * |
| 147 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_UntagResource.html |
| 148 | + */ |
| 149 | + public toUntagResource() { |
| 150 | + return this.to('UntagResource'); |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * Grants permission to update feed configuration |
| 155 | + * |
| 156 | + * Access Level: Write |
| 157 | + * |
| 158 | + * https://docs.aws.amazon.com/elemental-inference/latest/api/API_UpdateFeed.html |
| 159 | + */ |
| 160 | + public toUpdateFeed() { |
| 161 | + return this.to('UpdateFeed'); |
| 162 | + } |
| 163 | + |
| 164 | + protected accessLevelList: AccessLevelList = { |
| 165 | + Write: [ |
| 166 | + 'AssociateFeed', |
| 167 | + 'CreateFeed', |
| 168 | + 'DeleteFeed', |
| 169 | + 'DisassociateFeed', |
| 170 | + 'GetMetadata', |
| 171 | + 'PutMedia', |
| 172 | + 'UpdateFeed' |
| 173 | + ], |
| 174 | + Read: [ |
| 175 | + 'GetFeed', |
| 176 | + 'ListTagsForResource' |
| 177 | + ], |
| 178 | + List: [ |
| 179 | + 'ListFeeds' |
| 180 | + ], |
| 181 | + Tagging: [ |
| 182 | + 'TagResource', |
| 183 | + 'UntagResource' |
| 184 | + ] |
| 185 | + }; |
| 186 | + |
| 187 | + /** |
| 188 | + * Adds a resource of type FeedResource to the statement |
| 189 | + * |
| 190 | + * https://docs.aws.amazon.com/elemental-inference/latest/APIReference/API_Feed.html |
| 191 | + * |
| 192 | + * @param id - Identifier for the id. |
| 193 | + * @param account - Account of the resource; defaults to `*`, unless using the CDK, where the default is the current Stack's account. |
| 194 | + * @param region - Region of the resource; defaults to `*`, unless using the CDK, where the default is the current Stack's region. |
| 195 | + * @param partition - Partition of the AWS account [aws, aws-cn, aws-us-gov]; defaults to `aws`, unless using the CDK, where the default is the current Stack's partition. |
| 196 | + * |
| 197 | + * Possible conditions: |
| 198 | + * - .ifAwsResourceTag() |
| 199 | + */ |
| 200 | + public onFeedResource(id: string, account?: string, region?: string, partition?: string) { |
| 201 | + return this.on(`arn:${ partition ?? this.defaultPartition }:elemental-inference:${ region ?? this.defaultRegion }:${ account ?? this.defaultAccount }:feed/${ id }`); |
| 202 | + } |
| 203 | + |
| 204 | + /** |
| 205 | + * Filters access by tags that are passed in the request |
| 206 | + * |
| 207 | + * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requesttag |
| 208 | + * |
| 209 | + * Applies to actions: |
| 210 | + * - .toCreateFeed() |
| 211 | + * - .toTagResource() |
| 212 | + * |
| 213 | + * @param tagKey The tag key to check |
| 214 | + * @param value The value(s) to check |
| 215 | + * @param operator Works with [string operators](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String). **Default:** `StringLike` |
| 216 | + */ |
| 217 | + public ifAwsRequestTag(tagKey: string, value: string | string[], operator?: Operator | string) { |
| 218 | + return this.if(`aws:RequestTag/${ tagKey }`, value, operator ?? 'StringLike'); |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * Filters access by tags associated with the resource |
| 223 | + * |
| 224 | + * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourcetag |
| 225 | + * |
| 226 | + * Applies to resource types: |
| 227 | + * - FeedResource |
| 228 | + * |
| 229 | + * @param tagKey The tag key to check |
| 230 | + * @param value The value(s) to check |
| 231 | + * @param operator Works with [string operators](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String). **Default:** `StringLike` |
| 232 | + */ |
| 233 | + public ifAwsResourceTag(tagKey: string, value: string | string[], operator?: Operator | string) { |
| 234 | + return this.if(`aws:ResourceTag/${ tagKey }`, value, operator ?? 'StringLike'); |
| 235 | + } |
| 236 | + |
| 237 | + /** |
| 238 | + * Filters access by tag keys that are passed in the request |
| 239 | + * |
| 240 | + * https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-tagkeys |
| 241 | + * |
| 242 | + * Applies to actions: |
| 243 | + * - .toCreateFeed() |
| 244 | + * - .toTagResource() |
| 245 | + * - .toUntagResource() |
| 246 | + * |
| 247 | + * @param value The value(s) to check |
| 248 | + * @param operator Works with [string operators](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String). **Default:** `StringLike` |
| 249 | + */ |
| 250 | + public ifAwsTagKeys(value: string | string[], operator?: Operator | string) { |
| 251 | + return this.if(`aws:TagKeys`, value, operator ?? 'StringLike'); |
| 252 | + } |
| 253 | +} |
0 commit comments