打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
cancel_capacity_reservation亚马逊boto3

cancel_capacity_reservation(**kwargs)¶
Cancels the specified Capacity Reservation, releases the reserved capacity, and changes the Capacity Reservation's state to cancelled .
Instances running in the reserved capacity continue running until you stop them. Stopped instances that target the Capacity Reservation can no longer launch. Modify these instances to either target a different Capacity Reservation, launch On-Demand Instance capacity, or run in any open Capacity Reservation that has matching attributes and sufficient capacity.
See also: AWS API Documentation
Request Syntax

代码简单,建议直接上手

response = client.cancel_capacity_reservation(
    CapacityReservationId='string',
    DryRun=True|False
)
Parameters
* CapacityReservationId (string) -- [REQUIRED]
The ID of the Capacity Reservation to be cancelled.
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
Return type
dict
Returns

Response Syntax
{
    'Return': True|False
}
Response Structure
* (dict) --
    * Return (boolean) --
Returns true if the request succeeds; otherwise, it returns an error.

cancel_capacity_reservation_fleets(**kwargs)¶
Cancels one or more Capacity Reservation Fleets. When you cancel a Capacity Reservation Fleet, the following happens:
* The Capacity Reservation Fleet's status changes to cancelled .
* The individual Capacity Reservations in the Fleet are cancelled. Instances running in the Capacity Reservations at the time of cancelling the Fleet continue to run in shared capacity.
* The Fleet stops creating new Capacity Reservations.
See also: AWS API Documentation
Request Syntax
response = client.cancel_capacity_reservation_fleets(
    DryRun=True|False,
    CapacityReservationFleetIds=[
        'string',
    ]
)
Parameters
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
* CapacityReservationFleetIds (list) -- [REQUIRED]
The IDs of the Capacity Reservation Fleets to cancel.
    * (string) --
Return type
dict
Returns

Response Syntax
{
    'SuccessfulFleetCancellations': [
        {
            'CurrentFleetState': 'submitted'|'modifying'|'active'|'partially_fulfilled'|'expiring'|'expired'|'cancelling'|'cancelled'|'failed',
            'PreviousFleetState': 'submitted'|'modifying'|'active'|'partially_fulfilled'|'expiring'|'expired'|'cancelling'|'cancelled'|'failed',
            'CapacityReservationFleetId': 'string'
        },
    ],
    'FailedFleetCancellations': [
        {
            'CapacityReservationFleetId': 'string',
            'CancelCapacityReservationFleetError': {
                'Code': 'string',
                'Message': 'string'
            }
        },
    ]
}
Response Structure
* (dict) --
    * SuccessfulFleetCancellations (list) --
Information about the Capacity Reservation Fleets that were successfully cancelled.
        * (dict) --
Describes a Capacity Reservation Fleet that was successfully cancelled.
            * CurrentFleetState (string) --
The current state of the Capacity Reservation Fleet.
            * PreviousFleetState (string) --
The previous state of the Capacity Reservation Fleet.
            * CapacityReservationFleetId (string) --
The ID of the Capacity Reservation Fleet that was successfully cancelled.
    * FailedFleetCancellations (list) --
Information about the Capacity Reservation Fleets that could not be cancelled.
        * (dict) --
Describes a Capacity Reservation Fleet that could not be cancelled.
            * CapacityReservationFleetId (string) --
The ID of the Capacity Reservation Fleet that could not be cancelled.
            * CancelCapacityReservationFleetError (dict) --
Information about the Capacity Reservation Fleet cancellation error.
                * Code (string) --
The error code.
                * Message (string) --
The error message.

cancel_conversion_task(**kwargs)¶
Cancels an active conversion task. The task can be the import of an instance or volume. The action removes all artifacts of the conversion, including a partially uploaded volume or instance. If the conversion is complete or is in the process of transferring the final disk image, the command fails and returns an exception.
For more information, see Importing a Virtual Machine Using the Amazon EC2 CLI.
See also: AWS API Documentation
Request Syntax
response = client.cancel_conversion_task(
    ConversionTaskId='string',
    DryRun=True|False,
    ReasonMessage='string'
)
Parameters
* ConversionTaskId (string) -- [REQUIRED]
The ID of the conversion task.
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
* ReasonMessage (string) -- The reason for canceling the conversion task.
Returns
None
cancel_export_task(**kwargs)¶
Cancels an active export task. The request removes all artifacts of the export, including any partially-created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.
See also: AWS API Documentation
Request Syntax
response = client.cancel_export_task(
    ExportTaskId='string'
)
Parameters
ExportTaskId (string) --
[REQUIRED]
The ID of the export task. This is the ID returned by CreateInstanceExportTask .
Returns
None
cancel_image_launch_permission(**kwargs)¶
Removes your Amazon Web Services account from the launch permissions for the specified AMI. For more information, see Cancel having an AMI shared with your Amazon Web Services account in the Amazon EC2 User Guide .
See also: AWS API Documentation
Request Syntax
response = client.cancel_image_launch_permission(
    ImageId='string',
    DryRun=True|False
)
Parameters
* ImageId (string) -- [REQUIRED]
The ID of the AMI that was shared with your Amazon Web Services account.
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
Return type
dict
Returns

