import_component
async
¶
import_component(
name: ResourceName,
semantic_version: VersionNumber,
type: ComponentType,
format: ComponentFormat,
platform: Platform,
client_token: ClientToken,
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
description: Optional[NonEmptyString] = None,
change_description: Optional[NonEmptyString] = None,
data: Optional[NonEmptyString] = None,
uri: Optional[Uri] = None,
kms_key_id: Optional[NonEmptyString] = None,
tags: Optional[TagMap] = None,
) -> ImportComponentResponse
Imports a component and transforms its data into a component document. For the SHELL format, Image Builder wraps your script in a component document with a single step that runs the script.
Parameters:
-
name(ResourceName) –The name of the component. Image Builder generates the component ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name. If a component with the same name and semantic version already exists in your account in the same Amazon Web Services Region, the request creates a new build version for it. If the content is also identical to the latest build version, the request fails because the component already exists.
-
semantic_version(VersionNumber) –The semantic version of the component. This version follows the semantic version syntax.
The semantic version has four nodes:
. . / . You can assign values for the first three, and can filter on all of them. Assignment: For the first three nodes, you can assign any positive integer value, including zero. The upper limit is 2^30-1, or 1073741823, for each node. Image Builder automatically assigns the build number to the fourth node.
Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.
-
description(Optional[NonEmptyString], default:None) –The description of the component. Describes the contents of the component.
-
change_description(Optional[NonEmptyString], default:None) –The change description of the component. This description indicates the change that has been made in this version, or what makes this version different from other versions of the component.
-
type(ComponentType) –The type of the component denotes whether the component is used to build the image, or only to test it.
-
format(ComponentFormat) –The format of the resource that you want to import as a component.
-
platform(Platform) –The platform of the component.
-
data(Optional[NonEmptyString], default:None) –The data of the component. For the
SHELLformat, this is the plain script content. You must specify exactly one of thedataoruriproperties. For scripts that exceed the inline length constraint, use theuriproperty. -
uri(Optional[Uri], default:None) –The uri of the component. Must be an Amazon S3 URL and you must have permission to access the Amazon S3 bucket. If you use Amazon S3, you can specify component content up to your service quota. Either
dataorurican be used to specify the data within the component. -
kms_key_id(Optional[NonEmptyString], default:None) –The Amazon Resource Name (ARN) of the KMS key that is used to encrypt this component. This can be either the Key ARN or the Alias ARN. For more information, see Key identifiers (KeyId) in the Key Management Service Developer Guide. If you don't specify a key, Image Builder encrypts the component data with a KMS key that Image Builder owns.
-
tags(Optional[TagMap], default:None) –The tags of the component.
-
client_token(ClientToken) –A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.
Raises:
-
CallRateLimitExceededException–You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.
-
ClientException–A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.
-
ForbiddenException–You are not authorized to perform the requested operation.
-
IdempotentParameterMismatchException–You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.
-
InvalidParameterCombinationException–You have specified a combination of parameters that isn't valid. For example, two mutually exclusive parameters, or a parameter without its required companion parameter. Review the error message for details.
-
InvalidRequestException–The request is malformed or otherwise invalid. Verify the request and try again.
-
InvalidVersionNumberException–Your version number is out of bounds or does not follow the required syntax.
-
ResourceInUseException–The resource that you are trying to operate on is currently in use. Review the message details and retry later.
-
ServiceException–An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.
-
ServiceUnavailableException–The service is unable to process your request at this time.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Import a component from a shell script The following example imports a plain shell script as a Linux build component.
>>> await client.import_component(name='my-example-imported-component', semantic_version='1.0.0', description='Installs my application from an imported shell script', type='BUILD', format='SHELL', platform='Linux', data='sudo yum update -y\nsudo yum -y install my-app\n', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE88888')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 | |