diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index 76cae071..b3d1c885 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -1e369f0 +f8682fa diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index fee4c4f2..11aa8dd6 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -346,6 +346,10 @@ build_images_delete_request, build_images_get_request, build_images_list_request, + build_images_post_account_transfer_accept_request, + build_images_post_account_transfer_cancel_request, + build_images_post_account_transfer_create_request, + build_images_post_account_transfer_decline_request, build_images_update_request, build_inference_create_async_invoke_request, build_inference_create_chat_completion_request, @@ -128519,6 +128523,9 @@ async def create( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -128661,6 +128668,9 @@ async def create( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -128844,6 +128854,9 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -129319,7 +129332,7 @@ async def list_tokens( """List Dedicated Inference Tokens. List all access tokens for a Dedicated Inference instance. Token values are - not returned; only id, name, and created_at. Send a GET request to + not returned; only id, name, created_at, and is_managed. Send a GET request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens``. :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance. @@ -129348,6 +129361,9 @@ async def list_tokens( { "created_at": "2020-02-20 00:00:00", # Optional. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is + managed by DigitalOcean (for example, system-provisioned). When false, + the token was created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -129488,6 +129504,9 @@ async def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -129543,6 +129562,9 @@ async def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -129595,6 +129617,9 @@ async def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -135951,78 +135976,78 @@ async def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -136113,78 +136138,78 @@ async def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -136270,78 +136295,78 @@ async def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -137114,6 +137139,15 @@ async def list( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value + is True. An optional boolean indicating whether the Droplets should + be created with public networking or not. By default, all Droplets + are created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not + have any public static or Reserved IPv4 or IPv6 address, nor can one + be assigned later. If explicitly set to ``false``"" , ``ipv6`` must + also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` @@ -137269,6 +137303,14 @@ async def create( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137319,6 +137361,15 @@ async def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137413,6 +137464,15 @@ async def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137492,6 +137552,14 @@ async def create( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137542,6 +137610,15 @@ async def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137700,6 +137777,15 @@ async def get(self, autoscale_pool_id: str, **kwargs: Any) -> JSON: "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137875,6 +137961,14 @@ async def update( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -137925,6 +138019,15 @@ async def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -138031,6 +138134,15 @@ async def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -138124,6 +138236,14 @@ async def update( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -138174,6 +138294,15 @@ async def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -146693,6 +146822,1044 @@ async def delete(self, image_id: int, **kwargs: Any) -> Optional[JSON]: return deserialized # type: ignore + @overload + async def post_account_transfer_create( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = {} + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def post_account_transfer_create( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def post_account_transfer_create( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = {} + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_create_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 400, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 201: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def post_account_transfer_accept( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "recipient_uuid": "str" # The UUID of the team that the image will be + transferred to. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def post_account_transfer_accept( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def post_account_transfer_accept( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "recipient_uuid": "str" # The UUID of the team that the image will be + transferred to. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_accept_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 400, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 201: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def post_account_transfer_cancel( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def post_account_transfer_cancel( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def post_account_transfer_cancel( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_cancel_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 400, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def post_account_transfer_decline( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def post_account_transfer_decline( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def post_account_transfer_decline( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_decline_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 400, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + class ImageActionsOperations: """ @@ -169561,6 +170728,9 @@ async def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high). @@ -169643,6 +170813,9 @@ async def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high). @@ -169717,6 +170890,9 @@ async def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high). diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index b466b618..38ab66f4 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -5791,6 +5791,118 @@ def build_images_delete_request(image_id: int, **kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) +def build_images_post_account_transfer_create_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/images/{image_id}/account_transfer" + path_format_arguments = { + "image_id": _SERIALIZER.url("image_id", image_id, "int"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_images_post_account_transfer_accept_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/images/{image_id}/account_transfer/accept" + path_format_arguments = { + "image_id": _SERIALIZER.url("image_id", image_id, "int"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_images_post_account_transfer_cancel_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/images/{image_id}/account_transfer/cancel" + path_format_arguments = { + "image_id": _SERIALIZER.url("image_id", image_id, "int"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_images_post_account_transfer_decline_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/images/{image_id}/account_transfer/decline" + path_format_arguments = { + "image_id": _SERIALIZER.url("image_id", image_id, "int"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + def build_image_actions_list_request(image_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -142627,6 +142739,9 @@ def create( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -142769,6 +142884,9 @@ def create( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -142952,6 +143070,9 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -143427,7 +143548,7 @@ def list_tokens( """List Dedicated Inference Tokens. List all access tokens for a Dedicated Inference instance. Token values are - not returned; only id, name, and created_at. Send a GET request to + not returned; only id, name, created_at, and is_managed. Send a GET request to ``/v2/dedicated-inferences/{dedicated_inference_id}/tokens``. :param dedicated_inference_id: A unique identifier for a Dedicated Inference instance. @@ -143456,6 +143577,9 @@ def list_tokens( { "created_at": "2020-02-20 00:00:00", # Optional. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is + managed by DigitalOcean (for example, system-provisioned). When false, + the token was created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -143596,6 +143720,9 @@ def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -143651,6 +143778,9 @@ def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -143703,6 +143833,9 @@ def create_tokens( "created_at": "2020-02-20 00:00:00", # Optional. Access token for authenticating to Dedicated Inference endpoints. "id": "str", # Optional. Unique ID of the token. + "is_managed": bool, # Optional. When true, the token is managed by + DigitalOcean (for example, system-provisioned). When false, the token was + created by the user. "name": "str", # Optional. Name of the token. "value": "str" # Optional. Token value; only returned once on create. Store securely. @@ -150059,78 +150192,78 @@ def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -150221,78 +150354,78 @@ def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -150378,78 +150511,78 @@ def post( To initiate an action on a Droplet send a POST request to ``/v2/droplets/$DROPLET_ID/actions``. In the JSON body to the request, - set the ``type`` attribute to on of the supported action types: + set the ``type`` attribute to one of the supported action types: .. list-table:: :header-rows: 1 * - Action - Details - - Additionally Required Permission + - Required Permissions * - :code:``enable_backups`` - Enables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``disable_backups`` - Disables backups for a Droplet - - + - :code:``droplet:update`` * - :code:``change_backup_policy`` - Update the backup policy for a Droplet - - + - :code:``droplet:update`` * - :code:``reboot`` - Reboots a Droplet. A ``reboot`` action is an attempt to reboot the Droplet in a graceful way, similar to using the ``reboot`` command from the console. - - + - :code:``droplet:update`` * - :code:``power_cycle`` - Power cycles a Droplet. A ``powercycle`` action is similar to pushing the reset button on a physical machine, it's similar to booting from scratch. - - + - :code:``droplet:update`` * - :code:``shutdown`` - - Shutsdown a Droplet. A shutdown action is an attempt to shutdown the Droplet in a + - Shuts down a Droplet. A shutdown action is an attempt to shutdown the Droplet in a graceful way, similar to using the ``shutdown`` command from the console. Since a ``shutdown`` command can fail, this action guarantees that the command is issued, not that it succeeds. The preferred way to turn off a Droplet is to attempt a shutdown, with a reasonable timeout, followed by a ``power_off`` action to ensure the Droplet is off. - - + - :code:``droplet:update`` * - :code:``power_off`` - Powers off a Droplet. A ``power_off`` event is a hard shutdown and should only be used if the ``shutdown`` action is not successful. It is similar to cutting the power on a server and could lead to complications. - - + - :code:``droplet:update`` * - :code:``power_on`` - Powers on a Droplet. - - + - :code:``droplet:update`` * - :code:``restore`` - Restore a Droplet using a backup image. The image ID that is passed in must be a backup of the current Droplet instance. The operation will leave any embedded SSH keys intact. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``password_reset`` - Resets the root password for a Droplet. A new password will be provided via email. It must be changed after first use. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``resize`` - Resizes a Droplet. Set the ``size`` attribute to a size slug. If a permanent resize with disk changes included is desired, set the ``disk`` attribute to ``true``. - - droplet:create + - :code:``droplet:update``:code:`
`:code:``droplet:create`` * - :code:``rebuild`` - Rebuilds a Droplet from a new base image. Set the ``image`` attribute to an image ID or slug. - - droplet:admin + - :code:``droplet:update``:code:`
`:code:``droplet:admin`` * - :code:``rename`` - Renames a Droplet. - - + - :code:``droplet:update`` * - :code:``change_kernel`` - Changes a Droplet's kernel. Only applies to Droplets with externally managed kernels. All Droplets created after March 2017 use internal kernels by default. - - + - :code:``droplet:update`` * - :code:``enable_ipv6`` - Enables IPv6 for a Droplet. Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on an existing Droplet, `additional OS-level configuration `_ is required. - - + - :code:``droplet:update`` * - :code:``snapshot`` - Takes a snapshot of a Droplet. - - image:create. + - :code:``droplet:update``:code:`
`:code:``image:create``. :param droplet_id: A unique identifier for a Droplet instance. Required. :type droplet_id: int @@ -151222,6 +151355,15 @@ def list( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value + is True. An optional boolean indicating whether the Droplets should + be created with public networking or not. By default, all Droplets + are created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not + have any public static or Reserved IPv4 or IPv6 address, nor can one + be assigned later. If explicitly set to ``false``"" , ``ipv6`` must + also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` @@ -151377,6 +151519,14 @@ def create( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151427,6 +151577,15 @@ def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151521,6 +151680,15 @@ def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151600,6 +151768,14 @@ def create( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151650,6 +151826,15 @@ def create( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151808,6 +151993,15 @@ def get(self, autoscale_pool_id: str, **kwargs: Any) -> JSON: "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -151983,6 +152177,14 @@ def update( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -152033,6 +152235,15 @@ def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -152139,6 +152350,15 @@ def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -152232,6 +152452,14 @@ def update( in the autoscale pool. "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is True. An + optional boolean indicating whether the Droplets should be created with + public networking or not. By default, all Droplets are created with public + networking available. If explicitly set to ``false``"" , only private + networking will be enabled, and public networking will be disabled; currently + this means that it will not have any public static or Reserved IPv4 or IPv6 + address, nor can one be assigned later. If explicitly set to ``false``"" , + ``ipv6`` must also be ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -152282,6 +152510,15 @@ def update( "project_id": "str", # Optional. The project that the Droplets in the autoscale pool will belong to. Requires ``project:read`` scope. + "public_networking": True, # Optional. Default value is + True. An optional boolean indicating whether the Droplets should be + created with public networking or not. By default, all Droplets are + created with public networking available. If explicitly set to + ``false``"" , only private networking will be enabled, and public + networking will be disabled; currently this means that it will not have + any public static or Reserved IPv4 or IPv6 address, nor can one be + assigned later. If explicitly set to ``false``"" , ``ipv6`` must also be + ``false``. "tags": [ "str" # Optional. The tags to apply to each of the Droplets in the autoscale pool. Requires ``tag:read`` scope. @@ -160795,6 +161032,1044 @@ def delete(self, image_id: int, **kwargs: Any) -> Optional[JSON]: return deserialized # type: ignore + @overload + def post_account_transfer_create( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = {} + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def post_account_transfer_create( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def post_account_transfer_create( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Initiate an Image Account Transfer. + + To initiate an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer``. + + Only snapshot images may be transferred by this endpoint to another account. + + An image account transfer always has exactly one recipient, specified in the request body. + The recipient can be one of the following: + + + * + A DigitalOcean account, denoted by ``recipient_email`` in the request body. + The recipient will receive an email with instructions to accept the transfer. + Once the recipient accepts the transfer, the image will be moved to their + account. + + * + A DigitalOcean team, denoted by ``recipient_uuid`` in the request body. If the + user has sufficient permissions in the recipient team, the transfer will be + automatically accepted and the image will be moved to the recipient team's + account. Otherwise, the transfer will be pending until a user with sufficient + permissions in the recipient team accepts the transfer. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = {} + + # response body for status code(s): 201 + response == { + "transfer_id": 0 # Optional. A unique number that used to identify and + reference an image account transfer. + } + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[JSON] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_create_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 400, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 201: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def post_account_transfer_accept( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "recipient_uuid": "str" # The UUID of the team that the image will be + transferred to. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def post_account_transfer_accept( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def post_account_transfer_accept( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Accept an Image Account Transfer. + + To accept an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/accept``. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "recipient_uuid": "str" # The UUID of the team that the image will be + transferred to. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_accept_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 400, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 201: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def post_account_transfer_cancel( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def post_account_transfer_cancel( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def post_account_transfer_cancel( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Cancel an Image Account Transfer. + + To cancel an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/cancel``. + + Only the sender of an image account transfer can cancel the transfer. + If the transfer is canceled, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_cancel_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 400, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def post_account_transfer_decline( + self, + image_id: int, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def post_account_transfer_decline( + self, + image_id: int, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def post_account_transfer_decline( + self, image_id: int, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Optional[JSON]: + # pylint: disable=line-too-long + """Decline an Image Account Transfer. + + To decline an account transfer for an image, send a POST request to + ``/v2/images/$IMAGE_ID/account_transfer/decline``. + + Only the recipient of an image account transfer can decline the transfer. + If the transfer is declined, the image will remain in the sender's account + and will not be transferred to the recipient. + + :param image_id: A unique number that can be used to identify and reference a specific image. + Required. + :type image_id: int + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or None + :rtype: JSON or None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "transfer_id": 0 # A unique number that used to identify and reference an + image account transfer. Required. + } + + # response body for status code(s): 400, 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + cls: ClsType[Optional[JSON]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_images_post_account_transfer_decline_request( + image_id=image_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 400, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + deserialized = None + response_headers = {} + if response.status_code == 204: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.status_code == 400: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + class ImageActionsOperations: """ @@ -183649,6 +184924,9 @@ def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high). @@ -183731,6 +185009,9 @@ def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high). @@ -183805,6 +185086,9 @@ def create_action( - Attaches an NFS share to a VPC. Set the vpc_id attribute to the desired VPC ID * - :code:``detach`` - Detaches an NFS share from a VPC. Set the vpc_id attribute to the desired VPC ID + * - :code:``reassign`` + - Reassigns an NFS share from one VPC to another. Set the old_vpc_id and new_vpc_id + attributes to the desired VPC IDs * - :code:``switch_performance_tier`` - Switches the performance tier of an NFS share. Set the performance_tier attribute to the desired tier (e.g., standard, high).