Response Syntax
{
    'Return': True|False
}
Response Structure
* (dict) --
    * Return (boolean) --
Returns true if the request succeeds; otherwise, it returns an error.

cancel_import_task(**kwargs)¶
Cancels an in-process import virtual machine or import snapshot task.
See also: AWS API Documentation
Request Syntax
response = client.cancel_import_task(
    CancelReason='string',
    DryRun=True|False,
    ImportTaskId='string'
)
Parameters
* CancelReason (string) -- The reason for canceling the task.
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
* ImportTaskId (string) -- The ID of the import image or import snapshot task to be canceled.
Return type
dict
Returns

Response Syntax
{
    'ImportTaskId': 'string',
    'PreviousState': 'string',
    'State': 'string'
}
Response Structure
* (dict) --
    * ImportTaskId (string) --
The ID of the task being canceled.
    * PreviousState (string) --
The current state of the task being canceled.
    * State (string) --
The current state of the task being canceled.

cancel_reserved_instances_listing(**kwargs)¶
Cancels the specified Reserved Instance listing in the Reserved Instance Marketplace.
For more information, see Reserved Instance Marketplace in the Amazon EC2 User Guide .
See also: AWS API Documentation
Request Syntax
response = client.cancel_reserved_instances_listing(
    ReservedInstancesListingId='string'
)
Parameters
ReservedInstancesListingId (string) --
[REQUIRED]
The ID of the Reserved Instance listing.
Return type
dict
Returns
Response Syntax
{
    'ReservedInstancesListings': [
        {
            'ClientToken': 'string',
            'CreateDate': datetime(2015, 1, 1),
            'InstanceCounts': [
                {
                    'InstanceCount': 123,
                    'State': 'available'|'sold'|'cancelled'|'pending'
                },
            ],
            'PriceSchedules': [
                {
                    'Active': True|False,
                    'CurrencyCode': 'USD',
                    'Price': 123.0,
                    'Term': 123
                },
            ],
            'ReservedInstancesId': 'string',
            'ReservedInstancesListingId': 'string',
            'Status': 'active'|'pending'|'cancelled'|'closed',
            'StatusMessage': 'string',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'UpdateDate': datetime(2015, 1, 1)
        },
    ]
}
Response Structure
* (dict) --Contains the output of CancelReservedInstancesListing.
    * ReservedInstancesListings (list) --The Reserved Instance listing.
        * (dict) --Describes a Reserved Instance listing.
            * ClientToken (string) --A unique, case-sensitive key supplied by the client to ensure that the request is idempotent. For more information, see Ensuring Idempotency.
            * CreateDate (datetime) --The time the listing was created.
            * InstanceCounts (list) --The number of instances in this state.
                * (dict) --Describes a Reserved Instance listing state.
                    * InstanceCount (integer) --The number of listed Reserved Instances in the state specified by the state .
                    * State (string) --The states of the listed Reserved Instances.
            * PriceSchedules (list) --The price of the Reserved Instance listing.
                * (dict) --Describes the price for a Reserved Instance.
                    * Active (boolean) --The current price schedule, as determined by the term remaining for the Reserved Instance in the listing.
A specific price schedule is always in effect, but only one price schedule can be active at any time. Take, for example, a Reserved Instance listing that has five months remaining in its term. When you specify price schedules for five months and two months, this means that schedule 1, covering the first three months of the remaining term, will be active during months 5, 4, and 3. Then schedule 2, covering the last two months of the term, will be active for months 2 and 1.
                    * CurrencyCode (string) --The currency for transacting the Reserved Instance resale. At this time, the only supported currency is USD .
                    * Price (float) --The fixed price for the term.
                    * Term (integer) --The number of months remaining in the reservation. For example, 2 is the second to the last month before the capacity reservation expires.
            * ReservedInstancesId (string) --The ID of the Reserved Instance.
            * ReservedInstancesListingId (string) --The ID of the Reserved Instance listing.
            * Status (string) --The status of the Reserved Instance listing.
            * StatusMessage (string) --The reason for the current status of the Reserved Instance listing. The response can be blank.
            * Tags (list) --Any tags assigned to the resource.
                * (dict) --Describes a tag.
                    * Key (string) --The key of the tag.
Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws: .
                    * Value (string) --The value of the tag.
Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.
            * UpdateDate (datetime) --The last modified timestamp of the listing.
cancel_spot_fleet_requests(**kwargs)¶
Cancels the specified Spot Fleet requests.
After you cancel a Spot Fleet request, the Spot Fleet launches no new Spot Instances. You must specify whether the Spot Fleet should also terminate its Spot Instances. If you terminate the instances, the Spot Fleet request enters the cancelled_terminating state. Otherwise, the Spot Fleet request enters the cancelled_running state and the instances continue to run until they are interrupted or you terminate them manually.
See also: AWS API Documentation
Request Syntax
response = client.cancel_spot_fleet_requests(
    DryRun=True|False,
    SpotFleetRequestIds=[
        'string',
    ],
    TerminateInstances=True|False
)
Parameters
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
* SpotFleetRequestIds (list) -- [REQUIRED]
The IDs of the Spot Fleet requests.
    * (string) --
* TerminateInstances (boolean) -- [REQUIRED]
Indicates whether to terminate instances for a Spot Fleet request if it is canceled successfully.
Return type
dict
Returns

Response Syntax
{
    'SuccessfulFleetRequests': [
        {
            'CurrentSpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating'|'modifying',
            'PreviousSpotFleetRequestState': 'submitted'|'active'|'cancelled'|'failed'|'cancelled_running'|'cancelled_terminating'|'modifying',
            'SpotFleetRequestId': 'string'
        },
    ],
    'UnsuccessfulFleetRequests': [
        {
            'Error': {
                'Code': 'fleetRequestIdDoesNotExist'|'fleetRequestIdMalformed'|'fleetRequestNotInCancellableState'|'unexpectedError',
                'Message': 'string'
            },
            'SpotFleetRequestId': 'string'
        },
    ]
}
Response Structure
* (dict) --
Contains the output of CancelSpotFleetRequests.
    * SuccessfulFleetRequests (list) --
Information about the Spot Fleet requests that are successfully canceled.
        * (dict) --
Describes a Spot Fleet request that was successfully canceled.
            * CurrentSpotFleetRequestState (string) --
The current state of the Spot Fleet request.
            * PreviousSpotFleetRequestState (string) --
The previous state of the Spot Fleet request.
            * SpotFleetRequestId (string) --
The ID of the Spot Fleet request.
    * UnsuccessfulFleetRequests (list) --
Information about the Spot Fleet requests that are not successfully canceled.
        * (dict) --
Describes a Spot Fleet request that was not successfully canceled.
            * Error (dict) --
The error.
                * Code (string) --
The error code.
                * Message (string) --
The description for the error code.
            * SpotFleetRequestId (string) --
The ID of the Spot Fleet request.

Examples
This example cancels the specified Spot fleet request and terminates its associated Spot Instances.
response = client.cancel_spot_fleet_requests(
    SpotFleetRequestIds=[
        'sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE',
    ],
    TerminateInstances=True,
)

print(response)
Expected Output:
{
    'SuccessfulFleetRequests': [
        {
            'CurrentSpotFleetRequestState': 'cancelled_running',
            'PreviousSpotFleetRequestState': 'active',
            'SpotFleetRequestId': 'sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
This example cancels the specified Spot fleet request without terminating its associated Spot Instances.
response = client.cancel_spot_fleet_requests(
    SpotFleetRequestIds=[
        'sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE',
    ],
    TerminateInstances=False,
)

print(response)
Expected Output:
{
    'SuccessfulFleetRequests': [
        {
            'CurrentSpotFleetRequestState': 'cancelled_terminating',
            'PreviousSpotFleetRequestState': 'active',
            'SpotFleetRequestId': 'sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
cancel_spot_instance_requests(**kwargs)¶
Cancels one or more Spot Instance requests.
Warning
Canceling a Spot Instance request does not terminate running Spot Instances associated with the request.
See also: AWS API Documentation
Request Syntax
response = client.cancel_spot_instance_requests(
    DryRun=True|False,
    SpotInstanceRequestIds=[
        'string',
    ]
)
Parameters
* DryRun (boolean) -- Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .
* SpotInstanceRequestIds (list) -- [REQUIRED]
One or more Spot Instance request IDs.
    * (string) --
Return type
dict
Returns

Response Syntax
{
    'CancelledSpotInstanceRequests': [
        {
            'SpotInstanceRequestId': 'string',
            'State': 'active'|'open'|'closed'|'cancelled'|'completed'
        },
    ]
}
Response Structure
* (dict) --
Contains the output of CancelSpotInstanceRequests.
    * CancelledSpotInstanceRequests (list) --
One or more Spot Instance requests.
        * (dict) --
Describes a request to cancel a Spot Instance.
            * SpotInstanceRequestId (string) --
The ID of the Spot Instance request.
            * State (string) --
The state of the Spot Instance request.

Examples
This example cancels a Spot Instance request.
response = client.cancel_spot_instance_requests(
    SpotInstanceRequestIds=[
        'sir-08b93456',
    ],
)

print(response)
Expected Output:
{
    'CancelledSpotInstanceRequests': [
        {
            'SpotInstanceRequestId': 'sir-08b93456',
            'State': 'cancelled',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
close()¶
Closes underlying endpoint connections.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
requests库学习案例
Python从入门到爬虫案例实现~
Python爬虫番外篇之关于登录
Python爬虫requests库教程(三)
CTFWEB-SSTI篇
Python|如何构建自己的IP池
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服