@leaflow/sdk 0.0.0-dev.410.gb8719fe → 0.0.0-dev.415.gb9e4b83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compute/v2/generated/functions.d.ts +2819 -0
- package/dist/compute/v2/generated/functions.js +3040 -0
- package/dist/compute/v2/generated/models.d.ts +3548 -0
- package/dist/compute/v2/generated/models.js +438 -0
- package/dist/compute/v2/generated/schemas.zod.d.ts +2088 -0
- package/dist/compute/v2/generated/schemas.zod.js +2532 -0
- package/dist/compute/v2/generated/validators/associateElasticIPRequestBody.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/associateElasticIPRequestBody.zod.js +40 -0
- package/dist/compute/v2/generated/validators/attachNetworkInterfaceRequestBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/attachNetworkInterfaceRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/attachVolumeRequestBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/attachVolumeRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/availabilityZoneID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/availabilityZoneID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/availabilityZoneListResponseBody.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/availabilityZoneListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/availabilityZoneResource.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/availabilityZoneResource.zod.js +47 -0
- package/dist/compute/v2/generated/validators/billingCancellation.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/billingCancellation.zod.js +46 -0
- package/dist/compute/v2/generated/validators/billingChoice.zod.d.ts +54 -0
- package/dist/compute/v2/generated/validators/billingChoice.zod.js +46 -0
- package/dist/compute/v2/generated/validators/billingComponent.zod.d.ts +64 -0
- package/dist/compute/v2/generated/validators/billingComponent.zod.js +49 -0
- package/dist/compute/v2/generated/validators/billingLineQuantity.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/billingLineQuantity.zod.js +38 -0
- package/dist/compute/v2/generated/validators/billingMeter.zod.d.ts +48 -0
- package/dist/compute/v2/generated/validators/billingMeter.zod.js +46 -0
- package/dist/compute/v2/generated/validators/billingPeriod.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/billingPeriod.zod.js +40 -0
- package/dist/compute/v2/generated/validators/billingQuantity.zod.d.ts +49 -0
- package/dist/compute/v2/generated/validators/billingQuantity.zod.js +42 -0
- package/dist/compute/v2/generated/validators/bootVolume.zod.d.ts +72 -0
- package/dist/compute/v2/generated/validators/bootVolume.zod.js +40 -0
- package/dist/compute/v2/generated/validators/cancellationMode.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/cancellationMode.zod.js +38 -0
- package/dist/compute/v2/generated/validators/checkoutMode.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/checkoutMode.zod.js +38 -0
- package/dist/compute/v2/generated/validators/checkoutOptions.zod.d.ts +48 -0
- package/dist/compute/v2/generated/validators/checkoutOptions.zod.js +53 -0
- package/dist/compute/v2/generated/validators/consoleResponseBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/consoleResponseBody.zod.js +40 -0
- package/dist/compute/v2/generated/validators/createElasticIPRequestBody.zod.d.ts +72 -0
- package/dist/compute/v2/generated/validators/createElasticIPRequestBody.zod.js +53 -0
- package/dist/compute/v2/generated/validators/createElasticIPResponseBody.zod.d.ts +138 -0
- package/dist/compute/v2/generated/validators/createElasticIPResponseBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/createInstanceRequestBody.zod.d.ts +196 -0
- package/dist/compute/v2/generated/validators/createInstanceRequestBody.zod.js +81 -0
- package/dist/compute/v2/generated/validators/createInstanceResponseBody.zod.d.ts +160 -0
- package/dist/compute/v2/generated/validators/createInstanceResponseBody.zod.js +57 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateRequestBody.zod.d.ts +79 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateRequestBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateResponseBody.zod.d.ts +87 -0
- package/dist/compute/v2/generated/validators/createLaunchTemplateResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/createNetworkInterfaceAddressRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/createNetworkInterfaceAddressRequestBody.zod.js +43 -0
- package/dist/compute/v2/generated/validators/createNetworkInterfaceRequestBody.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/createNetworkInterfaceRequestBody.zod.js +53 -0
- package/dist/compute/v2/generated/validators/createPrivateImageRequestBody.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/createPrivateImageRequestBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/createPrivateImageResponseBody.zod.d.ts +120 -0
- package/dist/compute/v2/generated/validators/createPrivateImageResponseBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/createSecurityGroupRequestBody.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/createSecurityGroupRequestBody.zod.js +43 -0
- package/dist/compute/v2/generated/validators/createSecurityGroupRuleRequestBody.zod.d.ts +52 -0
- package/dist/compute/v2/generated/validators/createSecurityGroupRuleRequestBody.zod.js +62 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudPeeringRequestBody.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudPeeringRequestBody.zod.js +43 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudRequestBody.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudRequestBody.zod.js +47 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudRouteRequestBody.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudRouteRequestBody.zod.js +51 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudSubnetRequestBody.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/createVirtualPrivateCloudSubnetRequestBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/createVolumeBackupRequestBody.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/createVolumeBackupRequestBody.zod.js +43 -0
- package/dist/compute/v2/generated/validators/createVolumeBackupResponseBody.zod.d.ts +112 -0
- package/dist/compute/v2/generated/validators/createVolumeBackupResponseBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/createVolumeRequestBody.zod.d.ts +70 -0
- package/dist/compute/v2/generated/validators/createVolumeRequestBody.zod.js +54 -0
- package/dist/compute/v2/generated/validators/createVolumeResponseBody.zod.d.ts +149 -0
- package/dist/compute/v2/generated/validators/createVolumeResponseBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/createVolumeSnapshotRequestBody.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/createVolumeSnapshotRequestBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/createVolumeSnapshotResponseBody.zod.d.ts +111 -0
- package/dist/compute/v2/generated/validators/createVolumeSnapshotResponseBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/cursorPagination.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/cursorPagination.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteElasticIPResponseBody.zod.d.ts +144 -0
- package/dist/compute/v2/generated/validators/deleteElasticIPResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/deleteElasticIpParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deleteElasticIpParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteInstanceParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deleteInstanceParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteInstanceResponseBody.zod.d.ts +164 -0
- package/dist/compute/v2/generated/validators/deleteInstanceResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/deletePrivateImageParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deletePrivateImageParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deletePrivateImageResponseBody.zod.d.ts +126 -0
- package/dist/compute/v2/generated/validators/deletePrivateImageResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/deleteVolumeBackupParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deleteVolumeBackupParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteVolumeBackupResponseBody.zod.d.ts +118 -0
- package/dist/compute/v2/generated/validators/deleteVolumeBackupResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/deleteVolumeParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deleteVolumeParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteVolumeResponseBody.zod.d.ts +155 -0
- package/dist/compute/v2/generated/validators/deleteVolumeResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/deleteVolumeSnapshotParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/deleteVolumeSnapshotParams.zod.js +41 -0
- package/dist/compute/v2/generated/validators/deleteVolumeSnapshotResponseBody.zod.d.ts +117 -0
- package/dist/compute/v2/generated/validators/deleteVolumeSnapshotResponseBody.zod.js +45 -0
- package/dist/compute/v2/generated/validators/elasticIP.zod.d.ts +134 -0
- package/dist/compute/v2/generated/validators/elasticIP.zod.js +115 -0
- package/dist/compute/v2/generated/validators/elasticIPAssociation.zod.d.ts +51 -0
- package/dist/compute/v2/generated/validators/elasticIPAssociation.zod.js +50 -0
- package/dist/compute/v2/generated/validators/elasticIPAssociationID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/elasticIPAssociationID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/elasticIPID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/elasticIPID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/elasticIPLine.zod.d.ts +112 -0
- package/dist/compute/v2/generated/validators/elasticIPLine.zod.js +65 -0
- package/dist/compute/v2/generated/validators/elasticIPLineID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/elasticIPLineID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/elasticIPLineListResponseBody.zod.d.ts +116 -0
- package/dist/compute/v2/generated/validators/elasticIPLineListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/elasticIPListResponseBody.zod.d.ts +141 -0
- package/dist/compute/v2/generated/validators/elasticIPListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/elasticIPOperation.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/elasticIPOperation.zod.js +50 -0
- package/dist/compute/v2/generated/validators/elasticIPReleaseResource.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/elasticIPReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/error.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/error.zod.js +44 -0
- package/dist/compute/v2/generated/validators/existingBootVolume.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/existingBootVolume.zod.js +46 -0
- package/dist/compute/v2/generated/validators/existingElasticIP.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/existingElasticIP.zod.js +40 -0
- package/dist/compute/v2/generated/validators/existingPrimaryNetworkInterface.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/existingPrimaryNetworkInterface.zod.js +40 -0
- package/dist/compute/v2/generated/validators/freeSubnetCidr.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/freeSubnetCidr.zod.js +39 -0
- package/dist/compute/v2/generated/validators/generatedPassword.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/generatedPassword.zod.js +38 -0
- package/dist/compute/v2/generated/validators/getVirtualPrivateCloudFreeSubnetCidrParams.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/getVirtualPrivateCloudFreeSubnetCidrParams.zod.js +45 -0
- package/dist/compute/v2/generated/validators/iPv4HostAddress.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/iPv4HostAddress.zod.js +43 -0
- package/dist/compute/v2/generated/validators/imageID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/imageID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/instance.zod.d.ts +157 -0
- package/dist/compute/v2/generated/validators/instance.zod.js +149 -0
- package/dist/compute/v2/generated/validators/instanceAssociationTarget.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/instanceAssociationTarget.zod.js +41 -0
- package/dist/compute/v2/generated/validators/instanceElasticIP.zod.d.ts +70 -0
- package/dist/compute/v2/generated/validators/instanceElasticIP.zod.js +40 -0
- package/dist/compute/v2/generated/validators/instanceFamily.zod.d.ts +57 -0
- package/dist/compute/v2/generated/validators/instanceFamily.zod.js +54 -0
- package/dist/compute/v2/generated/validators/instanceFamilyCategory.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/instanceFamilyCategory.zod.js +38 -0
- package/dist/compute/v2/generated/validators/instanceFamilyID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/instanceFamilyID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/instanceFamilyListResponseBody.zod.d.ts +64 -0
- package/dist/compute/v2/generated/validators/instanceFamilyListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/instanceID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/instanceID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/instanceListResponseBody.zod.d.ts +161 -0
- package/dist/compute/v2/generated/validators/instanceListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/instanceNetworkInterfaceID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/instanceNetworkInterfaceID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/instanceOperation.zod.d.ts +61 -0
- package/dist/compute/v2/generated/validators/instanceOperation.zod.js +63 -0
- package/dist/compute/v2/generated/validators/instanceReleaseResource.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/instanceReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/instanceRestriction.zod.d.ts +49 -0
- package/dist/compute/v2/generated/validators/instanceRestriction.zod.js +60 -0
- package/dist/compute/v2/generated/validators/instanceType.zod.d.ts +80 -0
- package/dist/compute/v2/generated/validators/instanceType.zod.js +58 -0
- package/dist/compute/v2/generated/validators/instanceTypeID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/instanceTypeID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/instanceTypeListResponseBody.zod.d.ts +87 -0
- package/dist/compute/v2/generated/validators/instanceTypeListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/instanceVolumeID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/instanceVolumeID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/internetChargeType.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/internetChargeType.zod.js +38 -0
- package/dist/compute/v2/generated/validators/launchTemplate.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/launchTemplate.zod.js +47 -0
- package/dist/compute/v2/generated/validators/launchTemplateBootVolume.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/launchTemplateBootVolume.zod.js +48 -0
- package/dist/compute/v2/generated/validators/launchTemplateDataVolume.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/launchTemplateDataVolume.zod.js +46 -0
- package/dist/compute/v2/generated/validators/launchTemplateElasticIP.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/launchTemplateElasticIP.zod.js +45 -0
- package/dist/compute/v2/generated/validators/launchTemplateID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/launchTemplateID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/launchTemplateListResponseBody.zod.d.ts +54 -0
- package/dist/compute/v2/generated/validators/launchTemplateListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/launchTemplateNetworkInterface.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/launchTemplateNetworkInterface.zod.js +47 -0
- package/dist/compute/v2/generated/validators/launchTemplateReference.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/launchTemplateReference.zod.js +46 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersion.zod.d.ts +75 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersion.zod.js +57 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersionListResponseBody.zod.d.ts +82 -0
- package/dist/compute/v2/generated/validators/launchTemplateVersionListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/listAvailabilityZonesParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listAvailabilityZonesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listElasticIpLinesParams.zod.d.ts +48 -0
- package/dist/compute/v2/generated/validators/listElasticIpLinesParams.zod.js +55 -0
- package/dist/compute/v2/generated/validators/listElasticIpTrafficUsageParams.zod.d.ts +52 -0
- package/dist/compute/v2/generated/validators/listElasticIpTrafficUsageParams.zod.js +55 -0
- package/dist/compute/v2/generated/validators/listElasticIpsParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listElasticIpsParams.zod.js +47 -0
- package/dist/compute/v2/generated/validators/listInstanceFamiliesParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listInstanceFamiliesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listInstanceNetworkInterfacesParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listInstanceNetworkInterfacesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listInstanceTypesParams.zod.d.ts +48 -0
- package/dist/compute/v2/generated/validators/listInstanceTypesParams.zod.js +57 -0
- package/dist/compute/v2/generated/validators/listInstanceVolumesParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listInstanceVolumesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listInstancesParams.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/listInstancesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listLaunchTemplateVersionsParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listLaunchTemplateVersionsParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listLaunchTemplatesParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listLaunchTemplatesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listNetworkInterfacesParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listNetworkInterfacesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listOperationLogsParams.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/listOperationLogsParams.zod.js +57 -0
- package/dist/compute/v2/generated/validators/listPrivateImagesParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listPrivateImagesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listPublicImagesParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listPublicImagesParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listQuotasParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listQuotasParams.zod.js +47 -0
- package/dist/compute/v2/generated/validators/listRegionsParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listRegionsParams.zod.js +47 -0
- package/dist/compute/v2/generated/validators/listSecurityGroupRulesParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listSecurityGroupRulesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listSecurityGroupsParams.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/listSecurityGroupsParams.zod.js +55 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudPeeringsParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudPeeringsParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudRoutesParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudRoutesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudSubnetsParams.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudSubnetsParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudsParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listVirtualPrivateCloudsParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listVolumeBackupsParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listVolumeBackupsParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listVolumeSnapshotsParams.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/listVolumeSnapshotsParams.zod.js +53 -0
- package/dist/compute/v2/generated/validators/listVolumeTypesParams.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/listVolumeTypesParams.zod.js +55 -0
- package/dist/compute/v2/generated/validators/listVolumesParams.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/listVolumesParams.zod.js +51 -0
- package/dist/compute/v2/generated/validators/money.zod.d.ts +38 -0
- package/dist/compute/v2/generated/validators/money.zod.js +38 -0
- package/dist/compute/v2/generated/validators/networkInterface.zod.d.ts +100 -0
- package/dist/compute/v2/generated/validators/networkInterface.zod.js +62 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddress.zod.d.ts +54 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddress.zod.js +49 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddressAssociationTarget.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddressAssociationTarget.zod.js +41 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddressID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAddressID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAttachment.zod.d.ts +58 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAttachment.zod.js +51 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAttachmentList.zod.d.ts +65 -0
- package/dist/compute/v2/generated/validators/networkInterfaceAttachmentList.zod.js +41 -0
- package/dist/compute/v2/generated/validators/networkInterfaceID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/networkInterfaceID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/networkInterfaceListResponseBody.zod.d.ts +107 -0
- package/dist/compute/v2/generated/validators/networkInterfaceListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/networkInterfaceOperation.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/networkInterfaceOperation.zod.js +52 -0
- package/dist/compute/v2/generated/validators/newBootVolume.zod.d.ts +67 -0
- package/dist/compute/v2/generated/validators/newBootVolume.zod.js +52 -0
- package/dist/compute/v2/generated/validators/newCompute.zod.d.ts +57 -0
- package/dist/compute/v2/generated/validators/newCompute.zod.js +43 -0
- package/dist/compute/v2/generated/validators/newDataVolume.zod.d.ts +63 -0
- package/dist/compute/v2/generated/validators/newDataVolume.zod.js +52 -0
- package/dist/compute/v2/generated/validators/newElasticIP.zod.d.ts +66 -0
- package/dist/compute/v2/generated/validators/newElasticIP.zod.js +52 -0
- package/dist/compute/v2/generated/validators/newLaunchTemplateVersion.zod.d.ts +76 -0
- package/dist/compute/v2/generated/validators/newLaunchTemplateVersion.zod.js +62 -0
- package/dist/compute/v2/generated/validators/newPrimaryNetworkInterface.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/newPrimaryNetworkInterface.zod.js +47 -0
- package/dist/compute/v2/generated/validators/offsetPagination.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/offsetPagination.zod.js +43 -0
- package/dist/compute/v2/generated/validators/operationLogID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/operationLogID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/operationLogListResponseBody.zod.d.ts +65 -0
- package/dist/compute/v2/generated/validators/operationLogListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/operationLogResource.zod.d.ts +58 -0
- package/dist/compute/v2/generated/validators/operationLogResource.zod.js +68 -0
- package/dist/compute/v2/generated/validators/passwordChoice.zod.d.ts +47 -0
- package/dist/compute/v2/generated/validators/passwordChoice.zod.js +40 -0
- package/dist/compute/v2/generated/validators/performanceFormula.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/performanceFormula.zod.js +43 -0
- package/dist/compute/v2/generated/validators/primaryNetworkInterface.zod.d.ts +49 -0
- package/dist/compute/v2/generated/validators/primaryNetworkInterface.zod.js +40 -0
- package/dist/compute/v2/generated/validators/privateImageListResponseBody.zod.d.ts +123 -0
- package/dist/compute/v2/generated/validators/privateImageListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/privateImageOperation.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/privateImageOperation.zod.js +43 -0
- package/dist/compute/v2/generated/validators/privateImageReleaseResource.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/privateImageReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/privateImageResource.zod.d.ts +117 -0
- package/dist/compute/v2/generated/validators/privateImageResource.zod.js +110 -0
- package/dist/compute/v2/generated/validators/projectQuota.zod.d.ts +63 -0
- package/dist/compute/v2/generated/validators/projectQuota.zod.js +48 -0
- package/dist/compute/v2/generated/validators/projectQuotaListResponseBody.zod.d.ts +69 -0
- package/dist/compute/v2/generated/validators/projectQuotaListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/publicImageListResponseBody.zod.d.ts +61 -0
- package/dist/compute/v2/generated/validators/publicImageListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/publicImageResource.zod.d.ts +55 -0
- package/dist/compute/v2/generated/validators/publicImageResource.zod.js +65 -0
- package/dist/compute/v2/generated/validators/quotaResourceType.zod.d.ts +53 -0
- package/dist/compute/v2/generated/validators/quotaResourceType.zod.js +53 -0
- package/dist/compute/v2/generated/validators/quotaSource.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/quotaSource.zod.js +38 -0
- package/dist/compute/v2/generated/validators/rebootInstanceRequestBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/rebootInstanceRequestBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceRequestBody.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceRequestBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceResponseBody.zod.d.ts +157 -0
- package/dist/compute/v2/generated/validators/rebuildInstanceResponseBody.zod.js +43 -0
- package/dist/compute/v2/generated/validators/regionID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/regionID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/regionListResponseBody.zod.d.ts +131 -0
- package/dist/compute/v2/generated/validators/regionListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/regionResource.zod.d.ts +124 -0
- package/dist/compute/v2/generated/validators/regionResource.zod.js +52 -0
- package/dist/compute/v2/generated/validators/releaseResource.zod.d.ts +75 -0
- package/dist/compute/v2/generated/validators/releaseResource.zod.js +51 -0
- package/dist/compute/v2/generated/validators/releaseSetItem.zod.d.ts +78 -0
- package/dist/compute/v2/generated/validators/releaseSetItem.zod.js +42 -0
- package/dist/compute/v2/generated/validators/rescueInstanceRequestBody.zod.d.ts +42 -0
- package/dist/compute/v2/generated/validators/rescueInstanceRequestBody.zod.js +44 -0
- package/dist/compute/v2/generated/validators/rescueInstanceResponseBody.zod.d.ts +157 -0
- package/dist/compute/v2/generated/validators/rescueInstanceResponseBody.zod.js +40 -0
- package/dist/compute/v2/generated/validators/resetInstancePasswordResponseBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/resetInstancePasswordResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/revertVolumeRequestBody.zod.d.ts +40 -0
- package/dist/compute/v2/generated/validators/revertVolumeRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/runInstanceCommandRequestBody.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/runInstanceCommandRequestBody.zod.js +50 -0
- package/dist/compute/v2/generated/validators/runInstanceCommandResponseBody.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/runInstanceCommandResponseBody.zod.js +49 -0
- package/dist/compute/v2/generated/validators/securityGroup.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/securityGroup.zod.js +48 -0
- package/dist/compute/v2/generated/validators/securityGroupID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/securityGroupID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/securityGroupIDOrWildcard.zod.d.ts +39 -0
- package/dist/compute/v2/generated/validators/securityGroupIDOrWildcard.zod.js +40 -0
- package/dist/compute/v2/generated/validators/securityGroupListResponseBody.zod.d.ts +53 -0
- package/dist/compute/v2/generated/validators/securityGroupListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/securityGroupRule.zod.d.ts +52 -0
- package/dist/compute/v2/generated/validators/securityGroupRule.zod.js +56 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleDirection.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleDirection.zod.js +36 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleListResponseBody.zod.d.ts +59 -0
- package/dist/compute/v2/generated/validators/securityGroupRuleListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/subnetID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/subnetID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/suppliedPassword.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/suppliedPassword.zod.js +45 -0
- package/dist/compute/v2/generated/validators/terminationPolicy.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/terminationPolicy.zod.js +38 -0
- package/dist/compute/v2/generated/validators/trafficUsage.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/trafficUsage.zod.js +44 -0
- package/dist/compute/v2/generated/validators/trafficUsageListResponseBody.zod.d.ts +49 -0
- package/dist/compute/v2/generated/validators/trafficUsageListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/updateElasticIPRequestBody.zod.d.ts +53 -0
- package/dist/compute/v2/generated/validators/updateElasticIPRequestBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/updateElasticIPResponseBody.zod.d.ts +138 -0
- package/dist/compute/v2/generated/validators/updateElasticIPResponseBody.zod.js +49 -0
- package/dist/compute/v2/generated/validators/updateInstanceRequestBody.zod.d.ts +55 -0
- package/dist/compute/v2/generated/validators/updateInstanceRequestBody.zod.js +60 -0
- package/dist/compute/v2/generated/validators/updateInstanceResponseBody.zod.d.ts +158 -0
- package/dist/compute/v2/generated/validators/updateInstanceResponseBody.zod.js +49 -0
- package/dist/compute/v2/generated/validators/updateLaunchTemplateRequestBody.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/updateLaunchTemplateRequestBody.zod.js +48 -0
- package/dist/compute/v2/generated/validators/updateNetworkInterfaceRequestBody.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/updateNetworkInterfaceRequestBody.zod.js +49 -0
- package/dist/compute/v2/generated/validators/updatePrivateImageRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/updatePrivateImageRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/updateSecurityGroupRequestBody.zod.d.ts +43 -0
- package/dist/compute/v2/generated/validators/updateSecurityGroupRequestBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/updateVirtualPrivateCloudRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/updateVirtualPrivateCloudRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/updateVirtualPrivateCloudSubnetRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/updateVirtualPrivateCloudSubnetRequestBody.zod.js +39 -0
- package/dist/compute/v2/generated/validators/updateVolumeBackupRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/updateVolumeBackupRequestBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/updateVolumeRequestBody.zod.d.ts +52 -0
- package/dist/compute/v2/generated/validators/updateVolumeRequestBody.zod.js +54 -0
- package/dist/compute/v2/generated/validators/updateVolumeResponseBody.zod.d.ts +149 -0
- package/dist/compute/v2/generated/validators/updateVolumeResponseBody.zod.js +49 -0
- package/dist/compute/v2/generated/validators/updateVolumeSnapshotRequestBody.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/updateVolumeSnapshotRequestBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloud.zod.d.ts +60 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloud.zod.js +56 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudIDOrWildcard.zod.d.ts +39 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudIDOrWildcard.zod.js +40 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudListResponseBody.zod.d.ts +67 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudOperation.zod.d.ts +46 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudOperation.zod.js +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringListResponseBody.zod.d.ts +73 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringOperation.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringOperation.zod.js +43 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringResource.zod.d.ts +66 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudPeeringResource.zod.js +62 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteListResponseBody.zod.d.ts +57 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteResource.zod.d.ts +50 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteResource.zod.js +54 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteType.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudRouteType.zod.js +38 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudSubnet.zod.d.ts +48 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudSubnet.zod.js +54 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudSubnetListResponseBody.zod.d.ts +55 -0
- package/dist/compute/v2/generated/validators/virtualPrivateCloudSubnetListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeAttachment.zod.d.ts +63 -0
- package/dist/compute/v2/generated/validators/volumeAttachment.zod.js +56 -0
- package/dist/compute/v2/generated/validators/volumeAttachmentList.zod.d.ts +70 -0
- package/dist/compute/v2/generated/validators/volumeAttachmentList.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeBackupID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/volumeBackupID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/volumeBackupListResponseBody.zod.d.ts +115 -0
- package/dist/compute/v2/generated/validators/volumeBackupListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeBackupOperation.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/volumeBackupOperation.zod.js +43 -0
- package/dist/compute/v2/generated/validators/volumeBackupReleaseResource.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/volumeBackupReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/volumeBackupResource.zod.d.ts +108 -0
- package/dist/compute/v2/generated/validators/volumeBackupResource.zod.js +90 -0
- package/dist/compute/v2/generated/validators/volumeID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/volumeID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/volumeListResponseBody.zod.d.ts +152 -0
- package/dist/compute/v2/generated/validators/volumeListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeOperation.zod.d.ts +51 -0
- package/dist/compute/v2/generated/validators/volumeOperation.zod.js +53 -0
- package/dist/compute/v2/generated/validators/volumePerformance.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/volumePerformance.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeReleaseResource.zod.d.ts +44 -0
- package/dist/compute/v2/generated/validators/volumeReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/volumeResource.zod.d.ts +145 -0
- package/dist/compute/v2/generated/validators/volumeResource.zod.js +93 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotListResponseBody.zod.d.ts +114 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotOperation.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotOperation.zod.js +43 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotReleaseResource.zod.d.ts +45 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotReleaseResource.zod.js +43 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotResource.zod.d.ts +107 -0
- package/dist/compute/v2/generated/validators/volumeSnapshotResource.zod.js +87 -0
- package/dist/compute/v2/generated/validators/volumeTypeID.zod.d.ts +41 -0
- package/dist/compute/v2/generated/validators/volumeTypeID.zod.js +44 -0
- package/dist/compute/v2/generated/validators/volumeTypeListResponseBody.zod.d.ts +103 -0
- package/dist/compute/v2/generated/validators/volumeTypeListResponseBody.zod.js +41 -0
- package/dist/compute/v2/generated/validators/volumeTypePerformance.zod.d.ts +51 -0
- package/dist/compute/v2/generated/validators/volumeTypePerformance.zod.js +42 -0
- package/dist/compute/v2/generated/validators/volumeTypeResource.zod.d.ts +96 -0
- package/dist/compute/v2/generated/validators/volumeTypeResource.zod.js +55 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/routes.d.ts +362 -236
- package/dist/routes.js +376 -236
- package/package.json +1 -1
- package/dist/compute/v1/generated/functions.d.ts +0 -2481
- package/dist/compute/v1/generated/functions.js +0 -2736
- package/dist/compute/v1/generated/models.d.ts +0 -2813
- package/dist/compute/v1/generated/models.js +0 -363
- package/dist/compute/v1/generated/schemas.zod.d.ts +0 -1501
- package/dist/compute/v1/generated/schemas.zod.js +0 -1390
- package/dist/compute/v1/generated/validators/allocateFloatingIPRequestBody.zod.d.ts +0 -59
- package/dist/compute/v1/generated/validators/allocateFloatingIPRequestBody.zod.js +0 -44
- package/dist/compute/v1/generated/validators/allocateFloatingIPResponseBody.zod.d.ts +0 -99
- package/dist/compute/v1/generated/validators/allocateFloatingIPResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/attachDiskRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/attachDiskRequestBody.zod.js +0 -27
- package/dist/compute/v1/generated/validators/attachFloatingIPRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/attachFloatingIPRequestBody.zod.js +0 -27
- package/dist/compute/v1/generated/validators/attachPortRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/attachPortRequestBody.zod.js +0 -27
- package/dist/compute/v1/generated/validators/backupCapacityPack.zod.d.ts +0 -44
- package/dist/compute/v1/generated/validators/backupCapacityPack.zod.js +0 -58
- package/dist/compute/v1/generated/validators/backupCapacityPackListResponseBody.zod.d.ts +0 -51
- package/dist/compute/v1/generated/validators/backupCapacityPackListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/backupListResponseBody.zod.d.ts +0 -61
- package/dist/compute/v1/generated/validators/backupListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/backupOperation.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/backupOperation.zod.js +0 -32
- package/dist/compute/v1/generated/validators/backupResource.zod.d.ts +0 -54
- package/dist/compute/v1/generated/validators/backupResource.zod.js +0 -53
- package/dist/compute/v1/generated/validators/backupService.zod.d.ts +0 -46
- package/dist/compute/v1/generated/validators/backupService.zod.js +0 -68
- package/dist/compute/v1/generated/validators/billingChoice.zod.d.ts +0 -43
- package/dist/compute/v1/generated/validators/billingChoice.zod.js +0 -35
- package/dist/compute/v1/generated/validators/billingComponent.zod.d.ts +0 -54
- package/dist/compute/v1/generated/validators/billingComponent.zod.js +0 -43
- package/dist/compute/v1/generated/validators/billingMeter.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/billingMeter.zod.js +0 -34
- package/dist/compute/v1/generated/validators/billingPeriod.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/billingPeriod.zod.js +0 -29
- package/dist/compute/v1/generated/validators/billingQuantity.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/billingQuantity.zod.js +0 -27
- package/dist/compute/v1/generated/validators/bindFloatingIPRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/bindFloatingIPRequestBody.zod.js +0 -27
- package/dist/compute/v1/generated/validators/bootDisk.zod.d.ts +0 -58
- package/dist/compute/v1/generated/validators/bootDisk.zod.js +0 -29
- package/dist/compute/v1/generated/validators/cancellationMode.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/cancellationMode.zod.js +0 -27
- package/dist/compute/v1/generated/validators/checkoutMode.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/checkoutMode.zod.js +0 -27
- package/dist/compute/v1/generated/validators/checkoutOptions.zod.d.ts +0 -37
- package/dist/compute/v1/generated/validators/checkoutOptions.zod.js +0 -42
- package/dist/compute/v1/generated/validators/commandResultResponseBody.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/commandResultResponseBody.zod.js +0 -38
- package/dist/compute/v1/generated/validators/consoleOutputResponseBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/consoleOutputResponseBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/consoleResponseBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/consoleResponseBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/createBackupCapacityPackRequestBody.zod.d.ts +0 -54
- package/dist/compute/v1/generated/validators/createBackupCapacityPackRequestBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/createBackupCapacityPackResponseBody.zod.d.ts +0 -48
- package/dist/compute/v1/generated/validators/createBackupCapacityPackResponseBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/createBackupRequestBody.zod.d.ts +0 -31
- package/dist/compute/v1/generated/validators/createBackupRequestBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/createBackupServiceRequestBody.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/createBackupServiceRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/createBackupServiceResponseBody.zod.d.ts +0 -48
- package/dist/compute/v1/generated/validators/createBackupServiceResponseBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/createDiskRequestBody.zod.d.ts +0 -59
- package/dist/compute/v1/generated/validators/createDiskRequestBody.zod.js +0 -42
- package/dist/compute/v1/generated/validators/createDiskResponseBody.zod.d.ts +0 -109
- package/dist/compute/v1/generated/validators/createDiskResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/createImageRequestBody.zod.d.ts +0 -56
- package/dist/compute/v1/generated/validators/createImageRequestBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/createImageResponseBody.zod.d.ts +0 -94
- package/dist/compute/v1/generated/validators/createImageResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/createPeeringRequestBody.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/createPeeringRequestBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/createPortRequestBody.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/createPortRequestBody.zod.js +0 -40
- package/dist/compute/v1/generated/validators/createPrivateNetworkRequestBody.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/createPrivateNetworkRequestBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/createRouteRequestBody.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/createRouteRequestBody.zod.js +0 -40
- package/dist/compute/v1/generated/validators/createSecurityGroupRequestBody.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/createSecurityGroupRequestBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/createSecurityRuleRequestBody.zod.d.ts +0 -44
- package/dist/compute/v1/generated/validators/createSecurityRuleRequestBody.zod.js +0 -50
- package/dist/compute/v1/generated/validators/createSnapshotRequestBody.zod.d.ts +0 -31
- package/dist/compute/v1/generated/validators/createSnapshotRequestBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/createSubnetRequestBody.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/createSubnetRequestBody.zod.js +0 -34
- package/dist/compute/v1/generated/validators/cursorPagination.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/cursorPagination.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteBackupCapacityPackParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteBackupCapacityPackParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteBackupServiceParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteBackupServiceParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteDiskParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteDiskParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteDiskResponseBody.zod.d.ts +0 -121
- package/dist/compute/v1/generated/validators/deleteDiskResponseBody.zod.js +0 -32
- package/dist/compute/v1/generated/validators/deleteImageParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteImageParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteImageResponseBody.zod.d.ts +0 -106
- package/dist/compute/v1/generated/validators/deleteImageResponseBody.zod.js +0 -32
- package/dist/compute/v1/generated/validators/deleteInstanceParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteInstanceParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/deleteInstanceResponseBody.zod.d.ts +0 -135
- package/dist/compute/v1/generated/validators/deleteInstanceResponseBody.zod.js +0 -32
- package/dist/compute/v1/generated/validators/deleteSnapshotQuotaParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/deleteSnapshotQuotaParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/diskAttachment.zod.d.ts +0 -46
- package/dist/compute/v1/generated/validators/diskAttachment.zod.js +0 -36
- package/dist/compute/v1/generated/validators/diskAttachmentList.zod.d.ts +0 -53
- package/dist/compute/v1/generated/validators/diskAttachmentList.zod.js +0 -30
- package/dist/compute/v1/generated/validators/diskListResponseBody.zod.d.ts +0 -112
- package/dist/compute/v1/generated/validators/diskListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/diskOperation.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/diskOperation.zod.js +0 -32
- package/dist/compute/v1/generated/validators/diskResource.zod.d.ts +0 -105
- package/dist/compute/v1/generated/validators/diskResource.zod.js +0 -100
- package/dist/compute/v1/generated/validators/diskTypeListResponseBody.zod.d.ts +0 -83
- package/dist/compute/v1/generated/validators/diskTypeListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/diskTypePurpose.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/diskTypePurpose.zod.js +0 -27
- package/dist/compute/v1/generated/validators/diskTypeResource.zod.d.ts +0 -76
- package/dist/compute/v1/generated/validators/diskTypeResource.zod.js +0 -54
- package/dist/compute/v1/generated/validators/error.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/error.zod.js +0 -33
- package/dist/compute/v1/generated/validators/existingBootDisk.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/existingBootDisk.zod.js +0 -36
- package/dist/compute/v1/generated/validators/floatingIPListResponseBody.zod.d.ts +0 -102
- package/dist/compute/v1/generated/validators/floatingIPListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/floatingIPOperation.zod.d.ts +0 -38
- package/dist/compute/v1/generated/validators/floatingIPOperation.zod.js +0 -30
- package/dist/compute/v1/generated/validators/floatingIPResource.zod.d.ts +0 -95
- package/dist/compute/v1/generated/validators/floatingIPResource.zod.js +0 -93
- package/dist/compute/v1/generated/validators/getInstanceConsoleOutputParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/getInstanceConsoleOutputParams.zod.js +0 -35
- package/dist/compute/v1/generated/validators/iPv4Binding.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/iPv4Binding.zod.js +0 -35
- package/dist/compute/v1/generated/validators/iPv4PoolListResponseBody.zod.d.ts +0 -66
- package/dist/compute/v1/generated/validators/iPv4PoolListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/iPv4PoolResource.zod.d.ts +0 -59
- package/dist/compute/v1/generated/validators/iPv4PoolResource.zod.js +0 -31
- package/dist/compute/v1/generated/validators/iPv6ResponseBody.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/iPv6ResponseBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/imageListResponseBody.zod.d.ts +0 -97
- package/dist/compute/v1/generated/validators/imageListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/imageOperation.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/imageOperation.zod.js +0 -32
- package/dist/compute/v1/generated/validators/imageResource.zod.d.ts +0 -91
- package/dist/compute/v1/generated/validators/imageResource.zod.js +0 -117
- package/dist/compute/v1/generated/validators/imageVisibility.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/imageVisibility.zod.js +0 -27
- package/dist/compute/v1/generated/validators/instanceListResponseBody.zod.d.ts +0 -126
- package/dist/compute/v1/generated/validators/instanceListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/instanceOperation.zod.d.ts +0 -47
- package/dist/compute/v1/generated/validators/instanceOperation.zod.js +0 -49
- package/dist/compute/v1/generated/validators/instanceResource.zod.d.ts +0 -122
- package/dist/compute/v1/generated/validators/instanceResource.zod.js +0 -130
- package/dist/compute/v1/generated/validators/instanceRestriction.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/instanceRestriction.zod.js +0 -35
- package/dist/compute/v1/generated/validators/instanceTypeListResponseBody.zod.d.ts +0 -74
- package/dist/compute/v1/generated/validators/instanceTypeListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/instanceTypeResource.zod.d.ts +0 -67
- package/dist/compute/v1/generated/validators/instanceTypeResource.zod.js +0 -47
- package/dist/compute/v1/generated/validators/launchInstanceRequestBody.zod.d.ts +0 -121
- package/dist/compute/v1/generated/validators/launchInstanceRequestBody.zod.js +0 -71
- package/dist/compute/v1/generated/validators/launchInstanceResponseBody.zod.d.ts +0 -125
- package/dist/compute/v1/generated/validators/launchInstanceResponseBody.zod.js +0 -46
- package/dist/compute/v1/generated/validators/listAvailabilityZonesParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listAvailabilityZonesParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listBackupCapacityPacksParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listBackupCapacityPacksParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listBackupsParams.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/listBackupsParams.zod.js +0 -37
- package/dist/compute/v1/generated/validators/listDiskTypesParams.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/listDiskTypesParams.zod.js +0 -39
- package/dist/compute/v1/generated/validators/listDisksParams.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/listDisksParams.zod.js +0 -38
- package/dist/compute/v1/generated/validators/listFloatingIpsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listFloatingIpsParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listImagesParams.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/listImagesParams.zod.js +0 -39
- package/dist/compute/v1/generated/validators/listInstanceDisksParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listInstanceDisksParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listInstancePortsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listInstancePortsParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listInstanceTypesParams.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/listInstanceTypesParams.zod.js +0 -41
- package/dist/compute/v1/generated/validators/listInstancesParams.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/listInstancesParams.zod.js +0 -42
- package/dist/compute/v1/generated/validators/listIpv4PoolsParams.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/listIpv4PoolsParams.zod.js +0 -37
- package/dist/compute/v1/generated/validators/listOperationLogsParams.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/listOperationLogsParams.zod.js +0 -46
- package/dist/compute/v1/generated/validators/listPeeringsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listPeeringsParams.zod.js +0 -36
- package/dist/compute/v1/generated/validators/listPortsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listPortsParams.zod.js +0 -36
- package/dist/compute/v1/generated/validators/listPrivateNetworksParams.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/listPrivateNetworksParams.zod.js +0 -41
- package/dist/compute/v1/generated/validators/listRegionsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listRegionsParams.zod.js +0 -36
- package/dist/compute/v1/generated/validators/listRoutesParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listRoutesParams.zod.js +0 -36
- package/dist/compute/v1/generated/validators/listSecurityGroupRulesParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listSecurityGroupRulesParams.zod.js +0 -40
- package/dist/compute/v1/generated/validators/listSecurityGroupsParams.zod.d.ts +0 -36
- package/dist/compute/v1/generated/validators/listSecurityGroupsParams.zod.js +0 -45
- package/dist/compute/v1/generated/validators/listSnapshotsParams.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/listSnapshotsParams.zod.js +0 -37
- package/dist/compute/v1/generated/validators/listSubnetsParams.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/listSubnetsParams.zod.js +0 -36
- package/dist/compute/v1/generated/validators/money.zod.d.ts +0 -27
- package/dist/compute/v1/generated/validators/money.zod.js +0 -27
- package/dist/compute/v1/generated/validators/newBootDisk.zod.d.ts +0 -54
- package/dist/compute/v1/generated/validators/newBootDisk.zod.js +0 -42
- package/dist/compute/v1/generated/validators/newCompute.zod.d.ts +0 -47
- package/dist/compute/v1/generated/validators/newCompute.zod.js +0 -35
- package/dist/compute/v1/generated/validators/newFloatingIP.zod.d.ts +0 -48
- package/dist/compute/v1/generated/validators/newFloatingIP.zod.js +0 -33
- package/dist/compute/v1/generated/validators/nextFreeCidrResponseBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/nextFreeCidrResponseBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/offsetPagination.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/offsetPagination.zod.js +0 -32
- package/dist/compute/v1/generated/validators/operationLogListResponseBody.zod.d.ts +0 -47
- package/dist/compute/v1/generated/validators/operationLogListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/operationLogResource.zod.d.ts +0 -40
- package/dist/compute/v1/generated/validators/operationLogResource.zod.js +0 -48
- package/dist/compute/v1/generated/validators/peeringListResponseBody.zod.d.ts +0 -59
- package/dist/compute/v1/generated/validators/peeringListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/peeringOperation.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/peeringOperation.zod.js +0 -32
- package/dist/compute/v1/generated/validators/peeringResource.zod.d.ts +0 -52
- package/dist/compute/v1/generated/validators/peeringResource.zod.js +0 -47
- package/dist/compute/v1/generated/validators/portAddress.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/portAddress.zod.js +0 -34
- package/dist/compute/v1/generated/validators/portAttachment.zod.d.ts +0 -45
- package/dist/compute/v1/generated/validators/portAttachment.zod.js +0 -35
- package/dist/compute/v1/generated/validators/portAttachmentList.zod.d.ts +0 -52
- package/dist/compute/v1/generated/validators/portAttachmentList.zod.js +0 -30
- package/dist/compute/v1/generated/validators/portListResponseBody.zod.d.ts +0 -91
- package/dist/compute/v1/generated/validators/portListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/portOperation.zod.d.ts +0 -35
- package/dist/compute/v1/generated/validators/portOperation.zod.js +0 -30
- package/dist/compute/v1/generated/validators/portResource.zod.d.ts +0 -84
- package/dist/compute/v1/generated/validators/portResource.zod.js +0 -47
- package/dist/compute/v1/generated/validators/powerRequest.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/powerRequest.zod.js +0 -27
- package/dist/compute/v1/generated/validators/privateNetworkListResponseBody.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/privateNetworkListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/privateNetworkResource.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/privateNetworkResource.zod.js +0 -32
- package/dist/compute/v1/generated/validators/rebootInstanceRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/rebootInstanceRequestBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/rebuildInstanceRequestBody.zod.d.ts +0 -33
- package/dist/compute/v1/generated/validators/rebuildInstanceRequestBody.zod.js +0 -34
- package/dist/compute/v1/generated/validators/rebuildInstanceResponseBody.zod.d.ts +0 -122
- package/dist/compute/v1/generated/validators/rebuildInstanceResponseBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/regionListResponseBody.zod.d.ts +0 -151
- package/dist/compute/v1/generated/validators/regionListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/regionResource.zod.d.ts +0 -144
- package/dist/compute/v1/generated/validators/regionResource.zod.js +0 -45
- package/dist/compute/v1/generated/validators/releaseFloatingIPResponseBody.zod.d.ts +0 -111
- package/dist/compute/v1/generated/validators/releaseFloatingIPResponseBody.zod.js +0 -32
- package/dist/compute/v1/generated/validators/releaseFloatingIpParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/releaseFloatingIpParams.zod.js +0 -30
- package/dist/compute/v1/generated/validators/releaseResource.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/releaseResource.zod.js +0 -43
- package/dist/compute/v1/generated/validators/releaseSetItem.zod.d.ts +0 -42
- package/dist/compute/v1/generated/validators/releaseSetItem.zod.js +0 -31
- package/dist/compute/v1/generated/validators/renameBackupRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameBackupRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renameDiskRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameDiskRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renameImageRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameImageRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renameInstanceRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameInstanceRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renamePrivateNetworkRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renamePrivateNetworkRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renameSecurityGroupRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameSecurityGroupRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/renameSnapshotRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/renameSnapshotRequestBody.zod.js +0 -28
- package/dist/compute/v1/generated/validators/resetPasswordRequestBody.zod.d.ts +0 -31
- package/dist/compute/v1/generated/validators/resetPasswordRequestBody.zod.js +0 -36
- package/dist/compute/v1/generated/validators/resetPasswordResponseBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/resetPasswordResponseBody.zod.js +0 -29
- package/dist/compute/v1/generated/validators/resizeDiskRequestBody.zod.d.ts +0 -38
- package/dist/compute/v1/generated/validators/resizeDiskRequestBody.zod.js +0 -33
- package/dist/compute/v1/generated/validators/resizeDiskResponseBody.zod.d.ts +0 -109
- package/dist/compute/v1/generated/validators/resizeDiskResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/resizeInstanceRequestBody.zod.d.ts +0 -39
- package/dist/compute/v1/generated/validators/resizeInstanceRequestBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/resizeInstanceResponseBody.zod.d.ts +0 -123
- package/dist/compute/v1/generated/validators/resizeInstanceResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/resourceCancellation.zod.d.ts +0 -40
- package/dist/compute/v1/generated/validators/resourceCancellation.zod.js +0 -39
- package/dist/compute/v1/generated/validators/restoreBackupRequestBody.zod.d.ts +0 -59
- package/dist/compute/v1/generated/validators/restoreBackupRequestBody.zod.js +0 -43
- package/dist/compute/v1/generated/validators/revertDiskRequestBody.zod.d.ts +0 -29
- package/dist/compute/v1/generated/validators/revertDiskRequestBody.zod.js +0 -27
- package/dist/compute/v1/generated/validators/routeListResponseBody.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/routeListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/routeResource.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/routeResource.zod.js +0 -38
- package/dist/compute/v1/generated/validators/runCommandRequestBody.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/runCommandRequestBody.zod.js +0 -39
- package/dist/compute/v1/generated/validators/securityGroupListResponseBody.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/securityGroupListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/securityGroupResource.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/securityGroupResource.zod.js +0 -34
- package/dist/compute/v1/generated/validators/securityRuleListResponseBody.zod.d.ts +0 -50
- package/dist/compute/v1/generated/validators/securityRuleListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/securityRuleResource.zod.d.ts +0 -43
- package/dist/compute/v1/generated/validators/securityRuleResource.zod.js +0 -41
- package/dist/compute/v1/generated/validators/setFloatingIPBandwidthRequestBody.zod.d.ts +0 -38
- package/dist/compute/v1/generated/validators/setFloatingIPBandwidthRequestBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/setFloatingIPBandwidthResponseBody.zod.d.ts +0 -99
- package/dist/compute/v1/generated/validators/setFloatingIPBandwidthResponseBody.zod.js +0 -37
- package/dist/compute/v1/generated/validators/setInstanceLabelsRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/setInstanceLabelsRequestBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/setInstanceNotesRequestBody.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/setInstanceNotesRequestBody.zod.js +0 -31
- package/dist/compute/v1/generated/validators/setSnapshotQuotaRequestBody.zod.d.ts +0 -55
- package/dist/compute/v1/generated/validators/setSnapshotQuotaRequestBody.zod.js +0 -38
- package/dist/compute/v1/generated/validators/setSnapshotQuotaResponseBody.zod.d.ts +0 -68
- package/dist/compute/v1/generated/validators/setSnapshotQuotaResponseBody.zod.js +0 -35
- package/dist/compute/v1/generated/validators/snapshotListResponseBody.zod.d.ts +0 -61
- package/dist/compute/v1/generated/validators/snapshotListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/snapshotOperation.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/snapshotOperation.zod.js +0 -32
- package/dist/compute/v1/generated/validators/snapshotQuota.zod.d.ts +0 -67
- package/dist/compute/v1/generated/validators/snapshotQuota.zod.js +0 -86
- package/dist/compute/v1/generated/validators/snapshotResource.zod.d.ts +0 -54
- package/dist/compute/v1/generated/validators/snapshotResource.zod.js +0 -48
- package/dist/compute/v1/generated/validators/subnetListResponseBody.zod.d.ts +0 -41
- package/dist/compute/v1/generated/validators/subnetListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/subnetResource.zod.d.ts +0 -34
- package/dist/compute/v1/generated/validators/subnetResource.zod.js +0 -32
- package/dist/compute/v1/generated/validators/suggestSubnetCidrParams.zod.d.ts +0 -32
- package/dist/compute/v1/generated/validators/suggestSubnetCidrParams.zod.js +0 -34
- package/dist/compute/v1/generated/validators/terminationPolicy.zod.d.ts +0 -30
- package/dist/compute/v1/generated/validators/terminationPolicy.zod.js +0 -27
- package/dist/compute/v1/generated/validators/zoneListResponseBody.zod.d.ts +0 -38
- package/dist/compute/v1/generated/validators/zoneListResponseBody.zod.js +0 -30
- package/dist/compute/v1/generated/validators/zoneResource.zod.d.ts +0 -31
- package/dist/compute/v1/generated/validators/zoneResource.zod.js +0 -33
- /package/dist/compute/{v1 → v2}/index.d.ts +0 -0
- /package/dist/compute/{v1 → v2}/index.js +0 -0
|
@@ -0,0 +1,3040 @@
|
|
|
1
|
+
export const getListAvailabilityZonesUrl = (params) => {
|
|
2
|
+
const normalizedParams = new URLSearchParams();
|
|
3
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
4
|
+
if (value !== undefined) {
|
|
5
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const stringifiedParams = normalizedParams.toString();
|
|
9
|
+
return stringifiedParams.length > 0
|
|
10
|
+
? `https://compute.leaflow.cloud/api/v2/availability-zones?${stringifiedParams}`
|
|
11
|
+
: `https://compute.leaflow.cloud/api/v2/availability-zones`;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A volume and an instance must reside in the same availability zone to be attached. Confirm the zone before creating either. Without `region_id`, the zones of every region are listed.
|
|
15
|
+
* @summary List availability zones
|
|
16
|
+
*/
|
|
17
|
+
export const listAvailabilityZones = async (params, options, fetchFn) => {
|
|
18
|
+
const res = await (fetchFn ?? fetch)(getListAvailabilityZonesUrl(params), {
|
|
19
|
+
...options,
|
|
20
|
+
method: "GET",
|
|
21
|
+
});
|
|
22
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
23
|
+
const data = body ? JSON.parse(body) : {};
|
|
24
|
+
return { data, status: res.status, headers: res.headers };
|
|
25
|
+
};
|
|
26
|
+
export const getGetAvailabilityZoneUrl = (availabilityZoneId) => {
|
|
27
|
+
return `https://compute.leaflow.cloud/api/v2/availability-zones/${encodeURIComponent(String(availabilityZoneId))}`;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A volume and an instance must reside in the same availability zone to be attached.
|
|
31
|
+
* @summary Retrieve an availability zone
|
|
32
|
+
*/
|
|
33
|
+
export const getAvailabilityZone = async (availabilityZoneId, options, fetchFn) => {
|
|
34
|
+
const res = await (fetchFn ?? fetch)(getGetAvailabilityZoneUrl(availabilityZoneId), {
|
|
35
|
+
...options,
|
|
36
|
+
method: "GET",
|
|
37
|
+
});
|
|
38
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
39
|
+
const data = body ? JSON.parse(body) : {};
|
|
40
|
+
return { data, status: res.status, headers: res.headers };
|
|
41
|
+
};
|
|
42
|
+
export const getListElasticIpLinesUrl = (params) => {
|
|
43
|
+
const normalizedParams = new URLSearchParams();
|
|
44
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
45
|
+
if (value !== undefined) {
|
|
46
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const stringifiedParams = normalizedParams.toString();
|
|
50
|
+
return stringifiedParams.length > 0
|
|
51
|
+
? `https://compute.leaflow.cloud/api/v2/elastic-ip-lines?${stringifiedParams}`
|
|
52
|
+
: `https://compute.leaflow.cloud/api/v2/elastic-ip-lines`;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Lists the lines on sale. A line is the network an elastic IP is bought on, with the bandwidth that can be chosen and the two Billing Plans its elastic IPs are paid under. Region is optional. Prices, commercial terms and checkout are read directly from Billing. `q` searches the names and descriptions of the lines on sale; filters combine with AND, and pagination is independent of them.
|
|
56
|
+
* @summary List and search elastic IP lines
|
|
57
|
+
*/
|
|
58
|
+
export const listElasticIpLines = async (params, options, fetchFn) => {
|
|
59
|
+
const res = await (fetchFn ?? fetch)(getListElasticIpLinesUrl(params), {
|
|
60
|
+
...options,
|
|
61
|
+
method: "GET",
|
|
62
|
+
});
|
|
63
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
64
|
+
const data = body ? JSON.parse(body) : {};
|
|
65
|
+
return { data, status: res.status, headers: res.headers };
|
|
66
|
+
};
|
|
67
|
+
export const getGetElasticIpLineUrl = (elasticIpLineId) => {
|
|
68
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ip-lines/${encodeURIComponent(String(elasticIpLineId))}`;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Includes lines off sale that existing elastic IPs are on. No inventory or gateway facts are returned.
|
|
72
|
+
* @summary Get an elastic IP line
|
|
73
|
+
*/
|
|
74
|
+
export const getElasticIpLine = async (elasticIpLineId, options, fetchFn) => {
|
|
75
|
+
const res = await (fetchFn ?? fetch)(getGetElasticIpLineUrl(elasticIpLineId), {
|
|
76
|
+
...options,
|
|
77
|
+
method: "GET",
|
|
78
|
+
});
|
|
79
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
80
|
+
const data = body ? JSON.parse(body) : {};
|
|
81
|
+
return { data, status: res.status, headers: res.headers };
|
|
82
|
+
};
|
|
83
|
+
export const getListElasticIpsUrl = (params) => {
|
|
84
|
+
const normalizedParams = new URLSearchParams();
|
|
85
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const stringifiedParams = normalizedParams.toString();
|
|
91
|
+
return stringifiedParams.length > 0
|
|
92
|
+
? `https://compute.leaflow.cloud/api/v2/elastic-ips?${stringifiedParams}`
|
|
93
|
+
: `https://compute.leaflow.cloud/api/v2/elastic-ips`;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* @summary List elastic IPs
|
|
97
|
+
*/
|
|
98
|
+
export const listElasticIps = async (params, options, fetchFn) => {
|
|
99
|
+
const res = await (fetchFn ?? fetch)(getListElasticIpsUrl(params), {
|
|
100
|
+
...options,
|
|
101
|
+
method: "GET",
|
|
102
|
+
});
|
|
103
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
104
|
+
const data = body ? JSON.parse(body) : {};
|
|
105
|
+
return { data, status: res.status, headers: res.headers };
|
|
106
|
+
};
|
|
107
|
+
export const getCreateElasticIpUrl = () => {
|
|
108
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips`;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Select an elastic IP line. The elastic IP is bought through a Billing Checkout Session, and no address is allocated before its order is accepted.
|
|
112
|
+
*
|
|
113
|
+
* The line has to have an address left, counted before anything is ordered: refused with 409 `ELASTIC_IP_LINE_EXHAUSTED` when every address it sells is held or already promised to a purchase waiting for its order. Two purchases checked at the same moment can both pass on the last address; the later one ends `failed` with `provisioning_failed` and its charge is refunded.
|
|
114
|
+
*
|
|
115
|
+
* Returns the elastic IP as `pending` with its Checkout Session; `address` is null until the address is allocated after the order is accepted. A requested `address` is not held while pending; if it is no longer available then, the elastic IP ends `failed` with `provisioning_failed` and its charge is refunded.
|
|
116
|
+
*
|
|
117
|
+
* IPv6 is not requested through this endpoint. IPv6 addresses are assigned to instances by the virtual private cloud; enable IPv6 on that network instead.
|
|
118
|
+
*
|
|
119
|
+
* Allocation does not select or create a virtual private cloud. A later association selects an assigned network-interface address; Compute then establishes the required network connectivity.
|
|
120
|
+
*
|
|
121
|
+
* The elastic IP shows the `create` operation from the moment its Checkout Session is created until it is delivered or its checkout or order ends. Every other operation on it is refused with `COMPUTE_RESOURCE_BUSY` meanwhile, and its deletion with `COMPUTE_PURCHASE_PENDING` while its purchase awaits checkout or payment.
|
|
122
|
+
* @summary Allocate an elastic IP
|
|
123
|
+
*/
|
|
124
|
+
export const createElasticIp = async (createElasticIPRequestBody, options, fetchFn) => {
|
|
125
|
+
const getHeaders = (h) => {
|
|
126
|
+
if (!h)
|
|
127
|
+
return {};
|
|
128
|
+
if (h instanceof Headers)
|
|
129
|
+
return Object.fromEntries(h.entries());
|
|
130
|
+
if (Symbol.iterator in h) {
|
|
131
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
132
|
+
}
|
|
133
|
+
const headers = {};
|
|
134
|
+
for (const [name, value] of Object.entries(h)) {
|
|
135
|
+
if (value !== undefined)
|
|
136
|
+
headers[name] = value;
|
|
137
|
+
}
|
|
138
|
+
return headers;
|
|
139
|
+
};
|
|
140
|
+
const res = await (fetchFn ?? fetch)(getCreateElasticIpUrl(), {
|
|
141
|
+
...options,
|
|
142
|
+
method: "POST",
|
|
143
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
144
|
+
body: JSON.stringify(createElasticIPRequestBody),
|
|
145
|
+
});
|
|
146
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
147
|
+
const data = body ? JSON.parse(body) : {};
|
|
148
|
+
return { data, status: res.status, headers: res.headers };
|
|
149
|
+
};
|
|
150
|
+
export const getGetElasticIpUrl = (elasticIpId) => {
|
|
151
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}`;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* @summary Retrieve an elastic IP
|
|
155
|
+
*/
|
|
156
|
+
export const getElasticIp = async (elasticIpId, options, fetchFn) => {
|
|
157
|
+
const res = await (fetchFn ?? fetch)(getGetElasticIpUrl(elasticIpId), {
|
|
158
|
+
...options,
|
|
159
|
+
method: "GET",
|
|
160
|
+
});
|
|
161
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
162
|
+
const data = body ? JSON.parse(body) : {};
|
|
163
|
+
return { data, status: res.status, headers: res.headers };
|
|
164
|
+
};
|
|
165
|
+
export const getUpdateElasticIpUrl = (elasticIpId) => {
|
|
166
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}`;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Changes the bandwidth of this elastic IP, or what its pay-as-you-go network subscription charges for. `bandwidth_mbps` and `internet_charge_type` are operational fields: each starts a change and cannot be combined with any other field in the same request. Such a request is refused with 422 `UPDATE_FIELDS_COMBINED`, because a change that committed beside another that was then refused would leave the request half applied. An elastic IP has no descriptive field today, so 200 is reserved for the fields that may be added to it and every accepted update answers 202. `checkout` and `proration_date` belong to the purchase of the `bandwidth_mbps` change and are accepted only together with it.
|
|
170
|
+
*
|
|
171
|
+
* No separate bandwidth resource is created, and the limit applies to inbound and outbound traffic alike. The new value may be any whole number of Mbps within the line's bandwidth range, otherwise the request is refused with `ELASTIC_IP_BANDWIDTH_RANGE`. How the change is paid follows the elastic IP's network subscription:
|
|
172
|
+
*
|
|
173
|
+
* - **Prepaid**: the change goes through a Checkout Session that changes the network subscription, priced for the rest of its period. It starts once Billing accepts the order; if checkout is not completed, the order is not accepted or the change fails, `bandwidth_mbps` keeps its value and Billing shows the outcome.
|
|
174
|
+
* - **Pay-as-you-go**: there is no checkout. The change starts at once, `checkout_session_id` and `order_id` are null, and the new limit is metered from the instant it is applied; if it fails, the old limit stays in effect and metered. `checkout` and `proration_date` are refused with `ELASTIC_IP_CHECKOUT_UNUSED`.
|
|
175
|
+
*
|
|
176
|
+
* A change of `internet_charge_type` needs no checkout and shows the `update_internet_charge_type` operation until it is applied; see the field.
|
|
177
|
+
*
|
|
178
|
+
* The elastic IP shows the `update_bandwidth` operation until the change is applied or ends, so other operations and a second change are refused with `COMPUTE_RESOURCE_BUSY` meanwhile. The current limit stays in effect until the change is applied.
|
|
179
|
+
*
|
|
180
|
+
* While the address is associated with an instance, the limit must not exceed the `max_bandwidth_mbps` of that instance's type; a higher limit is refused with `INSTANCE_BANDWIDTH_CEILING`. The limit of an address that is not associated is checked when the address is associated with an instance.
|
|
181
|
+
* @summary Update an elastic IP
|
|
182
|
+
*/
|
|
183
|
+
export const updateElasticIp = async (elasticIpId, updateElasticIPRequestBody, options, fetchFn) => {
|
|
184
|
+
const getHeaders = (h) => {
|
|
185
|
+
if (!h)
|
|
186
|
+
return {};
|
|
187
|
+
if (h instanceof Headers)
|
|
188
|
+
return Object.fromEntries(h.entries());
|
|
189
|
+
if (Symbol.iterator in h) {
|
|
190
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
191
|
+
}
|
|
192
|
+
const headers = {};
|
|
193
|
+
for (const [name, value] of Object.entries(h)) {
|
|
194
|
+
if (value !== undefined)
|
|
195
|
+
headers[name] = value;
|
|
196
|
+
}
|
|
197
|
+
return headers;
|
|
198
|
+
};
|
|
199
|
+
const res = await (fetchFn ?? fetch)(getUpdateElasticIpUrl(elasticIpId), {
|
|
200
|
+
...options,
|
|
201
|
+
method: "PATCH",
|
|
202
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
203
|
+
body: JSON.stringify(updateElasticIPRequestBody),
|
|
204
|
+
});
|
|
205
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
206
|
+
const data = body ? JSON.parse(body) : {};
|
|
207
|
+
return { data, status: res.status, headers: res.headers };
|
|
208
|
+
};
|
|
209
|
+
export const getDeleteElasticIpUrl = (elasticIpId, params) => {
|
|
210
|
+
const normalizedParams = new URLSearchParams();
|
|
211
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
212
|
+
if (value !== undefined) {
|
|
213
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const stringifiedParams = normalizedParams.toString();
|
|
217
|
+
return stringifiedParams.length > 0
|
|
218
|
+
? `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}?${stringifiedParams}`
|
|
219
|
+
: `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}`;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Releases the elastic IP after dissociating it. The elastic IP shows the `delete` operation until cleanup is confirmed; the address then immediately returns to available inventory, with no cooldown period. Deleting the association or replacing it alone does not release the address.
|
|
223
|
+
*
|
|
224
|
+
* Refused with `COMPUTE_PURCHASE_PENDING` while the purchase that created it still awaits checkout or payment; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead.
|
|
225
|
+
*
|
|
226
|
+
* While subscriptions pay for the elastic IP (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the elastic IP working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
227
|
+
* @summary Release an elastic IP
|
|
228
|
+
*/
|
|
229
|
+
export const deleteElasticIp = async (elasticIpId, params, options, fetchFn) => {
|
|
230
|
+
const res = await (fetchFn ?? fetch)(getDeleteElasticIpUrl(elasticIpId, params), {
|
|
231
|
+
...options,
|
|
232
|
+
method: "DELETE",
|
|
233
|
+
});
|
|
234
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
235
|
+
const data = body ? JSON.parse(body) : {};
|
|
236
|
+
return { data, status: res.status, headers: res.headers };
|
|
237
|
+
};
|
|
238
|
+
export const getListElasticIpTrafficUsageUrl = (elasticIpId, params) => {
|
|
239
|
+
const normalizedParams = new URLSearchParams();
|
|
240
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
241
|
+
if (value !== undefined) {
|
|
242
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const stringifiedParams = normalizedParams.toString();
|
|
246
|
+
return stringifiedParams.length > 0
|
|
247
|
+
? `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}/traffic-usage?${stringifiedParams}`
|
|
248
|
+
: `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}/traffic-usage`;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* The bytes and packets the elastic IP's address sent upstream while the elastic IP held it, summed by hour or by day in UTC over `[start_time, end_time)`. Only intervals with traffic are listed. Inbound traffic is not measured.
|
|
252
|
+
*
|
|
253
|
+
* Traffic is reported by the region's collectors and appears some minutes after it is sent. Every elastic IP's traffic is shown, whatever it is billed by; only one billed by traffic is charged for it. A span longer than 31 days by hour, or 366 days by day, is refused with `TRAFFIC_USAGE_QUERY_INVALID`.
|
|
254
|
+
* @summary List the traffic an elastic IP sent
|
|
255
|
+
*/
|
|
256
|
+
export const listElasticIpTrafficUsage = async (elasticIpId, params, options, fetchFn) => {
|
|
257
|
+
const res = await (fetchFn ?? fetch)(getListElasticIpTrafficUsageUrl(elasticIpId, params), {
|
|
258
|
+
...options,
|
|
259
|
+
method: "GET",
|
|
260
|
+
});
|
|
261
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
262
|
+
const data = body ? JSON.parse(body) : {};
|
|
263
|
+
return { data, status: res.status, headers: res.headers };
|
|
264
|
+
};
|
|
265
|
+
export const getGetElasticIpAssociationUrl = (elasticIpId) => {
|
|
266
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}/association`;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* The private address of a network interface this elastic IP currently points at. Returns the stored state; it does not query the cloud.
|
|
270
|
+
*
|
|
271
|
+
* An elastic IP that points at nothing has no association: the request is refused with 404 `ELASTIC_IP_NOT_ASSOCIATED`.
|
|
272
|
+
* @summary Retrieve the association of an elastic IP
|
|
273
|
+
*/
|
|
274
|
+
export const getElasticIpAssociation = async (elasticIpId, options, fetchFn) => {
|
|
275
|
+
const res = await (fetchFn ?? fetch)(getGetElasticIpAssociationUrl(elasticIpId), {
|
|
276
|
+
...options,
|
|
277
|
+
method: "GET",
|
|
278
|
+
});
|
|
279
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
280
|
+
const data = body ? JSON.parse(body) : {};
|
|
281
|
+
return { data, status: res.status, headers: res.headers };
|
|
282
|
+
};
|
|
283
|
+
export const getAssociateElasticIpUrl = (elasticIpId) => {
|
|
284
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}:associate`;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Points the elastic IP at a target: an instance, which means the primary private IPv4 address of its primary network interface, or a network interface address (`network_interface_address_id`) given directly. Exactly one of `instance_id` and `network_interface_address_id`. A network interface address must be an assigned, unreleased IPv4 address on a network interface in this project and region; IPv6 addresses are rejected.
|
|
288
|
+
*
|
|
289
|
+
* The target becomes what the elastic IP points at. Repeating the request for the target it already points at changes nothing; an elastic IP associated with another target is refused with `ELASTIC_IP_ALREADY_ASSOCIATED` (409), and is moved by disassociating it first, so that the moment traffic stops reaching the old target is one the caller chose. The elastic IP shows the `associate` operation until the association is confirmed, and with an instance as the target that instance shows the `associate_elastic_ip` operation as well, so the instance must not have another operation in progress.
|
|
290
|
+
*
|
|
291
|
+
* The elastic IP must be in the same region as the target. With an instance as the target, the elastic IP's `bandwidth_mbps` must not exceed the `max_bandwidth_mbps` of that instance's type; a higher limit is refused with `INSTANCE_BANDWIDTH_CEILING`.
|
|
292
|
+
* @summary Associate an elastic IP with a target
|
|
293
|
+
*/
|
|
294
|
+
export const associateElasticIp = async (elasticIpId, associateElasticIPRequestBody, options, fetchFn) => {
|
|
295
|
+
const getHeaders = (h) => {
|
|
296
|
+
if (!h)
|
|
297
|
+
return {};
|
|
298
|
+
if (h instanceof Headers)
|
|
299
|
+
return Object.fromEntries(h.entries());
|
|
300
|
+
if (Symbol.iterator in h) {
|
|
301
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
302
|
+
}
|
|
303
|
+
const headers = {};
|
|
304
|
+
for (const [name, value] of Object.entries(h)) {
|
|
305
|
+
if (value !== undefined)
|
|
306
|
+
headers[name] = value;
|
|
307
|
+
}
|
|
308
|
+
return headers;
|
|
309
|
+
};
|
|
310
|
+
const res = await (fetchFn ?? fetch)(getAssociateElasticIpUrl(elasticIpId), {
|
|
311
|
+
...options,
|
|
312
|
+
method: "POST",
|
|
313
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
314
|
+
body: JSON.stringify(associateElasticIPRequestBody),
|
|
315
|
+
});
|
|
316
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
317
|
+
const data = body ? JSON.parse(body) : {};
|
|
318
|
+
return { data, status: res.status, headers: res.headers };
|
|
319
|
+
};
|
|
320
|
+
export const getDisassociateElasticIpUrl = (elasticIpId) => {
|
|
321
|
+
return `https://compute.leaflow.cloud/api/v2/elastic-ips/${encodeURIComponent(String(elasticIpId))}:disassociate`;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* The address remains held by the project and simply no longer points at any network interface. The elastic IP shows the `disassociate` operation until the change is confirmed, and an instance whose primary interface it pointed at shows the `disassociate_elastic_ip` operation. Removing an association that does not exist is refused with 404 `ELASTIC_IP_NOT_ASSOCIATED`.
|
|
325
|
+
* @summary Remove the association of an elastic IP
|
|
326
|
+
*/
|
|
327
|
+
export const disassociateElasticIp = async (elasticIpId, options, fetchFn) => {
|
|
328
|
+
const res = await (fetchFn ?? fetch)(getDisassociateElasticIpUrl(elasticIpId), {
|
|
329
|
+
...options,
|
|
330
|
+
method: "POST",
|
|
331
|
+
});
|
|
332
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
333
|
+
const data = body ? JSON.parse(body) : {};
|
|
334
|
+
return { data, status: res.status, headers: res.headers };
|
|
335
|
+
};
|
|
336
|
+
export const getListInstanceFamiliesUrl = (params) => {
|
|
337
|
+
const normalizedParams = new URLSearchParams();
|
|
338
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
339
|
+
if (value !== undefined) {
|
|
340
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
const stringifiedParams = normalizedParams.toString();
|
|
344
|
+
return stringifiedParams.length > 0
|
|
345
|
+
? `https://compute.leaflow.cloud/api/v2/instance-families?${stringifiedParams}`
|
|
346
|
+
: `https://compute.leaflow.cloud/api/v2/instance-families`;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* An instance family is one hardware line of a region, such as `g7`, and its instance types are its sizes in each availability zone. A family shows here while it has an instance type on sale or sold out.
|
|
350
|
+
* @summary List instance families
|
|
351
|
+
*/
|
|
352
|
+
export const listInstanceFamilies = async (params, options, fetchFn) => {
|
|
353
|
+
const res = await (fetchFn ?? fetch)(getListInstanceFamiliesUrl(params), {
|
|
354
|
+
...options,
|
|
355
|
+
method: "GET",
|
|
356
|
+
});
|
|
357
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
358
|
+
const data = body ? JSON.parse(body) : {};
|
|
359
|
+
return { data, status: res.status, headers: res.headers };
|
|
360
|
+
};
|
|
361
|
+
export const getGetInstanceFamilyUrl = (instanceFamilyId) => {
|
|
362
|
+
return `https://compute.leaflow.cloud/api/v2/instance-families/${encodeURIComponent(String(instanceFamilyId))}`;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Returns an instance family under the same rule as listing; a family with no instance type on sale or sold out returns 404.
|
|
366
|
+
* @summary Get an instance family
|
|
367
|
+
*/
|
|
368
|
+
export const getInstanceFamily = async (instanceFamilyId, options, fetchFn) => {
|
|
369
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceFamilyUrl(instanceFamilyId), {
|
|
370
|
+
...options,
|
|
371
|
+
method: "GET",
|
|
372
|
+
});
|
|
373
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
374
|
+
const data = body ? JSON.parse(body) : {};
|
|
375
|
+
return { data, status: res.status, headers: res.headers };
|
|
376
|
+
};
|
|
377
|
+
export const getListInstanceTypesUrl = (params) => {
|
|
378
|
+
const normalizedParams = new URLSearchParams();
|
|
379
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
380
|
+
if (value !== undefined) {
|
|
381
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
const stringifiedParams = normalizedParams.toString();
|
|
385
|
+
return stringifiedParams.length > 0
|
|
386
|
+
? `https://compute.leaflow.cloud/api/v2/instance-types?${stringifiedParams}`
|
|
387
|
+
: `https://compute.leaflow.cloud/api/v2/instance-types`;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Instance types on sale are listed, and sold-out ones with `sale_status` `sold_out`. A withdrawn one disappears from here and can no longer be ordered, while the instances already running it keep running.
|
|
391
|
+
* @summary List instance types on sale
|
|
392
|
+
*/
|
|
393
|
+
export const listInstanceTypes = async (params, options, fetchFn) => {
|
|
394
|
+
const res = await (fetchFn ?? fetch)(getListInstanceTypesUrl(params), {
|
|
395
|
+
...options,
|
|
396
|
+
method: "GET",
|
|
397
|
+
});
|
|
398
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
399
|
+
const data = body ? JSON.parse(body) : {};
|
|
400
|
+
return { data, status: res.status, headers: res.headers };
|
|
401
|
+
};
|
|
402
|
+
export const getGetInstanceTypeUrl = (instanceTypeId) => {
|
|
403
|
+
return `https://compute.leaflow.cloud/api/v2/instance-types/${encodeURIComponent(String(instanceTypeId))}`;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Returns an instance type on sale or sold out, under the same access rules as listing. Off-sale, retired or absent types return 404.
|
|
407
|
+
* @summary Get an instance type
|
|
408
|
+
*/
|
|
409
|
+
export const getInstanceType = async (instanceTypeId, options, fetchFn) => {
|
|
410
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceTypeUrl(instanceTypeId), {
|
|
411
|
+
...options,
|
|
412
|
+
method: "GET",
|
|
413
|
+
});
|
|
414
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
415
|
+
const data = body ? JSON.parse(body) : {};
|
|
416
|
+
return { data, status: res.status, headers: res.headers };
|
|
417
|
+
};
|
|
418
|
+
export const getListInstancesUrl = (params) => {
|
|
419
|
+
const normalizedParams = new URLSearchParams();
|
|
420
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
421
|
+
if (value !== undefined) {
|
|
422
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
const stringifiedParams = normalizedParams.toString();
|
|
426
|
+
return stringifiedParams.length > 0
|
|
427
|
+
? `https://compute.leaflow.cloud/api/v2/instances?${stringifiedParams}`
|
|
428
|
+
: `https://compute.leaflow.cloud/api/v2/instances`;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* Every instance in the project, newest first, in their stored state.
|
|
432
|
+
* @summary List instances
|
|
433
|
+
*/
|
|
434
|
+
export const listInstances = async (params, options, fetchFn) => {
|
|
435
|
+
const res = await (fetchFn ?? fetch)(getListInstancesUrl(params), {
|
|
436
|
+
...options,
|
|
437
|
+
method: "GET",
|
|
438
|
+
});
|
|
439
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
440
|
+
const data = body ? JSON.parse(body) : {};
|
|
441
|
+
return { data, status: res.status, headers: res.headers };
|
|
442
|
+
};
|
|
443
|
+
export const getCreateInstanceUrl = () => {
|
|
444
|
+
return `https://compute.leaflow.cloud/api/v2/instances`;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Creates a Billing Checkout Session, including for metered terms, and returns one `pending` instance per requested instance with it. Each new component carries its own commercial terms; their usage type and period must match. A pending instance has no server, boot volume or address, and is not metered.
|
|
448
|
+
*
|
|
449
|
+
* Creation starts once Billing accepts the order: the instance stays `pending` with the `create` operation while it is created, then becomes `running`. With automatic checkout, insufficient funds refuse the request and nothing is created. With deferred checkout, the instances stay `pending` until the customer completes checkout in Billing and the order is paid; an expired Checkout Session, or a canceled or expired order, leaves them `failed` with `checkout_expired`, `order_canceled` or `order_expired`. Do not submit another creation request after paying. After an uncertain response, look the Checkout Session up in Billing before submitting again.
|
|
450
|
+
*
|
|
451
|
+
* The instances are created in the availability zone of their instance type, and the volumes bought with them have to be of volume types of that zone (422 `VOLUME_TYPE_OTHER_AVAILABILITY_ZONE`). The types have to have room for all of them, checked before anything is ordered: refused with 409 `INSTANCE_TYPE_SOLD_OUT` or `VOLUME_TYPE_SOLD_OUT` when a type takes no new orders for now, `INSTANCE_TYPE_CAPACITY_REACHED` or `VOLUME_TYPE_CAPACITY_REACHED` when what is sold of it is used up, `INSTANCE_TYPE_NO_HOST_ROOM` when no host of the zone can take the machine, `VOLUME_TYPE_NO_POOL_ROOM` when the storage of the zone cannot take the boot volume, and `ELASTIC_IP_LINE_EXHAUSTED` when the line of the new elastic IPs has fewer addresses left than instances. Two orders placed at the same moment can both pass; an instance that finds a type full when its order is accepted is not created and is refunded, ending `failed` with `provisioning_failed`.
|
|
452
|
+
*
|
|
453
|
+
* Choose an image or existing volume through boot_volume, and exactly one of network_interface_id or subnet_id. Existing network interfaces, boot volumes or elastic IPs require count=1. They are not held while the instance is pending; if one is no longer usable when the order is accepted, the instance ends `failed` with `provisioning_failed`. Image boots require boot_volume; existing volumes retain their own subscription. Instances, volumes and public IPs keep their own subscription items on the same order.
|
|
454
|
+
*
|
|
455
|
+
* Instances of one request succeed or fail individually. Each instance, with its boot volume, network interface and elastic IP, is created or fails as a whole. Instances that were created are kept; each failed instance ends `failed` with `provisioning_failed`, its part of the order is refunded, and the order then ends `partially_completed`. An instance is delivered whole or not at all: when the customer cancels any of its order items before the order is accepted, it is not created, its remaining items are canceled and refunded, and it ends `failed` with `order_canceled`. Each instance is named after this request with a number appended.
|
|
456
|
+
*
|
|
457
|
+
* The network is checked before the Checkout Session is created, and a request it refuses orders and charges nothing. It is refused with `VIRTUAL_PRIVATE_CLOUD_UNAVAILABLE` when the virtual private cloud's `status` is not `available`, `VIRTUAL_PRIVATE_CLOUD_SUBNET_UNAVAILABLE` or `SECURITY_GROUP_UNAVAILABLE` when the subnet or a security group is not ready, `SECURITY_GROUP_OTHER_VIRTUAL_PRIVATE_CLOUD` when a security group belongs to another virtual private cloud, and `NETWORK_INTERFACE_UNAVAILABLE` when the port's `status` is not `available`. `meta` names the resource.
|
|
458
|
+
*
|
|
459
|
+
* Each instance shows the `create` operation from the moment the Checkout Session is created until it is delivered or the checkout or order ends. Every other operation on it is refused with `COMPUTE_RESOURCE_BUSY` meanwhile, and its release with `COMPUTE_PURCHASE_PENDING` while its purchase awaits checkout or payment.
|
|
460
|
+
* @summary Create instances
|
|
461
|
+
*/
|
|
462
|
+
export const createInstance = async (createInstanceRequestBody, options, fetchFn) => {
|
|
463
|
+
const getHeaders = (h) => {
|
|
464
|
+
if (!h)
|
|
465
|
+
return {};
|
|
466
|
+
if (h instanceof Headers)
|
|
467
|
+
return Object.fromEntries(h.entries());
|
|
468
|
+
if (Symbol.iterator in h) {
|
|
469
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
470
|
+
}
|
|
471
|
+
const headers = {};
|
|
472
|
+
for (const [name, value] of Object.entries(h)) {
|
|
473
|
+
if (value !== undefined)
|
|
474
|
+
headers[name] = value;
|
|
475
|
+
}
|
|
476
|
+
return headers;
|
|
477
|
+
};
|
|
478
|
+
const res = await (fetchFn ?? fetch)(getCreateInstanceUrl(), {
|
|
479
|
+
...options,
|
|
480
|
+
method: "POST",
|
|
481
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
482
|
+
body: JSON.stringify(createInstanceRequestBody),
|
|
483
|
+
});
|
|
484
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
485
|
+
const data = body ? JSON.parse(body) : {};
|
|
486
|
+
return { data, status: res.status, headers: res.headers };
|
|
487
|
+
};
|
|
488
|
+
export const getGetInstanceUrl = (instanceId) => {
|
|
489
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}`;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Returns the stored state of the instance; it does not query the cloud. Use it to poll creation progress.
|
|
493
|
+
* @summary Retrieve an instance
|
|
494
|
+
*/
|
|
495
|
+
export const getInstance = async (instanceId, options, fetchFn) => {
|
|
496
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceUrl(instanceId), {
|
|
497
|
+
...options,
|
|
498
|
+
method: "GET",
|
|
499
|
+
});
|
|
500
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
501
|
+
const data = body ? JSON.parse(body) : {};
|
|
502
|
+
return { data, status: res.status, headers: res.headers };
|
|
503
|
+
};
|
|
504
|
+
export const getUpdateInstanceUrl = (instanceId) => {
|
|
505
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}`;
|
|
506
|
+
};
|
|
507
|
+
/**
|
|
508
|
+
* Changes the descriptive fields (`name`, `labels`, `notes`) or the operational field `instance_type_id`. All fields are optional and at least one is required. Starting and stopping are the `:start` and `:stop` methods.
|
|
509
|
+
*
|
|
510
|
+
* `instance_type_id` starts a workflow and cannot be combined with any other field in the same request. Such a request is refused with 422 `UPDATE_FIELDS_COMBINED`, because a rename that committed beside a change that was then refused would leave the request half applied. `checkout` and `proration_date` belong to the purchase of the `instance_type_id` change and are accepted only together with it.
|
|
511
|
+
*
|
|
512
|
+
* **Descriptive fields** are not operations and are accepted at any time, whatever the instance is doing. The request returns 200 with `checkout_session_id` and `order_id` null.
|
|
513
|
+
*
|
|
514
|
+
* - `name` changes the display name only. The hostname inside the instance is unchanged; it equals the instance id.
|
|
515
|
+
* - `labels` records what this instance is for, as key-value pairs. Nothing on the platform reads them. **The whole set is replaced**: whatever is absent from the request is removed, and an empty object clears them all. Do not put credentials here. Labels are visible to platform operators.
|
|
516
|
+
* - `notes` is a free-text note about this instance: what it runs, and what to be careful about before touching it. **The whole note is replaced**; send an empty string to clear it. Do not put credentials here. The note is visible to platform operators.
|
|
517
|
+
*
|
|
518
|
+
* **`instance_type_id`** changes the instance's type **cold**: the instance has to be stopped, and is refused with 409 `INSTANCE_RESIZE_REQUIRES_STOP` otherwise. Its operating system is not booted for the change, and it is still stopped once the change is applied; start it when you are ready. An instance stopped by the legacy stop, which released its host, is refused with 409 `INSTANCE_SHELVED`; start it once and stop it again. A target type that cannot hold what the instance already uses is refused before anything is ordered: fewer network interfaces than are attached with 409 `INSTANCE_RESIZE_NETWORK_INTERFACES_EXCEED`, fewer elastic IPs than are associated with 409 `INSTANCE_RESIZE_ELASTIC_IPS_EXCEED`, and less purchasable bandwidth than an associated elastic IP has with 409 `INSTANCE_BANDWIDTH_CEILING` naming it in `meta.elastic_ip_id`. The request returns 202 with the instance and the Checkout Session for the change, including for metered terms. The instance keeps its usage type and period, priced with the target type's matching option; a target type without that option is refused with 409 `BILLING_OPTION_UNAVAILABLE`. The resize starts once Billing accepts the order. Do not submit the change again after paying. After an uncertain response, look the Checkout Session up in Billing before submitting again.
|
|
519
|
+
*
|
|
520
|
+
* The instance shows the `resize` operation until the resize is applied, its Checkout Session expires or its order is canceled, so other operations and a second resize are refused with `COMPUTE_RESOURCE_BUSY` meanwhile. It keeps its current type until the resize is applied; the new type takes effect, and is billed from then on, when `instance_type_id` shows it. If checkout is not completed, the order is not accepted or the resize fails, the instance keeps its current type and Billing shows the outcome. A completed resize is final and cannot be reverted; to return to the previous type, submit another resize.
|
|
521
|
+
* @summary Update an instance
|
|
522
|
+
*/
|
|
523
|
+
export const updateInstance = async (instanceId, updateInstanceRequestBody, options, fetchFn) => {
|
|
524
|
+
const getHeaders = (h) => {
|
|
525
|
+
if (!h)
|
|
526
|
+
return {};
|
|
527
|
+
if (h instanceof Headers)
|
|
528
|
+
return Object.fromEntries(h.entries());
|
|
529
|
+
if (Symbol.iterator in h) {
|
|
530
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
531
|
+
}
|
|
532
|
+
const headers = {};
|
|
533
|
+
for (const [name, value] of Object.entries(h)) {
|
|
534
|
+
if (value !== undefined)
|
|
535
|
+
headers[name] = value;
|
|
536
|
+
}
|
|
537
|
+
return headers;
|
|
538
|
+
};
|
|
539
|
+
const res = await (fetchFn ?? fetch)(getUpdateInstanceUrl(instanceId), {
|
|
540
|
+
...options,
|
|
541
|
+
method: "PATCH",
|
|
542
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
543
|
+
body: JSON.stringify(updateInstanceRequestBody),
|
|
544
|
+
});
|
|
545
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
546
|
+
const data = body ? JSON.parse(body) : {};
|
|
547
|
+
return { data, status: res.status, headers: res.headers };
|
|
548
|
+
};
|
|
549
|
+
export const getDeleteInstanceUrl = (instanceId, params) => {
|
|
550
|
+
const normalizedParams = new URLSearchParams();
|
|
551
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
552
|
+
if (value !== undefined) {
|
|
553
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
const stringifiedParams = normalizedParams.toString();
|
|
557
|
+
return stringifiedParams.length > 0
|
|
558
|
+
? `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}?${stringifiedParams}`
|
|
559
|
+
: `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}`;
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* The boot volume is deleted with the instance, and **snapshots created from the boot volume are deleted with it**. Data volumes are detached and kept, and their snapshots and backups are unaffected. The primary network interface is released with the instance.
|
|
563
|
+
*
|
|
564
|
+
* An instance being captured as a private image cannot be released. Wait for the capture to finish, or delete that image first.
|
|
565
|
+
*
|
|
566
|
+
* Refused with `COMPUTE_PURCHASE_PENDING` while the purchase that created it still awaits checkout or payment; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead.
|
|
567
|
+
*
|
|
568
|
+
* While subscriptions pay for the instance (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the instance working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
569
|
+
* @summary Release an instance
|
|
570
|
+
*/
|
|
571
|
+
export const deleteInstance = async (instanceId, params, options, fetchFn) => {
|
|
572
|
+
const res = await (fetchFn ?? fetch)(getDeleteInstanceUrl(instanceId, params), {
|
|
573
|
+
...options,
|
|
574
|
+
method: "DELETE",
|
|
575
|
+
});
|
|
576
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
577
|
+
const data = body ? JSON.parse(body) : {};
|
|
578
|
+
return { data, status: res.status, headers: res.headers };
|
|
579
|
+
};
|
|
580
|
+
export const getStartInstanceUrl = (instanceId) => {
|
|
581
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:start`;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Boots the stopped instance on the host it kept; outstanding restrictions can prevent starting. It shows the `start` operation until it is running or the start has failed. Starting a running instance changes nothing.
|
|
585
|
+
*
|
|
586
|
+
* When its boot volume grew since it was last connected, the start connects its volumes afresh so that the boot volume runs at the performance of its new size: the instance is taken off its host for that moment and placed again. Only then can the start find no room in the zone; it is refused with 409 `INSTANCE_START_NO_HOST_ROOM`, or ends with the instance still stopped, and can be tried again later. An instance stopped by the legacy stop, which released its host, is placed again the same way.
|
|
587
|
+
* @summary Start an instance
|
|
588
|
+
*/
|
|
589
|
+
export const startInstance = async (instanceId, options, fetchFn) => {
|
|
590
|
+
const res = await (fetchFn ?? fetch)(getStartInstanceUrl(instanceId), {
|
|
591
|
+
...options,
|
|
592
|
+
method: "POST",
|
|
593
|
+
});
|
|
594
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
595
|
+
const data = body ? JSON.parse(body) : {};
|
|
596
|
+
return { data, status: res.status, headers: res.headers };
|
|
597
|
+
};
|
|
598
|
+
export const getStopInstanceUrl = (instanceId) => {
|
|
599
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:stop`;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* Shuts the instance down **on its host**, as Alibaba Cloud's ordinary stop does: it keeps its volumes, network interfaces, addresses and quota, and the vCPU and memory of its host stay reserved for it, so it starts again without asking for room. **A metered instance keeps being charged for compute while stopped**; its volumes and elastic IPs are charged as always. An instance stopped by a suspension, for non-payment or by the platform, is not charged for compute while the suspension lasts. It shows the `stop` operation until it is stopped. Stopping a stopped instance changes nothing.
|
|
603
|
+
*
|
|
604
|
+
* Changing `instance_type_id` is done on a stopped instance and only then. A stopped instance can also be rebuilt and have network interfaces and volumes attached and detached; rescuing it needs it running.
|
|
605
|
+
* @summary Stop an instance
|
|
606
|
+
*/
|
|
607
|
+
export const stopInstance = async (instanceId, options, fetchFn) => {
|
|
608
|
+
const res = await (fetchFn ?? fetch)(getStopInstanceUrl(instanceId), {
|
|
609
|
+
...options,
|
|
610
|
+
method: "POST",
|
|
611
|
+
});
|
|
612
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
613
|
+
const data = body ? JSON.parse(body) : {};
|
|
614
|
+
return { data, status: res.status, headers: res.headers };
|
|
615
|
+
};
|
|
616
|
+
export const getRunInstanceCommandUrl = (instanceId) => {
|
|
617
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:runCommand`;
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Runs one command over SSH and returns what it wrote. **This is not a shell.** There is no terminal, no standard input and no way to answer a prompt: a command that waits for input produces nothing and is killed at the timeout. Chain steps with `&&`, or write a script and run that.
|
|
621
|
+
*
|
|
622
|
+
* **A command that fails is still a 200.** Its failure is its own result, not this endpoint's: read `exit_code` for what it exited with and `stderr` for what it said, and decide from those. A `grep` that matches nothing exits 1 and is a perfectly successful call.
|
|
623
|
+
*
|
|
624
|
+
* The status therefore answers a different question — did the command run at all. A non-2xx means it did not, and nothing about the instance was changed by this request: it was suspended, not running or had no elastic IP associated; or it refused the platform key; or the connection could not be opened. Retrying is meaningful in those cases and is not for a non-zero `exit_code`.
|
|
625
|
+
*
|
|
626
|
+
* Three conditions must hold; the instance is unreachable otherwise:
|
|
627
|
+
*
|
|
628
|
+
* - it is `running`
|
|
629
|
+
* - an elastic IP is associated with it, since this endpoint connects over the public internet
|
|
630
|
+
* - its security group permits inbound TCP 22
|
|
631
|
+
*
|
|
632
|
+
* Authentication uses the key the platform attaches to every instance at creation, so nothing has to be set up first. The instance must have applied that key at first boot, which images without a full cloud-init do not do.
|
|
633
|
+
*
|
|
634
|
+
* **Do not pass secrets in the command.** Read them from a file on the instance instead: neither the command nor its output is a confidential channel.
|
|
635
|
+
*
|
|
636
|
+
* Each stream is capped at 1 MiB. Beyond that the rest is discarded and `truncated` is true.
|
|
637
|
+
* @summary Run a command on an instance
|
|
638
|
+
*/
|
|
639
|
+
export const runInstanceCommand = async (instanceId, runInstanceCommandRequestBody, options, fetchFn) => {
|
|
640
|
+
const getHeaders = (h) => {
|
|
641
|
+
if (!h)
|
|
642
|
+
return {};
|
|
643
|
+
if (h instanceof Headers)
|
|
644
|
+
return Object.fromEntries(h.entries());
|
|
645
|
+
if (Symbol.iterator in h) {
|
|
646
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
647
|
+
}
|
|
648
|
+
const headers = {};
|
|
649
|
+
for (const [name, value] of Object.entries(h)) {
|
|
650
|
+
if (value !== undefined)
|
|
651
|
+
headers[name] = value;
|
|
652
|
+
}
|
|
653
|
+
return headers;
|
|
654
|
+
};
|
|
655
|
+
const res = await (fetchFn ?? fetch)(getRunInstanceCommandUrl(instanceId), {
|
|
656
|
+
...options,
|
|
657
|
+
method: "POST",
|
|
658
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
659
|
+
body: JSON.stringify(runInstanceCommandRequestBody),
|
|
660
|
+
});
|
|
661
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
662
|
+
const data = body ? JSON.parse(body) : {};
|
|
663
|
+
return { data, status: res.status, headers: res.headers };
|
|
664
|
+
};
|
|
665
|
+
export const getGetInstanceConsoleUrl = (instanceId) => {
|
|
666
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/console`;
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* The instance's VNC console, operated from a browser through a noVNC client. It does not require the instance to be reachable over the network, which makes it usable when a network misconfiguration prevents login.
|
|
670
|
+
*
|
|
671
|
+
* The returned address is single-use and expires within minutes. Every request issues a new address, so request one before each use and do not cache the response.
|
|
672
|
+
* @summary Retrieve a VNC console
|
|
673
|
+
*/
|
|
674
|
+
export const getInstanceConsole = async (instanceId, options, fetchFn) => {
|
|
675
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceConsoleUrl(instanceId), {
|
|
676
|
+
...options,
|
|
677
|
+
method: "GET",
|
|
678
|
+
});
|
|
679
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
680
|
+
const data = body ? JSON.parse(body) : {};
|
|
681
|
+
return { data, status: res.status, headers: res.headers };
|
|
682
|
+
};
|
|
683
|
+
export const getResetInstancePasswordUrl = (instanceId) => {
|
|
684
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:resetPassword`;
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* Sets the password of the login account (`login_username`) without a reboot; root is never given one. The instance must be running.
|
|
688
|
+
*
|
|
689
|
+
* **Not every image supports this.** Images whose `supports_password_reset` is false cannot, and a new password can then only be set by rebuilding the instance, which erases all data on the boot volume.
|
|
690
|
+
*
|
|
691
|
+
* The request is also rejected when the image is marked as supported but the corresponding component has been removed or stopped inside the instance.
|
|
692
|
+
* @summary Reset the login password
|
|
693
|
+
*/
|
|
694
|
+
export const resetInstancePassword = async (instanceId, passwordChoice, options, fetchFn) => {
|
|
695
|
+
const getHeaders = (h) => {
|
|
696
|
+
if (!h)
|
|
697
|
+
return {};
|
|
698
|
+
if (h instanceof Headers)
|
|
699
|
+
return Object.fromEntries(h.entries());
|
|
700
|
+
if (Symbol.iterator in h) {
|
|
701
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
702
|
+
}
|
|
703
|
+
const headers = {};
|
|
704
|
+
for (const [name, value] of Object.entries(h)) {
|
|
705
|
+
if (value !== undefined)
|
|
706
|
+
headers[name] = value;
|
|
707
|
+
}
|
|
708
|
+
return headers;
|
|
709
|
+
};
|
|
710
|
+
const res = await (fetchFn ?? fetch)(getResetInstancePasswordUrl(instanceId), {
|
|
711
|
+
...options,
|
|
712
|
+
method: "POST",
|
|
713
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
714
|
+
body: JSON.stringify(passwordChoice),
|
|
715
|
+
});
|
|
716
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
717
|
+
const data = body ? JSON.parse(body) : {};
|
|
718
|
+
return { data, status: res.status, headers: res.headers };
|
|
719
|
+
};
|
|
720
|
+
export const getRebootInstanceUrl = (instanceId) => {
|
|
721
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:reboot`;
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* A reboot defaults to soft, in which the operating system shuts down normally before starting again.
|
|
725
|
+
*
|
|
726
|
+
* A soft reboot has no effect once the system is unresponsive. Set `force` to reboot forcibly: a forced reboot does not wait for the operating system to shut down, so **unwritten data is lost**.
|
|
727
|
+
*
|
|
728
|
+
* A forced reboot is accepted while a soft reboot is in progress, which is the way out of a soft reboot the instance never carried out. Any other request for an operation, including a second soft reboot, is refused with `COMPUTE_RESOURCE_BUSY` while the reboot is in progress.
|
|
729
|
+
*
|
|
730
|
+
* An instance suspended by the platform must be unsuspended first.
|
|
731
|
+
*
|
|
732
|
+
* The instance shows the `reboot` operation until the reboot has finished.
|
|
733
|
+
* @summary Reboot an instance
|
|
734
|
+
*/
|
|
735
|
+
export const rebootInstance = async (instanceId, rebootInstanceRequestBody, options, fetchFn) => {
|
|
736
|
+
const getHeaders = (h) => {
|
|
737
|
+
if (!h)
|
|
738
|
+
return {};
|
|
739
|
+
if (h instanceof Headers)
|
|
740
|
+
return Object.fromEntries(h.entries());
|
|
741
|
+
if (Symbol.iterator in h) {
|
|
742
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
743
|
+
}
|
|
744
|
+
const headers = {};
|
|
745
|
+
for (const [name, value] of Object.entries(h)) {
|
|
746
|
+
if (value !== undefined)
|
|
747
|
+
headers[name] = value;
|
|
748
|
+
}
|
|
749
|
+
return headers;
|
|
750
|
+
};
|
|
751
|
+
const res = await (fetchFn ?? fetch)(getRebootInstanceUrl(instanceId), {
|
|
752
|
+
...options,
|
|
753
|
+
method: "POST",
|
|
754
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
755
|
+
body: JSON.stringify(rebootInstanceRequestBody),
|
|
756
|
+
});
|
|
757
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
758
|
+
const data = body ? JSON.parse(body) : {};
|
|
759
|
+
return { data, status: res.status, headers: res.headers };
|
|
760
|
+
};
|
|
761
|
+
export const getRebuildInstanceUrl = (instanceId) => {
|
|
762
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:rebuild`;
|
|
763
|
+
};
|
|
764
|
+
/**
|
|
765
|
+
* **All data on the boot volume is erased and cannot be recovered.** Attached data volumes are unaffected.
|
|
766
|
+
*
|
|
767
|
+
* The instance has to be running or stopped. An instance stopped by the legacy stop, which released its host, is refused with 409 `INSTANCE_SHELVED`; start it once first, which works even when its operating system no longer boots.
|
|
768
|
+
*
|
|
769
|
+
* The image this instance already runs is accepted even after the platform has withdrawn it, since rebuilding is the only way back into an instance broken from the inside. Any *other* withdrawn image is rejected with `IMAGE_RETIRED`, which is a change of image and therefore a new order.
|
|
770
|
+
*
|
|
771
|
+
* The instance shows the `rebuild` operation until the rebuild has finished.
|
|
772
|
+
* @summary Rebuild an instance
|
|
773
|
+
*/
|
|
774
|
+
export const rebuildInstance = async (instanceId, rebuildInstanceRequestBody, options, fetchFn) => {
|
|
775
|
+
const getHeaders = (h) => {
|
|
776
|
+
if (!h)
|
|
777
|
+
return {};
|
|
778
|
+
if (h instanceof Headers)
|
|
779
|
+
return Object.fromEntries(h.entries());
|
|
780
|
+
if (Symbol.iterator in h) {
|
|
781
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
782
|
+
}
|
|
783
|
+
const headers = {};
|
|
784
|
+
for (const [name, value] of Object.entries(h)) {
|
|
785
|
+
if (value !== undefined)
|
|
786
|
+
headers[name] = value;
|
|
787
|
+
}
|
|
788
|
+
return headers;
|
|
789
|
+
};
|
|
790
|
+
const res = await (fetchFn ?? fetch)(getRebuildInstanceUrl(instanceId), {
|
|
791
|
+
...options,
|
|
792
|
+
method: "POST",
|
|
793
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
794
|
+
body: JSON.stringify(rebuildInstanceRequestBody),
|
|
795
|
+
});
|
|
796
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
797
|
+
const data = body ? JSON.parse(body) : {};
|
|
798
|
+
return { data, status: res.status, headers: res.headers };
|
|
799
|
+
};
|
|
800
|
+
export const getListInstanceVolumesUrl = (instanceId, params) => {
|
|
801
|
+
const normalizedParams = new URLSearchParams();
|
|
802
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
803
|
+
if (value !== undefined) {
|
|
804
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
const stringifiedParams = normalizedParams.toString();
|
|
808
|
+
return stringifiedParams.length > 0
|
|
809
|
+
? `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/volumes?${stringifiedParams}`
|
|
810
|
+
: `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/volumes`;
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* @summary List the volumes attached to an instance
|
|
814
|
+
*/
|
|
815
|
+
export const listInstanceVolumes = async (instanceId, params, options, fetchFn) => {
|
|
816
|
+
const res = await (fetchFn ?? fetch)(getListInstanceVolumesUrl(instanceId, params), {
|
|
817
|
+
...options,
|
|
818
|
+
method: "GET",
|
|
819
|
+
});
|
|
820
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
821
|
+
const data = body ? JSON.parse(body) : {};
|
|
822
|
+
return { data, status: res.status, headers: res.headers };
|
|
823
|
+
};
|
|
824
|
+
export const getAttachInstanceVolumeUrl = (instanceId) => {
|
|
825
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/volumes`;
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* The volume must be in the same region and availability zone as the instance. Returns the volume; the instance shows the `attach_volume` operation and the volume the `attach` operation until the attachment is confirmed. Partition the volume and mount the file system inside the instance once it is attached.
|
|
829
|
+
* @summary Attach a volume
|
|
830
|
+
*/
|
|
831
|
+
export const attachInstanceVolume = async (instanceId, attachVolumeRequestBody, options, fetchFn) => {
|
|
832
|
+
const getHeaders = (h) => {
|
|
833
|
+
if (!h)
|
|
834
|
+
return {};
|
|
835
|
+
if (h instanceof Headers)
|
|
836
|
+
return Object.fromEntries(h.entries());
|
|
837
|
+
if (Symbol.iterator in h) {
|
|
838
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
839
|
+
}
|
|
840
|
+
const headers = {};
|
|
841
|
+
for (const [name, value] of Object.entries(h)) {
|
|
842
|
+
if (value !== undefined)
|
|
843
|
+
headers[name] = value;
|
|
844
|
+
}
|
|
845
|
+
return headers;
|
|
846
|
+
};
|
|
847
|
+
const res = await (fetchFn ?? fetch)(getAttachInstanceVolumeUrl(instanceId), {
|
|
848
|
+
...options,
|
|
849
|
+
method: "POST",
|
|
850
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
851
|
+
body: JSON.stringify(attachVolumeRequestBody),
|
|
852
|
+
});
|
|
853
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
854
|
+
const data = body ? JSON.parse(body) : {};
|
|
855
|
+
return { data, status: res.status, headers: res.headers };
|
|
856
|
+
};
|
|
857
|
+
export const getDetachInstanceVolumeUrl = (instanceId, volumeId) => {
|
|
858
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/volumes/${encodeURIComponent(String(volumeId))}`;
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Unmount the device inside the instance before calling this endpoint. Forcibly detaching a file system that is being written to corrupts data.
|
|
862
|
+
*
|
|
863
|
+
* The volume the instance boots from cannot be detached, whether it is the boot volume bought with the instance or a volume supplied as the existing boot_volume at launch. Such a request is refused with `INSTANCE_BOOT_VOLUME_LOCKED` and changes nothing; releasing the instance is what frees that volume.
|
|
864
|
+
*
|
|
865
|
+
* Returns the volume; the instance shows the `detach_volume` operation and the volume the `detach` operation until the volume is detached.
|
|
866
|
+
* @summary Detach a volume
|
|
867
|
+
*/
|
|
868
|
+
export const detachInstanceVolume = async (instanceId, volumeId, options, fetchFn) => {
|
|
869
|
+
const res = await (fetchFn ?? fetch)(getDetachInstanceVolumeUrl(instanceId, volumeId), {
|
|
870
|
+
...options,
|
|
871
|
+
method: "DELETE",
|
|
872
|
+
});
|
|
873
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
874
|
+
const data = body ? JSON.parse(body) : {};
|
|
875
|
+
return { data, status: res.status, headers: res.headers };
|
|
876
|
+
};
|
|
877
|
+
export const getListInstanceNetworkInterfacesUrl = (instanceId, params) => {
|
|
878
|
+
const normalizedParams = new URLSearchParams();
|
|
879
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
880
|
+
if (value !== undefined) {
|
|
881
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
882
|
+
}
|
|
883
|
+
});
|
|
884
|
+
const stringifiedParams = normalizedParams.toString();
|
|
885
|
+
return stringifiedParams.length > 0
|
|
886
|
+
? `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/network-interfaces?${stringifiedParams}`
|
|
887
|
+
: `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/network-interfaces`;
|
|
888
|
+
};
|
|
889
|
+
/**
|
|
890
|
+
* @summary List the network interfaces of an instance
|
|
891
|
+
*/
|
|
892
|
+
export const listInstanceNetworkInterfaces = async (instanceId, params, options, fetchFn) => {
|
|
893
|
+
const res = await (fetchFn ?? fetch)(getListInstanceNetworkInterfacesUrl(instanceId, params), {
|
|
894
|
+
...options,
|
|
895
|
+
method: "GET",
|
|
896
|
+
});
|
|
897
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
898
|
+
const data = body ? JSON.parse(body) : {};
|
|
899
|
+
return {
|
|
900
|
+
data,
|
|
901
|
+
status: res.status,
|
|
902
|
+
headers: res.headers,
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
export const getAttachInstanceNetworkInterfaceUrl = (instanceId) => {
|
|
906
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/network-interfaces`;
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* Returns the network interface; the instance shows the `attach_network_interface` operation and the interface the `attach` operation until the attachment is confirmed. The instance has to be running or stopped; one stopped by the legacy stop, which released its host, is refused with 409 `INSTANCE_SHELVED`.
|
|
910
|
+
* @summary Attach a network interface
|
|
911
|
+
*/
|
|
912
|
+
export const attachInstanceNetworkInterface = async (instanceId, attachNetworkInterfaceRequestBody, options, fetchFn) => {
|
|
913
|
+
const getHeaders = (h) => {
|
|
914
|
+
if (!h)
|
|
915
|
+
return {};
|
|
916
|
+
if (h instanceof Headers)
|
|
917
|
+
return Object.fromEntries(h.entries());
|
|
918
|
+
if (Symbol.iterator in h) {
|
|
919
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
920
|
+
}
|
|
921
|
+
const headers = {};
|
|
922
|
+
for (const [name, value] of Object.entries(h)) {
|
|
923
|
+
if (value !== undefined)
|
|
924
|
+
headers[name] = value;
|
|
925
|
+
}
|
|
926
|
+
return headers;
|
|
927
|
+
};
|
|
928
|
+
const res = await (fetchFn ?? fetch)(getAttachInstanceNetworkInterfaceUrl(instanceId), {
|
|
929
|
+
...options,
|
|
930
|
+
method: "POST",
|
|
931
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
932
|
+
body: JSON.stringify(attachNetworkInterfaceRequestBody),
|
|
933
|
+
});
|
|
934
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
935
|
+
const data = body ? JSON.parse(body) : {};
|
|
936
|
+
return {
|
|
937
|
+
data,
|
|
938
|
+
status: res.status,
|
|
939
|
+
headers: res.headers,
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
export const getDetachInstanceNetworkInterfaceUrl = (instanceId, networkInterfaceId) => {
|
|
943
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}`;
|
|
944
|
+
};
|
|
945
|
+
/**
|
|
946
|
+
* The primary network interface cannot be detached; the instance would lose its network address. The instance has to be running or stopped; one stopped by the legacy stop, which released its host, is refused with 409 `INSTANCE_SHELVED`.
|
|
947
|
+
*
|
|
948
|
+
* Returns the network interface; the instance shows the `detach_network_interface` operation and the interface the `detach` operation until it is detached.
|
|
949
|
+
* @summary Detach a network interface
|
|
950
|
+
*/
|
|
951
|
+
export const detachInstanceNetworkInterface = async (instanceId, networkInterfaceId, options, fetchFn) => {
|
|
952
|
+
const res = await (fetchFn ?? fetch)(getDetachInstanceNetworkInterfaceUrl(instanceId, networkInterfaceId), {
|
|
953
|
+
...options,
|
|
954
|
+
method: "DELETE",
|
|
955
|
+
});
|
|
956
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
957
|
+
const data = body ? JSON.parse(body) : {};
|
|
958
|
+
return {
|
|
959
|
+
data,
|
|
960
|
+
status: res.status,
|
|
961
|
+
headers: res.headers,
|
|
962
|
+
};
|
|
963
|
+
};
|
|
964
|
+
export const getRescueInstanceUrl = (instanceId) => {
|
|
965
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:rescue`;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Boots a temporary rescue environment in place of the instance's own system, with the original boot volume attached to it as a further disk to repair. A running instance can be rescued, and so can one in `error`. A stopped instance is refused with 409 `INSTANCE_NOT_RUNNING`; start it first, which works even when its operating system no longer boots.
|
|
969
|
+
*
|
|
970
|
+
* In rescue mode, everything only the instance's own system can take is refused with 409 `INSTANCE_UNRESCUE_REQUIRED`: starting, stopping, rebooting, rebuilding, resetting the password, changing `instance_type_id`, attaching or detaching volumes and network interfaces, capturing a private image and running commands. Leave rescue mode with `:unrescue` first. The console stays available, releasing the instance works as usual, and the instance is charged as when running. A suspension that begins in rescue mode takes the instance out of rescue before stopping it, and starting it again once the suspension ends boots its own system.
|
|
971
|
+
*
|
|
972
|
+
* A rescue the compute service could not boot ends the `rescue` operation and leaves the instance as it was, or in `error`; request it again or reboot the instance.
|
|
973
|
+
*
|
|
974
|
+
* The request does not name an image. The rescue image is the region's enabled rescue image for the architecture of the instance's boot volume. A region and architecture with no enabled rescue image is refused with `RESCUE_IMAGE_NOT_CONFIGURED` (409).
|
|
975
|
+
* @summary Put an instance into rescue mode
|
|
976
|
+
*/
|
|
977
|
+
export const rescueInstance = async (instanceId, rescueInstanceRequestBody, options, fetchFn) => {
|
|
978
|
+
const getHeaders = (h) => {
|
|
979
|
+
if (!h)
|
|
980
|
+
return {};
|
|
981
|
+
if (h instanceof Headers)
|
|
982
|
+
return Object.fromEntries(h.entries());
|
|
983
|
+
if (Symbol.iterator in h) {
|
|
984
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
985
|
+
}
|
|
986
|
+
const headers = {};
|
|
987
|
+
for (const [name, value] of Object.entries(h)) {
|
|
988
|
+
if (value !== undefined)
|
|
989
|
+
headers[name] = value;
|
|
990
|
+
}
|
|
991
|
+
return headers;
|
|
992
|
+
};
|
|
993
|
+
const res = await (fetchFn ?? fetch)(getRescueInstanceUrl(instanceId), {
|
|
994
|
+
...options,
|
|
995
|
+
method: "POST",
|
|
996
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
997
|
+
body: JSON.stringify(rescueInstanceRequestBody),
|
|
998
|
+
});
|
|
999
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1000
|
+
const data = body ? JSON.parse(body) : {};
|
|
1001
|
+
return { data, status: res.status, headers: res.headers };
|
|
1002
|
+
};
|
|
1003
|
+
export const getUnrescueInstanceUrl = (instanceId) => {
|
|
1004
|
+
return `https://compute.leaflow.cloud/api/v2/instances/${encodeURIComponent(String(instanceId))}:unrescue`;
|
|
1005
|
+
};
|
|
1006
|
+
/**
|
|
1007
|
+
* Restores boot from the original boot volume. Completion is shown by the instance state, and the instance shows the `unrescue` operation until then.
|
|
1008
|
+
* @summary Take an instance out of rescue mode
|
|
1009
|
+
*/
|
|
1010
|
+
export const unrescueInstance = async (instanceId, options, fetchFn) => {
|
|
1011
|
+
const res = await (fetchFn ?? fetch)(getUnrescueInstanceUrl(instanceId), {
|
|
1012
|
+
...options,
|
|
1013
|
+
method: "POST",
|
|
1014
|
+
});
|
|
1015
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1016
|
+
const data = body ? JSON.parse(body) : {};
|
|
1017
|
+
return { data, status: res.status, headers: res.headers };
|
|
1018
|
+
};
|
|
1019
|
+
export const getListLaunchTemplatesUrl = (params) => {
|
|
1020
|
+
const normalizedParams = new URLSearchParams();
|
|
1021
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1022
|
+
if (value !== undefined) {
|
|
1023
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1027
|
+
return stringifiedParams.length > 0
|
|
1028
|
+
? `https://compute.leaflow.cloud/api/v2/launch-templates?${stringifiedParams}`
|
|
1029
|
+
: `https://compute.leaflow.cloud/api/v2/launch-templates`;
|
|
1030
|
+
};
|
|
1031
|
+
/**
|
|
1032
|
+
* @summary List launch templates
|
|
1033
|
+
*/
|
|
1034
|
+
export const listLaunchTemplates = async (params, options, fetchFn) => {
|
|
1035
|
+
const res = await (fetchFn ?? fetch)(getListLaunchTemplatesUrl(params), {
|
|
1036
|
+
...options,
|
|
1037
|
+
method: "GET",
|
|
1038
|
+
});
|
|
1039
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1040
|
+
const data = body ? JSON.parse(body) : {};
|
|
1041
|
+
return { data, status: res.status, headers: res.headers };
|
|
1042
|
+
};
|
|
1043
|
+
export const getCreateLaunchTemplateUrl = () => {
|
|
1044
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates`;
|
|
1045
|
+
};
|
|
1046
|
+
/**
|
|
1047
|
+
* Creates a launch template with its first version, which becomes its default. A launch template describes how to create instances in one region, and creating an instance can name it (`launch_template`) instead of repeating every part. It costs nothing.
|
|
1048
|
+
*
|
|
1049
|
+
* A template holds no billing terms, checkout options or password: those belong to each purchase. **What a version names is checked when an instance is created from it**, against the catalog as it is then, so a version naming an image retired since is refused at that creation as any creation would be.
|
|
1050
|
+
*
|
|
1051
|
+
* A project holds at most 100 launch templates in a region (`LAUNCH_TEMPLATE_LIMIT`), and names are unique among them (`LAUNCH_TEMPLATE_EXISTS`).
|
|
1052
|
+
* @summary Create a launch template
|
|
1053
|
+
*/
|
|
1054
|
+
export const createLaunchTemplate = async (createLaunchTemplateRequestBody, options, fetchFn) => {
|
|
1055
|
+
const getHeaders = (h) => {
|
|
1056
|
+
if (!h)
|
|
1057
|
+
return {};
|
|
1058
|
+
if (h instanceof Headers)
|
|
1059
|
+
return Object.fromEntries(h.entries());
|
|
1060
|
+
if (Symbol.iterator in h) {
|
|
1061
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1062
|
+
}
|
|
1063
|
+
const headers = {};
|
|
1064
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1065
|
+
if (value !== undefined)
|
|
1066
|
+
headers[name] = value;
|
|
1067
|
+
}
|
|
1068
|
+
return headers;
|
|
1069
|
+
};
|
|
1070
|
+
const res = await (fetchFn ?? fetch)(getCreateLaunchTemplateUrl(), {
|
|
1071
|
+
...options,
|
|
1072
|
+
method: "POST",
|
|
1073
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1074
|
+
body: JSON.stringify(createLaunchTemplateRequestBody),
|
|
1075
|
+
});
|
|
1076
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1077
|
+
const data = body ? JSON.parse(body) : {};
|
|
1078
|
+
return { data, status: res.status, headers: res.headers };
|
|
1079
|
+
};
|
|
1080
|
+
export const getGetLaunchTemplateUrl = (launchTemplateId) => {
|
|
1081
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}`;
|
|
1082
|
+
};
|
|
1083
|
+
/**
|
|
1084
|
+
* @summary Get a launch template
|
|
1085
|
+
*/
|
|
1086
|
+
export const getLaunchTemplate = async (launchTemplateId, options, fetchFn) => {
|
|
1087
|
+
const res = await (fetchFn ?? fetch)(getGetLaunchTemplateUrl(launchTemplateId), {
|
|
1088
|
+
...options,
|
|
1089
|
+
method: "GET",
|
|
1090
|
+
});
|
|
1091
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1092
|
+
const data = body ? JSON.parse(body) : {};
|
|
1093
|
+
return { data, status: res.status, headers: res.headers };
|
|
1094
|
+
};
|
|
1095
|
+
export const getUpdateLaunchTemplateUrl = (launchTemplateId) => {
|
|
1096
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}`;
|
|
1097
|
+
};
|
|
1098
|
+
/**
|
|
1099
|
+
* Changes the name or description, or makes another live version the default, the one a creation naming no version uses. Versions themselves never change; describe something else by creating a version.
|
|
1100
|
+
* @summary Update a launch template
|
|
1101
|
+
*/
|
|
1102
|
+
export const updateLaunchTemplate = async (launchTemplateId, updateLaunchTemplateRequestBody, options, fetchFn) => {
|
|
1103
|
+
const getHeaders = (h) => {
|
|
1104
|
+
if (!h)
|
|
1105
|
+
return {};
|
|
1106
|
+
if (h instanceof Headers)
|
|
1107
|
+
return Object.fromEntries(h.entries());
|
|
1108
|
+
if (Symbol.iterator in h) {
|
|
1109
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1110
|
+
}
|
|
1111
|
+
const headers = {};
|
|
1112
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1113
|
+
if (value !== undefined)
|
|
1114
|
+
headers[name] = value;
|
|
1115
|
+
}
|
|
1116
|
+
return headers;
|
|
1117
|
+
};
|
|
1118
|
+
const res = await (fetchFn ?? fetch)(getUpdateLaunchTemplateUrl(launchTemplateId), {
|
|
1119
|
+
...options,
|
|
1120
|
+
method: "PATCH",
|
|
1121
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1122
|
+
body: JSON.stringify(updateLaunchTemplateRequestBody),
|
|
1123
|
+
});
|
|
1124
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1125
|
+
const data = body ? JSON.parse(body) : {};
|
|
1126
|
+
return { data, status: res.status, headers: res.headers };
|
|
1127
|
+
};
|
|
1128
|
+
export const getDeleteLaunchTemplateUrl = (launchTemplateId) => {
|
|
1129
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}`;
|
|
1130
|
+
};
|
|
1131
|
+
/**
|
|
1132
|
+
* Deletes the template with every version. Instances created from it are not affected and keep naming the version they were created from.
|
|
1133
|
+
* @summary Delete a launch template
|
|
1134
|
+
*/
|
|
1135
|
+
export const deleteLaunchTemplate = async (launchTemplateId, options, fetchFn) => {
|
|
1136
|
+
const res = await (fetchFn ?? fetch)(getDeleteLaunchTemplateUrl(launchTemplateId), {
|
|
1137
|
+
...options,
|
|
1138
|
+
method: "DELETE",
|
|
1139
|
+
});
|
|
1140
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1141
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
1142
|
+
return { data, status: res.status, headers: res.headers };
|
|
1143
|
+
};
|
|
1144
|
+
export const getListLaunchTemplateVersionsUrl = (launchTemplateId, params) => {
|
|
1145
|
+
const normalizedParams = new URLSearchParams();
|
|
1146
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1147
|
+
if (value !== undefined) {
|
|
1148
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1152
|
+
return stringifiedParams.length > 0
|
|
1153
|
+
? `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}/versions?${stringifiedParams}`
|
|
1154
|
+
: `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}/versions`;
|
|
1155
|
+
};
|
|
1156
|
+
/**
|
|
1157
|
+
* Newest first.
|
|
1158
|
+
* @summary List the versions of a launch template
|
|
1159
|
+
*/
|
|
1160
|
+
export const listLaunchTemplateVersions = async (launchTemplateId, params, options, fetchFn) => {
|
|
1161
|
+
const res = await (fetchFn ?? fetch)(getListLaunchTemplateVersionsUrl(launchTemplateId, params), {
|
|
1162
|
+
...options,
|
|
1163
|
+
method: "GET",
|
|
1164
|
+
});
|
|
1165
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1166
|
+
const data = body ? JSON.parse(body) : {};
|
|
1167
|
+
return { data, status: res.status, headers: res.headers };
|
|
1168
|
+
};
|
|
1169
|
+
export const getCreateLaunchTemplateVersionUrl = (launchTemplateId) => {
|
|
1170
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}/versions`;
|
|
1171
|
+
};
|
|
1172
|
+
/**
|
|
1173
|
+
* Adds a version, numbered after every version the template ever had, so a deleted version's number is never reused. It does not become the default by itself; set `default_version_number` on the template for that. A template holds at most 100 live versions (`LAUNCH_TEMPLATE_VERSION_LIMIT`).
|
|
1174
|
+
* @summary Create a launch template version
|
|
1175
|
+
*/
|
|
1176
|
+
export const createLaunchTemplateVersion = async (launchTemplateId, newLaunchTemplateVersion, options, fetchFn) => {
|
|
1177
|
+
const getHeaders = (h) => {
|
|
1178
|
+
if (!h)
|
|
1179
|
+
return {};
|
|
1180
|
+
if (h instanceof Headers)
|
|
1181
|
+
return Object.fromEntries(h.entries());
|
|
1182
|
+
if (Symbol.iterator in h) {
|
|
1183
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1184
|
+
}
|
|
1185
|
+
const headers = {};
|
|
1186
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1187
|
+
if (value !== undefined)
|
|
1188
|
+
headers[name] = value;
|
|
1189
|
+
}
|
|
1190
|
+
return headers;
|
|
1191
|
+
};
|
|
1192
|
+
const res = await (fetchFn ?? fetch)(getCreateLaunchTemplateVersionUrl(launchTemplateId), {
|
|
1193
|
+
...options,
|
|
1194
|
+
method: "POST",
|
|
1195
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1196
|
+
body: JSON.stringify(newLaunchTemplateVersion),
|
|
1197
|
+
});
|
|
1198
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1199
|
+
const data = body ? JSON.parse(body) : {};
|
|
1200
|
+
return { data, status: res.status, headers: res.headers };
|
|
1201
|
+
};
|
|
1202
|
+
export const getGetLaunchTemplateVersionUrl = (launchTemplateId, versionNumber) => {
|
|
1203
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}/versions/${encodeURIComponent(String(versionNumber))}`;
|
|
1204
|
+
};
|
|
1205
|
+
/**
|
|
1206
|
+
* @summary Get a launch template version
|
|
1207
|
+
*/
|
|
1208
|
+
export const getLaunchTemplateVersion = async (launchTemplateId, versionNumber, options, fetchFn) => {
|
|
1209
|
+
const res = await (fetchFn ?? fetch)(getGetLaunchTemplateVersionUrl(launchTemplateId, versionNumber), {
|
|
1210
|
+
...options,
|
|
1211
|
+
method: "GET",
|
|
1212
|
+
});
|
|
1213
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1214
|
+
const data = body ? JSON.parse(body) : {};
|
|
1215
|
+
return { data, status: res.status, headers: res.headers };
|
|
1216
|
+
};
|
|
1217
|
+
export const getDeleteLaunchTemplateVersionUrl = (launchTemplateId, versionNumber) => {
|
|
1218
|
+
return `https://compute.leaflow.cloud/api/v2/launch-templates/${encodeURIComponent(String(launchTemplateId))}/versions/${encodeURIComponent(String(versionNumber))}`;
|
|
1219
|
+
};
|
|
1220
|
+
/**
|
|
1221
|
+
* The default version cannot be deleted (`LAUNCH_TEMPLATE_VERSION_DEFAULT`); make another version the default first.
|
|
1222
|
+
* @summary Delete a launch template version
|
|
1223
|
+
*/
|
|
1224
|
+
export const deleteLaunchTemplateVersion = async (launchTemplateId, versionNumber, options, fetchFn) => {
|
|
1225
|
+
const res = await (fetchFn ?? fetch)(getDeleteLaunchTemplateVersionUrl(launchTemplateId, versionNumber), {
|
|
1226
|
+
...options,
|
|
1227
|
+
method: "DELETE",
|
|
1228
|
+
});
|
|
1229
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1230
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
1231
|
+
return { data, status: res.status, headers: res.headers };
|
|
1232
|
+
};
|
|
1233
|
+
export const getListNetworkInterfacesUrl = (params) => {
|
|
1234
|
+
const normalizedParams = new URLSearchParams();
|
|
1235
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1236
|
+
if (value !== undefined) {
|
|
1237
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1241
|
+
return stringifiedParams.length > 0
|
|
1242
|
+
? `https://compute.leaflow.cloud/api/v2/network-interfaces?${stringifiedParams}`
|
|
1243
|
+
: `https://compute.leaflow.cloud/api/v2/network-interfaces`;
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* @summary List network interfaces
|
|
1247
|
+
*/
|
|
1248
|
+
export const listNetworkInterfaces = async (params, options, fetchFn) => {
|
|
1249
|
+
const res = await (fetchFn ?? fetch)(getListNetworkInterfacesUrl(params), {
|
|
1250
|
+
...options,
|
|
1251
|
+
method: "GET",
|
|
1252
|
+
});
|
|
1253
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1254
|
+
const data = body ? JSON.parse(body) : {};
|
|
1255
|
+
return { data, status: res.status, headers: res.headers };
|
|
1256
|
+
};
|
|
1257
|
+
export const getCreateNetworkInterfaceUrl = () => {
|
|
1258
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces`;
|
|
1259
|
+
};
|
|
1260
|
+
/**
|
|
1261
|
+
* The new network interface is not attached to any instance. Primary network interfaces are not created here; they are created with the instance.
|
|
1262
|
+
* @summary Create a network interface
|
|
1263
|
+
*/
|
|
1264
|
+
export const createNetworkInterface = async (createNetworkInterfaceRequestBody, options, fetchFn) => {
|
|
1265
|
+
const getHeaders = (h) => {
|
|
1266
|
+
if (!h)
|
|
1267
|
+
return {};
|
|
1268
|
+
if (h instanceof Headers)
|
|
1269
|
+
return Object.fromEntries(h.entries());
|
|
1270
|
+
if (Symbol.iterator in h) {
|
|
1271
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1272
|
+
}
|
|
1273
|
+
const headers = {};
|
|
1274
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1275
|
+
if (value !== undefined)
|
|
1276
|
+
headers[name] = value;
|
|
1277
|
+
}
|
|
1278
|
+
return headers;
|
|
1279
|
+
};
|
|
1280
|
+
const res = await (fetchFn ?? fetch)(getCreateNetworkInterfaceUrl(), {
|
|
1281
|
+
...options,
|
|
1282
|
+
method: "POST",
|
|
1283
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1284
|
+
body: JSON.stringify(createNetworkInterfaceRequestBody),
|
|
1285
|
+
});
|
|
1286
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1287
|
+
const data = body ? JSON.parse(body) : {};
|
|
1288
|
+
return { data, status: res.status, headers: res.headers };
|
|
1289
|
+
};
|
|
1290
|
+
export const getGetNetworkInterfaceUrl = (networkInterfaceId) => {
|
|
1291
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}`;
|
|
1292
|
+
};
|
|
1293
|
+
/**
|
|
1294
|
+
* Returns the stored state of the network interface; it does not query the cloud.
|
|
1295
|
+
* @summary Retrieve a network interface
|
|
1296
|
+
*/
|
|
1297
|
+
export const getNetworkInterface = async (networkInterfaceId, options, fetchFn) => {
|
|
1298
|
+
const res = await (fetchFn ?? fetch)(getGetNetworkInterfaceUrl(networkInterfaceId), {
|
|
1299
|
+
...options,
|
|
1300
|
+
method: "GET",
|
|
1301
|
+
});
|
|
1302
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1303
|
+
const data = body ? JSON.parse(body) : {};
|
|
1304
|
+
return { data, status: res.status, headers: res.headers };
|
|
1305
|
+
};
|
|
1306
|
+
export const getUpdateNetworkInterfaceUrl = (networkInterfaceId) => {
|
|
1307
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}`;
|
|
1308
|
+
};
|
|
1309
|
+
/**
|
|
1310
|
+
* Changes the name, or replaces the security groups. The two are never combined (422 `UPDATE_FIELDS_COMBINED`).
|
|
1311
|
+
*
|
|
1312
|
+
* - `name` is not an operation, is accepted at any time and answers 200.
|
|
1313
|
+
* - `security_group_ids` is the complete new set, one to five groups of the network interface's virtual private cloud; groups left out are removed. It applies to traffic of the running instance as soon as it is in place, and answers 202 with the network interface showing the `update_security_groups` operation until then.
|
|
1314
|
+
*
|
|
1315
|
+
* Secondary IPv4 addresses are added and removed under `/network-interfaces/{networkInterfaceId}/addresses`.
|
|
1316
|
+
* @summary Update a network interface
|
|
1317
|
+
*/
|
|
1318
|
+
export const updateNetworkInterface = async (networkInterfaceId, updateNetworkInterfaceRequestBody, options, fetchFn) => {
|
|
1319
|
+
const getHeaders = (h) => {
|
|
1320
|
+
if (!h)
|
|
1321
|
+
return {};
|
|
1322
|
+
if (h instanceof Headers)
|
|
1323
|
+
return Object.fromEntries(h.entries());
|
|
1324
|
+
if (Symbol.iterator in h) {
|
|
1325
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1326
|
+
}
|
|
1327
|
+
const headers = {};
|
|
1328
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1329
|
+
if (value !== undefined)
|
|
1330
|
+
headers[name] = value;
|
|
1331
|
+
}
|
|
1332
|
+
return headers;
|
|
1333
|
+
};
|
|
1334
|
+
const res = await (fetchFn ?? fetch)(getUpdateNetworkInterfaceUrl(networkInterfaceId), {
|
|
1335
|
+
...options,
|
|
1336
|
+
method: "PATCH",
|
|
1337
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1338
|
+
body: JSON.stringify(updateNetworkInterfaceRequestBody),
|
|
1339
|
+
});
|
|
1340
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1341
|
+
const data = body ? JSON.parse(body) : {};
|
|
1342
|
+
return { data, status: res.status, headers: res.headers };
|
|
1343
|
+
};
|
|
1344
|
+
export const getDeleteNetworkInterfaceUrl = (networkInterfaceId) => {
|
|
1345
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}`;
|
|
1346
|
+
};
|
|
1347
|
+
/**
|
|
1348
|
+
* The primary network interface cannot be deleted on its own, as it is released with the instance. A network interface still attached to an instance cannot be deleted either.
|
|
1349
|
+
* @summary Delete a network interface
|
|
1350
|
+
*/
|
|
1351
|
+
export const deleteNetworkInterface = async (networkInterfaceId, options, fetchFn) => {
|
|
1352
|
+
const res = await (fetchFn ?? fetch)(getDeleteNetworkInterfaceUrl(networkInterfaceId), {
|
|
1353
|
+
...options,
|
|
1354
|
+
method: "DELETE",
|
|
1355
|
+
});
|
|
1356
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1357
|
+
const data = body ? JSON.parse(body) : {};
|
|
1358
|
+
return { data, status: res.status, headers: res.headers };
|
|
1359
|
+
};
|
|
1360
|
+
export const getCreateNetworkInterfaceAddressUrl = (networkInterfaceId) => {
|
|
1361
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}/addresses`;
|
|
1362
|
+
};
|
|
1363
|
+
/**
|
|
1364
|
+
* Adds an IPv4 address in the network interface's subnet, given or chosen by the network, and answers 202 with the network interface showing the `add_address` operation until the address is in place; it then appears among `addresses` with `role` `secondary`. An elastic IP can be associated with it like the primary address.
|
|
1365
|
+
*
|
|
1366
|
+
* **The operating system has to be configured to use it**: DHCP hands out only the primary address. Changing the addresses of a network interface in use may briefly interrupt its traffic.
|
|
1367
|
+
*
|
|
1368
|
+
* A network interface holds at most its instance's instance type's `max_ipv4_per_network_interface` IPv4 addresses while attached, and 50 otherwise (409 `NETWORK_INTERFACE_ADDRESS_CEILING`). An address already in use in the subnet is refused with 409 `NETWORK_INTERFACE_ADDRESS_ALREADY_TAKEN`, a full subnet with 409 `NETWORK_INTERFACE_SUBNET_EXHAUSTED`.
|
|
1369
|
+
* @summary Add a secondary IPv4 address
|
|
1370
|
+
*/
|
|
1371
|
+
export const createNetworkInterfaceAddress = async (networkInterfaceId, createNetworkInterfaceAddressRequestBody, options, fetchFn) => {
|
|
1372
|
+
const getHeaders = (h) => {
|
|
1373
|
+
if (!h)
|
|
1374
|
+
return {};
|
|
1375
|
+
if (h instanceof Headers)
|
|
1376
|
+
return Object.fromEntries(h.entries());
|
|
1377
|
+
if (Symbol.iterator in h) {
|
|
1378
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1379
|
+
}
|
|
1380
|
+
const headers = {};
|
|
1381
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1382
|
+
if (value !== undefined)
|
|
1383
|
+
headers[name] = value;
|
|
1384
|
+
}
|
|
1385
|
+
return headers;
|
|
1386
|
+
};
|
|
1387
|
+
const res = await (fetchFn ?? fetch)(getCreateNetworkInterfaceAddressUrl(networkInterfaceId), {
|
|
1388
|
+
...options,
|
|
1389
|
+
method: "POST",
|
|
1390
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1391
|
+
body: JSON.stringify(createNetworkInterfaceAddressRequestBody),
|
|
1392
|
+
});
|
|
1393
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1394
|
+
const data = body ? JSON.parse(body) : {};
|
|
1395
|
+
return {
|
|
1396
|
+
data,
|
|
1397
|
+
status: res.status,
|
|
1398
|
+
headers: res.headers,
|
|
1399
|
+
};
|
|
1400
|
+
};
|
|
1401
|
+
export const getDeleteNetworkInterfaceAddressUrl = (networkInterfaceId, addressId) => {
|
|
1402
|
+
return `https://compute.leaflow.cloud/api/v2/network-interfaces/${encodeURIComponent(String(networkInterfaceId))}/addresses/${encodeURIComponent(String(addressId))}`;
|
|
1403
|
+
};
|
|
1404
|
+
/**
|
|
1405
|
+
* Removes a secondary IPv4 address and answers 202 with the network interface showing the `remove_address` operation until it is gone. The primary address goes only with the network interface (409 `NETWORK_INTERFACE_ADDRESS_PRIMARY`), and an address an elastic IP is associated with is refused until it is disassociated (409 `NETWORK_INTERFACE_ADDRESS_ASSOCIATED`).
|
|
1406
|
+
* @summary Remove a secondary IPv4 address
|
|
1407
|
+
*/
|
|
1408
|
+
export const deleteNetworkInterfaceAddress = async (networkInterfaceId, addressId, options, fetchFn) => {
|
|
1409
|
+
const res = await (fetchFn ?? fetch)(getDeleteNetworkInterfaceAddressUrl(networkInterfaceId, addressId), {
|
|
1410
|
+
...options,
|
|
1411
|
+
method: "DELETE",
|
|
1412
|
+
});
|
|
1413
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1414
|
+
const data = body ? JSON.parse(body) : {};
|
|
1415
|
+
return {
|
|
1416
|
+
data,
|
|
1417
|
+
status: res.status,
|
|
1418
|
+
headers: res.headers,
|
|
1419
|
+
};
|
|
1420
|
+
};
|
|
1421
|
+
export const getListOperationLogsUrl = (params) => {
|
|
1422
|
+
const normalizedParams = new URLSearchParams();
|
|
1423
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1424
|
+
if (value !== undefined) {
|
|
1425
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1429
|
+
return stringifiedParams.length > 0
|
|
1430
|
+
? `https://compute.leaflow.cloud/api/v2/operation-logs?${stringifiedParams}`
|
|
1431
|
+
: `https://compute.leaflow.cloud/api/v2/operation-logs`;
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* Records every write operation in the project: who performed it, when, on what, and its outcome. Read operations are not recorded.
|
|
1435
|
+
*
|
|
1436
|
+
* **Operations performed by the platform are included, but the individual operator is not disclosed** and `actor_type` is `platform`. Suspension for non-payment and bans for abuse are examples: the time at which an instance was stopped by the platform is needed, whereas the operator is internal information.
|
|
1437
|
+
*
|
|
1438
|
+
* Fields such as passwords are replaced with a placeholder as the record is written and never appear in `payload`.
|
|
1439
|
+
* @summary List the operation log of the project
|
|
1440
|
+
*/
|
|
1441
|
+
export const listOperationLogs = async (params, options, fetchFn) => {
|
|
1442
|
+
const res = await (fetchFn ?? fetch)(getListOperationLogsUrl(params), {
|
|
1443
|
+
...options,
|
|
1444
|
+
method: "GET",
|
|
1445
|
+
});
|
|
1446
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1447
|
+
const data = body ? JSON.parse(body) : {};
|
|
1448
|
+
return { data, status: res.status, headers: res.headers };
|
|
1449
|
+
};
|
|
1450
|
+
export const getGetOperationLogUrl = (operationLogId) => {
|
|
1451
|
+
return `https://compute.leaflow.cloud/api/v2/operation-logs/${encodeURIComponent(String(operationLogId))}`;
|
|
1452
|
+
};
|
|
1453
|
+
/**
|
|
1454
|
+
* Returns one entry of the project's operation log. Like the listing, it never discloses the individual operator of an operation performed by the platform.
|
|
1455
|
+
* @summary Retrieve an operation log entry
|
|
1456
|
+
*/
|
|
1457
|
+
export const getOperationLog = async (operationLogId, options, fetchFn) => {
|
|
1458
|
+
const res = await (fetchFn ?? fetch)(getGetOperationLogUrl(operationLogId), {
|
|
1459
|
+
...options,
|
|
1460
|
+
method: "GET",
|
|
1461
|
+
});
|
|
1462
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1463
|
+
const data = body ? JSON.parse(body) : {};
|
|
1464
|
+
return { data, status: res.status, headers: res.headers };
|
|
1465
|
+
};
|
|
1466
|
+
export const getListPrivateImagesUrl = (params) => {
|
|
1467
|
+
const normalizedParams = new URLSearchParams();
|
|
1468
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1469
|
+
if (value !== undefined) {
|
|
1470
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1474
|
+
return stringifiedParams.length > 0
|
|
1475
|
+
? `https://compute.leaflow.cloud/api/v2/private-images?${stringifiedParams}`
|
|
1476
|
+
: `https://compute.leaflow.cloud/api/v2/private-images`;
|
|
1477
|
+
};
|
|
1478
|
+
/**
|
|
1479
|
+
* Lists the private images of this project, newest first, in every status: including while a capture is in progress and after it failed. Private images of other projects are never listed.
|
|
1480
|
+
*
|
|
1481
|
+
* A private image is usable only by the project that captured it from one of its instances. Its storage is metered by the hour on a subscription of the project.
|
|
1482
|
+
*
|
|
1483
|
+
* An image can only be used in the region that holds it. An image whose `min_memory_mib` exceeds the memory of the selected instance type cannot boot; filter the options accordingly. Public images are in `/public-images`.
|
|
1484
|
+
* @summary List private images
|
|
1485
|
+
*/
|
|
1486
|
+
export const listPrivateImages = async (params, options, fetchFn) => {
|
|
1487
|
+
const res = await (fetchFn ?? fetch)(getListPrivateImagesUrl(params), {
|
|
1488
|
+
...options,
|
|
1489
|
+
method: "GET",
|
|
1490
|
+
});
|
|
1491
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1492
|
+
const data = body ? JSON.parse(body) : {};
|
|
1493
|
+
return { data, status: res.status, headers: res.headers };
|
|
1494
|
+
};
|
|
1495
|
+
export const getCreatePrivateImageUrl = () => {
|
|
1496
|
+
return `https://compute.leaflow.cloud/api/v2/private-images`;
|
|
1497
|
+
};
|
|
1498
|
+
/**
|
|
1499
|
+
* Creates a project image from the instance boot volume, excluding data volumes. Stop the instance first for file-system consistency. The instance cannot be released while its source volume is being captured. Compute project quotas are enforced independently of billing.
|
|
1500
|
+
*
|
|
1501
|
+
* It is metered on a subscription of its own and takes no billing choice. Each second the image is stored is reported under its region and its `billing_position`: its place among the project's stored private images in the region, counted from the oldest, which moves up whenever an older one is deleted. Billing prices each position, and a position it prices at zero costs nothing; that is how a number of images in each region are free. The image's size does not change what it costs. It is bought through a Billing Checkout Session: automatic checkout completes at once for metered pricing and the image is captured as soon as the order is accepted; with deferred checkout it stays `pending` until the customer completes checkout in Billing. The source and project quotas are checked before the Checkout Session is created, and a refused request creates nothing.
|
|
1502
|
+
*
|
|
1503
|
+
* The image shows the `create` operation from the moment its Checkout Session is created until it is delivered or its checkout or order ends. While its purchase awaits checkout or payment its deletion is refused with `COMPUTE_PURCHASE_PENDING`; once the capture runs, deletion is the one operation it accepts.
|
|
1504
|
+
* @summary Capture an instance as a private image
|
|
1505
|
+
*/
|
|
1506
|
+
export const createPrivateImage = async (createPrivateImageRequestBody, options, fetchFn) => {
|
|
1507
|
+
const getHeaders = (h) => {
|
|
1508
|
+
if (!h)
|
|
1509
|
+
return {};
|
|
1510
|
+
if (h instanceof Headers)
|
|
1511
|
+
return Object.fromEntries(h.entries());
|
|
1512
|
+
if (Symbol.iterator in h) {
|
|
1513
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1514
|
+
}
|
|
1515
|
+
const headers = {};
|
|
1516
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1517
|
+
if (value !== undefined)
|
|
1518
|
+
headers[name] = value;
|
|
1519
|
+
}
|
|
1520
|
+
return headers;
|
|
1521
|
+
};
|
|
1522
|
+
const res = await (fetchFn ?? fetch)(getCreatePrivateImageUrl(), {
|
|
1523
|
+
...options,
|
|
1524
|
+
method: "POST",
|
|
1525
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1526
|
+
body: JSON.stringify(createPrivateImageRequestBody),
|
|
1527
|
+
});
|
|
1528
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1529
|
+
const data = body ? JSON.parse(body) : {};
|
|
1530
|
+
return { data, status: res.status, headers: res.headers };
|
|
1531
|
+
};
|
|
1532
|
+
export const getGetPrivateImageUrl = (privateImageId) => {
|
|
1533
|
+
return `https://compute.leaflow.cloud/api/v2/private-images/${encodeURIComponent(String(privateImageId))}`;
|
|
1534
|
+
};
|
|
1535
|
+
/**
|
|
1536
|
+
* Returns a private image of this project; any other image, public images included, is reported as not found. Use this endpoint to poll capture progress. When `status` is `failed`, `failure` describes the outcome.
|
|
1537
|
+
* @summary Retrieve a private image
|
|
1538
|
+
*/
|
|
1539
|
+
export const getPrivateImage = async (privateImageId, options, fetchFn) => {
|
|
1540
|
+
const res = await (fetchFn ?? fetch)(getGetPrivateImageUrl(privateImageId), {
|
|
1541
|
+
...options,
|
|
1542
|
+
method: "GET",
|
|
1543
|
+
});
|
|
1544
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1545
|
+
const data = body ? JSON.parse(body) : {};
|
|
1546
|
+
return { data, status: res.status, headers: res.headers };
|
|
1547
|
+
};
|
|
1548
|
+
export const getUpdatePrivateImageUrl = (privateImageId) => {
|
|
1549
|
+
return `https://compute.leaflow.cloud/api/v2/private-images/${encodeURIComponent(String(privateImageId))}`;
|
|
1550
|
+
};
|
|
1551
|
+
/**
|
|
1552
|
+
* Renames a private image of this project. Any other image, public images included, is reported as not found.
|
|
1553
|
+
* @summary Update a private image
|
|
1554
|
+
*/
|
|
1555
|
+
export const updatePrivateImage = async (privateImageId, updatePrivateImageRequestBody, options, fetchFn) => {
|
|
1556
|
+
const getHeaders = (h) => {
|
|
1557
|
+
if (!h)
|
|
1558
|
+
return {};
|
|
1559
|
+
if (h instanceof Headers)
|
|
1560
|
+
return Object.fromEntries(h.entries());
|
|
1561
|
+
if (Symbol.iterator in h) {
|
|
1562
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1563
|
+
}
|
|
1564
|
+
const headers = {};
|
|
1565
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1566
|
+
if (value !== undefined)
|
|
1567
|
+
headers[name] = value;
|
|
1568
|
+
}
|
|
1569
|
+
return headers;
|
|
1570
|
+
};
|
|
1571
|
+
const res = await (fetchFn ?? fetch)(getUpdatePrivateImageUrl(privateImageId), {
|
|
1572
|
+
...options,
|
|
1573
|
+
method: "PATCH",
|
|
1574
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1575
|
+
body: JSON.stringify(updatePrivateImageRequestBody),
|
|
1576
|
+
});
|
|
1577
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1578
|
+
const data = body ? JSON.parse(body) : {};
|
|
1579
|
+
return { data, status: res.status, headers: res.headers };
|
|
1580
|
+
};
|
|
1581
|
+
export const getDeletePrivateImageUrl = (privateImageId, params) => {
|
|
1582
|
+
const normalizedParams = new URLSearchParams();
|
|
1583
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1584
|
+
if (value !== undefined) {
|
|
1585
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1589
|
+
return stringifiedParams.length > 0
|
|
1590
|
+
? `https://compute.leaflow.cloud/api/v2/private-images/${encodeURIComponent(String(privateImageId))}?${stringifiedParams}`
|
|
1591
|
+
: `https://compute.leaflow.cloud/api/v2/private-images/${encodeURIComponent(String(privateImageId))}`;
|
|
1592
|
+
};
|
|
1593
|
+
/**
|
|
1594
|
+
* Deletes a private image of this project; any other image, public images included, is reported as not found.
|
|
1595
|
+
*
|
|
1596
|
+
* Deletion is rejected while instances created from the image still exist, as they need it in order to be rebuilt.
|
|
1597
|
+
*
|
|
1598
|
+
* An image whose capture has not finished can be deleted; the capture is aborted. This is the one operation accepted while the `create` operation is in progress.
|
|
1599
|
+
*
|
|
1600
|
+
* Quota capacity and storage metering are released only after cleanup is confirmed.
|
|
1601
|
+
*
|
|
1602
|
+
* A resource whose purchase still awaits checkout or payment is refused with `COMPUTE_PURCHASE_PENDING`; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead. A subscribed resource is released through its subscription cancellation. Cleanup must be confirmed before metering is stopped; unknown cleanup is not proof of release.
|
|
1603
|
+
*
|
|
1604
|
+
* While subscriptions pay for the private image (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the private image working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
1605
|
+
* @summary Delete a private image
|
|
1606
|
+
*/
|
|
1607
|
+
export const deletePrivateImage = async (privateImageId, params, options, fetchFn) => {
|
|
1608
|
+
const res = await (fetchFn ?? fetch)(getDeletePrivateImageUrl(privateImageId, params), {
|
|
1609
|
+
...options,
|
|
1610
|
+
method: "DELETE",
|
|
1611
|
+
});
|
|
1612
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1613
|
+
const data = body ? JSON.parse(body) : {};
|
|
1614
|
+
return { data, status: res.status, headers: res.headers };
|
|
1615
|
+
};
|
|
1616
|
+
export const getListPublicImagesUrl = (params) => {
|
|
1617
|
+
const normalizedParams = new URLSearchParams();
|
|
1618
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1619
|
+
if (value !== undefined) {
|
|
1620
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1624
|
+
return stringifiedParams.length > 0
|
|
1625
|
+
? `https://compute.leaflow.cloud/api/v2/public-images?${stringifiedParams}`
|
|
1626
|
+
: `https://compute.leaflow.cloud/api/v2/public-images`;
|
|
1627
|
+
};
|
|
1628
|
+
/**
|
|
1629
|
+
* Lists the platform's public images that are on sale. A public image is offered to every project. One the platform withdraws disappears from here and can no longer install new instances, while the instances already running it keep running and can still be rebuilt onto it; retrieve it by id to see it.
|
|
1630
|
+
*
|
|
1631
|
+
* An image can only be used in the region that holds it. An image whose `min_memory_mib` exceeds the memory of the selected instance type cannot boot; filter the options accordingly.
|
|
1632
|
+
*
|
|
1633
|
+
* Images this project captured from its own instances are in `/private-images`.
|
|
1634
|
+
* @summary List public images
|
|
1635
|
+
*/
|
|
1636
|
+
export const listPublicImages = async (params, options, fetchFn) => {
|
|
1637
|
+
const res = await (fetchFn ?? fetch)(getListPublicImagesUrl(params), {
|
|
1638
|
+
...options,
|
|
1639
|
+
method: "GET",
|
|
1640
|
+
});
|
|
1641
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1642
|
+
const data = body ? JSON.parse(body) : {};
|
|
1643
|
+
return { data, status: res.status, headers: res.headers };
|
|
1644
|
+
};
|
|
1645
|
+
export const getGetPublicImageUrl = (publicImageId) => {
|
|
1646
|
+
return `https://compute.leaflow.cloud/api/v2/public-images/${encodeURIComponent(String(publicImageId))}`;
|
|
1647
|
+
};
|
|
1648
|
+
/**
|
|
1649
|
+
* Returns a public image, on sale or withdrawn. A withdrawn image (`sale_status` is `off_sale`) is still returned because instances may keep running it; it cannot be chosen for a new instance and can only be rebuilt onto by an instance that already runs it. A private image id is reported as not found here; use `/private-images`.
|
|
1650
|
+
* @summary Retrieve a public image
|
|
1651
|
+
*/
|
|
1652
|
+
export const getPublicImage = async (publicImageId, options, fetchFn) => {
|
|
1653
|
+
const res = await (fetchFn ?? fetch)(getGetPublicImageUrl(publicImageId), {
|
|
1654
|
+
...options,
|
|
1655
|
+
method: "GET",
|
|
1656
|
+
});
|
|
1657
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1658
|
+
const data = body ? JSON.parse(body) : {};
|
|
1659
|
+
return { data, status: res.status, headers: res.headers };
|
|
1660
|
+
};
|
|
1661
|
+
export const getListQuotasUrl = (regionId, params) => {
|
|
1662
|
+
const normalizedParams = new URLSearchParams();
|
|
1663
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1664
|
+
if (value !== undefined) {
|
|
1665
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1666
|
+
}
|
|
1667
|
+
});
|
|
1668
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1669
|
+
return stringifiedParams.length > 0
|
|
1670
|
+
? `https://compute.leaflow.cloud/api/v2/regions/${encodeURIComponent(String(regionId))}/quotas?${stringifiedParams}`
|
|
1671
|
+
: `https://compute.leaflow.cloud/api/v2/regions/${encodeURIComponent(String(regionId))}/quotas`;
|
|
1672
|
+
};
|
|
1673
|
+
/**
|
|
1674
|
+
* Reads only the IAM project authorized by the scoped token; callers cannot select another project. Returns every resource's limit for the project in the region through shared pagination, the platform default included where no limit was set. A quota is per region, since each region has its own capacity; what the project holds in one region never counts against another. An unknown region is refused with 404. No usage is returned.
|
|
1675
|
+
* @summary List project quotas in a region
|
|
1676
|
+
*/
|
|
1677
|
+
export const listQuotas = async (regionId, params, options, fetchFn) => {
|
|
1678
|
+
const res = await (fetchFn ?? fetch)(getListQuotasUrl(regionId, params), {
|
|
1679
|
+
...options,
|
|
1680
|
+
method: "GET",
|
|
1681
|
+
});
|
|
1682
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1683
|
+
const data = body ? JSON.parse(body) : {};
|
|
1684
|
+
return { data, status: res.status, headers: res.headers };
|
|
1685
|
+
};
|
|
1686
|
+
export const getGetQuotaUrl = (regionId, resource) => {
|
|
1687
|
+
return `https://compute.leaflow.cloud/api/v2/regions/${encodeURIComponent(String(regionId))}/quotas/${encodeURIComponent(String(resource))}`;
|
|
1688
|
+
};
|
|
1689
|
+
/**
|
|
1690
|
+
* Reads only the IAM project authorized by the scoped token; callers cannot select another project. Returns the limit in force, the platform default when no limit was set. Unknown resource values are rejected; an unknown region is refused with 404.
|
|
1691
|
+
* @summary Get a project quota in a region
|
|
1692
|
+
*/
|
|
1693
|
+
export const getQuota = async (regionId, resource, options, fetchFn) => {
|
|
1694
|
+
const res = await (fetchFn ?? fetch)(getGetQuotaUrl(regionId, resource), {
|
|
1695
|
+
...options,
|
|
1696
|
+
method: "GET",
|
|
1697
|
+
});
|
|
1698
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1699
|
+
const data = body ? JSON.parse(body) : {};
|
|
1700
|
+
return { data, status: res.status, headers: res.headers };
|
|
1701
|
+
};
|
|
1702
|
+
export const getListRegionsUrl = (params) => {
|
|
1703
|
+
const normalizedParams = new URLSearchParams();
|
|
1704
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1705
|
+
if (value !== undefined) {
|
|
1706
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1707
|
+
}
|
|
1708
|
+
});
|
|
1709
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1710
|
+
return stringifiedParams.length > 0
|
|
1711
|
+
? `https://compute.leaflow.cloud/api/v2/regions?${stringifiedParams}`
|
|
1712
|
+
: `https://compute.leaflow.cloud/api/v2/regions`;
|
|
1713
|
+
};
|
|
1714
|
+
/**
|
|
1715
|
+
* @summary List available regions
|
|
1716
|
+
*/
|
|
1717
|
+
export const listRegions = async (params, options, fetchFn) => {
|
|
1718
|
+
const res = await (fetchFn ?? fetch)(getListRegionsUrl(params), {
|
|
1719
|
+
...options,
|
|
1720
|
+
method: "GET",
|
|
1721
|
+
});
|
|
1722
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1723
|
+
const data = body ? JSON.parse(body) : {};
|
|
1724
|
+
return { data, status: res.status, headers: res.headers };
|
|
1725
|
+
};
|
|
1726
|
+
export const getGetRegionUrl = (regionId) => {
|
|
1727
|
+
return `https://compute.leaflow.cloud/api/v2/regions/${encodeURIComponent(String(regionId))}`;
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* The availability zones of a region are listed by `list-availability-zones` with `region_id`.
|
|
1731
|
+
* @summary Retrieve a region
|
|
1732
|
+
*/
|
|
1733
|
+
export const getRegion = async (regionId, options, fetchFn) => {
|
|
1734
|
+
const res = await (fetchFn ?? fetch)(getGetRegionUrl(regionId), {
|
|
1735
|
+
...options,
|
|
1736
|
+
method: "GET",
|
|
1737
|
+
});
|
|
1738
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1739
|
+
const data = body ? JSON.parse(body) : {};
|
|
1740
|
+
return { data, status: res.status, headers: res.headers };
|
|
1741
|
+
};
|
|
1742
|
+
export const getListSecurityGroupRulesUrl = (securityGroupId, params) => {
|
|
1743
|
+
const normalizedParams = new URLSearchParams();
|
|
1744
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1745
|
+
if (value !== undefined) {
|
|
1746
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1750
|
+
return stringifiedParams.length > 0
|
|
1751
|
+
? `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}/rules?${stringifiedParams}`
|
|
1752
|
+
: `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}/rules`;
|
|
1753
|
+
};
|
|
1754
|
+
/**
|
|
1755
|
+
* The rules of the security group, or with `-` those of every security group of the project.
|
|
1756
|
+
* @summary List security group rules
|
|
1757
|
+
*/
|
|
1758
|
+
export const listSecurityGroupRules = async (securityGroupId, params, options, fetchFn) => {
|
|
1759
|
+
const res = await (fetchFn ?? fetch)(getListSecurityGroupRulesUrl(securityGroupId, params), {
|
|
1760
|
+
...options,
|
|
1761
|
+
method: "GET",
|
|
1762
|
+
});
|
|
1763
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1764
|
+
const data = body ? JSON.parse(body) : {};
|
|
1765
|
+
return { data, status: res.status, headers: res.headers };
|
|
1766
|
+
};
|
|
1767
|
+
export const getCreateSecurityGroupRuleUrl = (securityGroupId) => {
|
|
1768
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}/rules`;
|
|
1769
|
+
};
|
|
1770
|
+
/**
|
|
1771
|
+
* Refused when the group already has a rule meaning the same thing; `0.0.0.0/0`, `::/0` and an omitted remote prefix all mean every address. Rules cannot be changed; replace one by creating the new rule and deleting the old one.
|
|
1772
|
+
* @summary Create a security group rule
|
|
1773
|
+
*/
|
|
1774
|
+
export const createSecurityGroupRule = async (securityGroupId, createSecurityGroupRuleRequestBody, options, fetchFn) => {
|
|
1775
|
+
const getHeaders = (h) => {
|
|
1776
|
+
if (!h)
|
|
1777
|
+
return {};
|
|
1778
|
+
if (h instanceof Headers)
|
|
1779
|
+
return Object.fromEntries(h.entries());
|
|
1780
|
+
if (Symbol.iterator in h) {
|
|
1781
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1782
|
+
}
|
|
1783
|
+
const headers = {};
|
|
1784
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1785
|
+
if (value !== undefined)
|
|
1786
|
+
headers[name] = value;
|
|
1787
|
+
}
|
|
1788
|
+
return headers;
|
|
1789
|
+
};
|
|
1790
|
+
const res = await (fetchFn ?? fetch)(getCreateSecurityGroupRuleUrl(securityGroupId), {
|
|
1791
|
+
...options,
|
|
1792
|
+
method: "POST",
|
|
1793
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1794
|
+
body: JSON.stringify(createSecurityGroupRuleRequestBody),
|
|
1795
|
+
});
|
|
1796
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1797
|
+
const data = body ? JSON.parse(body) : {};
|
|
1798
|
+
return { data, status: res.status, headers: res.headers };
|
|
1799
|
+
};
|
|
1800
|
+
export const getGetSecurityGroupRuleUrl = (securityGroupId, securityGroupRuleId) => {
|
|
1801
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}/rules/${encodeURIComponent(String(securityGroupRuleId))}`;
|
|
1802
|
+
};
|
|
1803
|
+
/**
|
|
1804
|
+
* @summary Get a security group rule
|
|
1805
|
+
*/
|
|
1806
|
+
export const getSecurityGroupRule = async (securityGroupId, securityGroupRuleId, options, fetchFn) => {
|
|
1807
|
+
const res = await (fetchFn ?? fetch)(getGetSecurityGroupRuleUrl(securityGroupId, securityGroupRuleId), {
|
|
1808
|
+
...options,
|
|
1809
|
+
method: "GET",
|
|
1810
|
+
});
|
|
1811
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1812
|
+
const data = body ? JSON.parse(body) : {};
|
|
1813
|
+
return { data, status: res.status, headers: res.headers };
|
|
1814
|
+
};
|
|
1815
|
+
export const getDeleteSecurityGroupRuleUrl = (securityGroupId, securityGroupRuleId) => {
|
|
1816
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}/rules/${encodeURIComponent(String(securityGroupRuleId))}`;
|
|
1817
|
+
};
|
|
1818
|
+
/**
|
|
1819
|
+
* @summary Delete a security group rule
|
|
1820
|
+
*/
|
|
1821
|
+
export const deleteSecurityGroupRule = async (securityGroupId, securityGroupRuleId, options, fetchFn) => {
|
|
1822
|
+
const res = await (fetchFn ?? fetch)(getDeleteSecurityGroupRuleUrl(securityGroupId, securityGroupRuleId), {
|
|
1823
|
+
...options,
|
|
1824
|
+
method: "DELETE",
|
|
1825
|
+
});
|
|
1826
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1827
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
1828
|
+
return { data, status: res.status, headers: res.headers };
|
|
1829
|
+
};
|
|
1830
|
+
export const getListSecurityGroupsUrl = (params) => {
|
|
1831
|
+
const normalizedParams = new URLSearchParams();
|
|
1832
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1833
|
+
if (value !== undefined) {
|
|
1834
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1838
|
+
return stringifiedParams.length > 0
|
|
1839
|
+
? `https://compute.leaflow.cloud/api/v2/security-groups?${stringifiedParams}`
|
|
1840
|
+
: `https://compute.leaflow.cloud/api/v2/security-groups`;
|
|
1841
|
+
};
|
|
1842
|
+
/**
|
|
1843
|
+
* @summary List security groups
|
|
1844
|
+
*/
|
|
1845
|
+
export const listSecurityGroups = async (params, options, fetchFn) => {
|
|
1846
|
+
const res = await (fetchFn ?? fetch)(getListSecurityGroupsUrl(params), {
|
|
1847
|
+
...options,
|
|
1848
|
+
method: "GET",
|
|
1849
|
+
});
|
|
1850
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1851
|
+
const data = body ? JSON.parse(body) : {};
|
|
1852
|
+
return { data, status: res.status, headers: res.headers };
|
|
1853
|
+
};
|
|
1854
|
+
export const getCreateSecurityGroupUrl = () => {
|
|
1855
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups`;
|
|
1856
|
+
};
|
|
1857
|
+
/**
|
|
1858
|
+
* A new security group admits all outbound traffic and denies inbound traffic, except ICMP fragmentation-needed (IPv4) and Packet Too Big (IPv6). Without those two, path MTU discovery fails, which shows as connections that establish and then stall on large packets. All of these are ordinary rules and can be deleted.
|
|
1859
|
+
* @summary Create a security group
|
|
1860
|
+
*/
|
|
1861
|
+
export const createSecurityGroup = async (createSecurityGroupRequestBody, options, fetchFn) => {
|
|
1862
|
+
const getHeaders = (h) => {
|
|
1863
|
+
if (!h)
|
|
1864
|
+
return {};
|
|
1865
|
+
if (h instanceof Headers)
|
|
1866
|
+
return Object.fromEntries(h.entries());
|
|
1867
|
+
if (Symbol.iterator in h) {
|
|
1868
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1869
|
+
}
|
|
1870
|
+
const headers = {};
|
|
1871
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1872
|
+
if (value !== undefined)
|
|
1873
|
+
headers[name] = value;
|
|
1874
|
+
}
|
|
1875
|
+
return headers;
|
|
1876
|
+
};
|
|
1877
|
+
const res = await (fetchFn ?? fetch)(getCreateSecurityGroupUrl(), {
|
|
1878
|
+
...options,
|
|
1879
|
+
method: "POST",
|
|
1880
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1881
|
+
body: JSON.stringify(createSecurityGroupRequestBody),
|
|
1882
|
+
});
|
|
1883
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1884
|
+
const data = body ? JSON.parse(body) : {};
|
|
1885
|
+
return { data, status: res.status, headers: res.headers };
|
|
1886
|
+
};
|
|
1887
|
+
export const getGetSecurityGroupUrl = (securityGroupId) => {
|
|
1888
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}`;
|
|
1889
|
+
};
|
|
1890
|
+
/**
|
|
1891
|
+
* @summary Get a security group
|
|
1892
|
+
*/
|
|
1893
|
+
export const getSecurityGroup = async (securityGroupId, options, fetchFn) => {
|
|
1894
|
+
const res = await (fetchFn ?? fetch)(getGetSecurityGroupUrl(securityGroupId), {
|
|
1895
|
+
...options,
|
|
1896
|
+
method: "GET",
|
|
1897
|
+
});
|
|
1898
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1899
|
+
const data = body ? JSON.parse(body) : {};
|
|
1900
|
+
return { data, status: res.status, headers: res.headers };
|
|
1901
|
+
};
|
|
1902
|
+
export const getUpdateSecurityGroupUrl = (securityGroupId) => {
|
|
1903
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}`;
|
|
1904
|
+
};
|
|
1905
|
+
/**
|
|
1906
|
+
* Changes the name or description. Rules are resources of their own, created and deleted under `/security-group-rules`.
|
|
1907
|
+
* @summary Update a security group
|
|
1908
|
+
*/
|
|
1909
|
+
export const updateSecurityGroup = async (securityGroupId, updateSecurityGroupRequestBody, options, fetchFn) => {
|
|
1910
|
+
const getHeaders = (h) => {
|
|
1911
|
+
if (!h)
|
|
1912
|
+
return {};
|
|
1913
|
+
if (h instanceof Headers)
|
|
1914
|
+
return Object.fromEntries(h.entries());
|
|
1915
|
+
if (Symbol.iterator in h) {
|
|
1916
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1917
|
+
}
|
|
1918
|
+
const headers = {};
|
|
1919
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1920
|
+
if (value !== undefined)
|
|
1921
|
+
headers[name] = value;
|
|
1922
|
+
}
|
|
1923
|
+
return headers;
|
|
1924
|
+
};
|
|
1925
|
+
const res = await (fetchFn ?? fetch)(getUpdateSecurityGroupUrl(securityGroupId), {
|
|
1926
|
+
...options,
|
|
1927
|
+
method: "PATCH",
|
|
1928
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
1929
|
+
body: JSON.stringify(updateSecurityGroupRequestBody),
|
|
1930
|
+
});
|
|
1931
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1932
|
+
const data = body ? JSON.parse(body) : {};
|
|
1933
|
+
return { data, status: res.status, headers: res.headers };
|
|
1934
|
+
};
|
|
1935
|
+
export const getDeleteSecurityGroupUrl = (securityGroupId) => {
|
|
1936
|
+
return `https://compute.leaflow.cloud/api/v2/security-groups/${encodeURIComponent(String(securityGroupId))}`;
|
|
1937
|
+
};
|
|
1938
|
+
/**
|
|
1939
|
+
* Refused while a network interface uses the group. The default security group cannot be deleted; it goes with its virtual private cloud.
|
|
1940
|
+
* @summary Delete a security group
|
|
1941
|
+
*/
|
|
1942
|
+
export const deleteSecurityGroup = async (securityGroupId, options, fetchFn) => {
|
|
1943
|
+
const res = await (fetchFn ?? fetch)(getDeleteSecurityGroupUrl(securityGroupId), {
|
|
1944
|
+
...options,
|
|
1945
|
+
method: "DELETE",
|
|
1946
|
+
});
|
|
1947
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1948
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
1949
|
+
return { data, status: res.status, headers: res.headers };
|
|
1950
|
+
};
|
|
1951
|
+
export const getListVirtualPrivateCloudPeeringsUrl = (params) => {
|
|
1952
|
+
const normalizedParams = new URLSearchParams();
|
|
1953
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1954
|
+
if (value !== undefined) {
|
|
1955
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1959
|
+
return stringifiedParams.length > 0
|
|
1960
|
+
? `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings?${stringifiedParams}`
|
|
1961
|
+
: `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings`;
|
|
1962
|
+
};
|
|
1963
|
+
/**
|
|
1964
|
+
* @summary List peerings
|
|
1965
|
+
*/
|
|
1966
|
+
export const listVirtualPrivateCloudPeerings = async (params, options, fetchFn) => {
|
|
1967
|
+
const res = await (fetchFn ?? fetch)(getListVirtualPrivateCloudPeeringsUrl(params), {
|
|
1968
|
+
...options,
|
|
1969
|
+
method: "GET",
|
|
1970
|
+
});
|
|
1971
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
1972
|
+
const data = body ? JSON.parse(body) : {};
|
|
1973
|
+
return {
|
|
1974
|
+
data,
|
|
1975
|
+
status: res.status,
|
|
1976
|
+
headers: res.headers,
|
|
1977
|
+
};
|
|
1978
|
+
};
|
|
1979
|
+
export const getCreateVirtualPrivateCloudPeeringUrl = () => {
|
|
1980
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings`;
|
|
1981
|
+
};
|
|
1982
|
+
/**
|
|
1983
|
+
* Request IPv4 peering between non-overlapping VPCs in the same Region. The target project must accept before any connectivity is created. Does not change security groups or provide transitive routing.
|
|
1984
|
+
* @summary Create peering
|
|
1985
|
+
*/
|
|
1986
|
+
export const createVirtualPrivateCloudPeering = async (createVirtualPrivateCloudPeeringRequestBody, options, fetchFn) => {
|
|
1987
|
+
const getHeaders = (h) => {
|
|
1988
|
+
if (!h)
|
|
1989
|
+
return {};
|
|
1990
|
+
if (h instanceof Headers)
|
|
1991
|
+
return Object.fromEntries(h.entries());
|
|
1992
|
+
if (Symbol.iterator in h) {
|
|
1993
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1994
|
+
}
|
|
1995
|
+
const headers = {};
|
|
1996
|
+
for (const [name, value] of Object.entries(h)) {
|
|
1997
|
+
if (value !== undefined)
|
|
1998
|
+
headers[name] = value;
|
|
1999
|
+
}
|
|
2000
|
+
return headers;
|
|
2001
|
+
};
|
|
2002
|
+
const res = await (fetchFn ?? fetch)(getCreateVirtualPrivateCloudPeeringUrl(), {
|
|
2003
|
+
...options,
|
|
2004
|
+
method: "POST",
|
|
2005
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2006
|
+
body: JSON.stringify(createVirtualPrivateCloudPeeringRequestBody),
|
|
2007
|
+
});
|
|
2008
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2009
|
+
const data = body ? JSON.parse(body) : {};
|
|
2010
|
+
return {
|
|
2011
|
+
data,
|
|
2012
|
+
status: res.status,
|
|
2013
|
+
headers: res.headers,
|
|
2014
|
+
};
|
|
2015
|
+
};
|
|
2016
|
+
export const getGetVirtualPrivateCloudPeeringUrl = (virtualPrivateCloudPeeringId) => {
|
|
2017
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings/${encodeURIComponent(String(virtualPrivateCloudPeeringId))}`;
|
|
2018
|
+
};
|
|
2019
|
+
/**
|
|
2020
|
+
* @summary Get peering
|
|
2021
|
+
*/
|
|
2022
|
+
export const getVirtualPrivateCloudPeering = async (virtualPrivateCloudPeeringId, options, fetchFn) => {
|
|
2023
|
+
const res = await (fetchFn ?? fetch)(getGetVirtualPrivateCloudPeeringUrl(virtualPrivateCloudPeeringId), {
|
|
2024
|
+
...options,
|
|
2025
|
+
method: "GET",
|
|
2026
|
+
});
|
|
2027
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2028
|
+
const data = body ? JSON.parse(body) : {};
|
|
2029
|
+
return {
|
|
2030
|
+
data,
|
|
2031
|
+
status: res.status,
|
|
2032
|
+
headers: res.headers,
|
|
2033
|
+
};
|
|
2034
|
+
};
|
|
2035
|
+
export const getDeleteVirtualPrivateCloudPeeringUrl = (virtualPrivateCloudPeeringId) => {
|
|
2036
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings/${encodeURIComponent(String(virtualPrivateCloudPeeringId))}`;
|
|
2037
|
+
};
|
|
2038
|
+
/**
|
|
2039
|
+
* @summary Delete peering
|
|
2040
|
+
*/
|
|
2041
|
+
export const deleteVirtualPrivateCloudPeering = async (virtualPrivateCloudPeeringId, options, fetchFn) => {
|
|
2042
|
+
const res = await (fetchFn ?? fetch)(getDeleteVirtualPrivateCloudPeeringUrl(virtualPrivateCloudPeeringId), {
|
|
2043
|
+
...options,
|
|
2044
|
+
method: "DELETE",
|
|
2045
|
+
});
|
|
2046
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2047
|
+
const data = body ? JSON.parse(body) : {};
|
|
2048
|
+
return {
|
|
2049
|
+
data,
|
|
2050
|
+
status: res.status,
|
|
2051
|
+
headers: res.headers,
|
|
2052
|
+
};
|
|
2053
|
+
};
|
|
2054
|
+
export const getAcceptVirtualPrivateCloudPeeringUrl = (virtualPrivateCloudPeeringId) => {
|
|
2055
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings/${encodeURIComponent(String(virtualPrivateCloudPeeringId))}:accept`;
|
|
2056
|
+
};
|
|
2057
|
+
/**
|
|
2058
|
+
* Starts the provisioning of the connectivity; the peering shows the `provision` operation until it is `active`. It does not change security groups or provide transitive routing. Only the accepter project may decide; the requester project is refused, because a peering would otherwise be accepted by the party who asked for it. The decision is made once: a peering whose `acceptance` is no longer `pending` refuses both methods.
|
|
2059
|
+
* @summary Accept a peering
|
|
2060
|
+
*/
|
|
2061
|
+
export const acceptVirtualPrivateCloudPeering = async (virtualPrivateCloudPeeringId, options, fetchFn) => {
|
|
2062
|
+
const res = await (fetchFn ?? fetch)(getAcceptVirtualPrivateCloudPeeringUrl(virtualPrivateCloudPeeringId), {
|
|
2063
|
+
...options,
|
|
2064
|
+
method: "POST",
|
|
2065
|
+
});
|
|
2066
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2067
|
+
const data = body ? JSON.parse(body) : {};
|
|
2068
|
+
return {
|
|
2069
|
+
data,
|
|
2070
|
+
status: res.status,
|
|
2071
|
+
headers: res.headers,
|
|
2072
|
+
};
|
|
2073
|
+
};
|
|
2074
|
+
export const getRejectVirtualPrivateCloudPeeringUrl = (virtualPrivateCloudPeeringId) => {
|
|
2075
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-cloud-peerings/${encodeURIComponent(String(virtualPrivateCloudPeeringId))}:reject`;
|
|
2076
|
+
};
|
|
2077
|
+
/**
|
|
2078
|
+
* Ends the peering with its `acceptance` `rejected` and its `status` `deleted`; no connectivity is ever created. Only the accepter project may decide; the requester project is refused, because a peering would otherwise be accepted by the party who asked for it. The decision is made once: a peering whose `acceptance` is no longer `pending` refuses both methods.
|
|
2079
|
+
* @summary Reject a peering
|
|
2080
|
+
*/
|
|
2081
|
+
export const rejectVirtualPrivateCloudPeering = async (virtualPrivateCloudPeeringId, options, fetchFn) => {
|
|
2082
|
+
const res = await (fetchFn ?? fetch)(getRejectVirtualPrivateCloudPeeringUrl(virtualPrivateCloudPeeringId), {
|
|
2083
|
+
...options,
|
|
2084
|
+
method: "POST",
|
|
2085
|
+
});
|
|
2086
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2087
|
+
const data = body ? JSON.parse(body) : {};
|
|
2088
|
+
return {
|
|
2089
|
+
data,
|
|
2090
|
+
status: res.status,
|
|
2091
|
+
headers: res.headers,
|
|
2092
|
+
};
|
|
2093
|
+
};
|
|
2094
|
+
export const getListVirtualPrivateCloudRoutesUrl = (virtualPrivateCloudId, params) => {
|
|
2095
|
+
const normalizedParams = new URLSearchParams();
|
|
2096
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2097
|
+
if (value !== undefined) {
|
|
2098
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2102
|
+
return stringifiedParams.length > 0
|
|
2103
|
+
? `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/routes?${stringifiedParams}`
|
|
2104
|
+
: `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/routes`;
|
|
2105
|
+
};
|
|
2106
|
+
/**
|
|
2107
|
+
* Static routes of the virtual private cloud, or with `-` those of every virtual private cloud of the project, including the routes peerings write, which show `type` peering.
|
|
2108
|
+
* @summary List routes
|
|
2109
|
+
*/
|
|
2110
|
+
export const listVirtualPrivateCloudRoutes = async (virtualPrivateCloudId, params, options, fetchFn) => {
|
|
2111
|
+
const res = await (fetchFn ?? fetch)(getListVirtualPrivateCloudRoutesUrl(virtualPrivateCloudId, params), {
|
|
2112
|
+
...options,
|
|
2113
|
+
method: "GET",
|
|
2114
|
+
});
|
|
2115
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2116
|
+
const data = body ? JSON.parse(body) : {};
|
|
2117
|
+
return {
|
|
2118
|
+
data,
|
|
2119
|
+
status: res.status,
|
|
2120
|
+
headers: res.headers,
|
|
2121
|
+
};
|
|
2122
|
+
};
|
|
2123
|
+
export const getCreateVirtualPrivateCloudRouteUrl = (virtualPrivateCloudId) => {
|
|
2124
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/routes`;
|
|
2125
|
+
};
|
|
2126
|
+
/**
|
|
2127
|
+
* Three forms that would sever connectivity are refused: a destination of `0.0.0.0/0`, which overrides the default route and takes every elastic IP offline immediately; a destination equal to the CIDR of a subnet, which overrides its directly connected route; and a next hop equal to the gateway of a subnet, which points back at the router itself. A destination overlapping a peering's route is refused with `VIRTUAL_PRIVATE_CLOUD_ROUTE_OVERLAPS_PEERING`.
|
|
2128
|
+
* @summary Create a static route
|
|
2129
|
+
*/
|
|
2130
|
+
export const createVirtualPrivateCloudRoute = async (virtualPrivateCloudId, createVirtualPrivateCloudRouteRequestBody, options, fetchFn) => {
|
|
2131
|
+
const getHeaders = (h) => {
|
|
2132
|
+
if (!h)
|
|
2133
|
+
return {};
|
|
2134
|
+
if (h instanceof Headers)
|
|
2135
|
+
return Object.fromEntries(h.entries());
|
|
2136
|
+
if (Symbol.iterator in h) {
|
|
2137
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2138
|
+
}
|
|
2139
|
+
const headers = {};
|
|
2140
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2141
|
+
if (value !== undefined)
|
|
2142
|
+
headers[name] = value;
|
|
2143
|
+
}
|
|
2144
|
+
return headers;
|
|
2145
|
+
};
|
|
2146
|
+
const res = await (fetchFn ?? fetch)(getCreateVirtualPrivateCloudRouteUrl(virtualPrivateCloudId), {
|
|
2147
|
+
...options,
|
|
2148
|
+
method: "POST",
|
|
2149
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2150
|
+
body: JSON.stringify(createVirtualPrivateCloudRouteRequestBody),
|
|
2151
|
+
});
|
|
2152
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2153
|
+
const data = body ? JSON.parse(body) : {};
|
|
2154
|
+
return {
|
|
2155
|
+
data,
|
|
2156
|
+
status: res.status,
|
|
2157
|
+
headers: res.headers,
|
|
2158
|
+
};
|
|
2159
|
+
};
|
|
2160
|
+
export const getGetVirtualPrivateCloudRouteUrl = (virtualPrivateCloudId, virtualPrivateCloudRouteId) => {
|
|
2161
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/routes/${encodeURIComponent(String(virtualPrivateCloudRouteId))}`;
|
|
2162
|
+
};
|
|
2163
|
+
/**
|
|
2164
|
+
* @summary Get a route
|
|
2165
|
+
*/
|
|
2166
|
+
export const getVirtualPrivateCloudRoute = async (virtualPrivateCloudId, virtualPrivateCloudRouteId, options, fetchFn) => {
|
|
2167
|
+
const res = await (fetchFn ?? fetch)(getGetVirtualPrivateCloudRouteUrl(virtualPrivateCloudId, virtualPrivateCloudRouteId), {
|
|
2168
|
+
...options,
|
|
2169
|
+
method: "GET",
|
|
2170
|
+
});
|
|
2171
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2172
|
+
const data = body ? JSON.parse(body) : {};
|
|
2173
|
+
return { data, status: res.status, headers: res.headers };
|
|
2174
|
+
};
|
|
2175
|
+
export const getDeleteVirtualPrivateCloudRouteUrl = (virtualPrivateCloudId, virtualPrivateCloudRouteId) => {
|
|
2176
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/routes/${encodeURIComponent(String(virtualPrivateCloudRouteId))}`;
|
|
2177
|
+
};
|
|
2178
|
+
/**
|
|
2179
|
+
* A route has no update; replace it by creating the new route and deleting the old one. A peering's route is refused with `VIRTUAL_PRIVATE_CLOUD_ROUTE_HELD_BY_PEERING` and goes away with its peering.
|
|
2180
|
+
* @summary Delete a static route
|
|
2181
|
+
*/
|
|
2182
|
+
export const deleteVirtualPrivateCloudRoute = async (virtualPrivateCloudId, virtualPrivateCloudRouteId, options, fetchFn) => {
|
|
2183
|
+
const res = await (fetchFn ?? fetch)(getDeleteVirtualPrivateCloudRouteUrl(virtualPrivateCloudId, virtualPrivateCloudRouteId), {
|
|
2184
|
+
...options,
|
|
2185
|
+
method: "DELETE",
|
|
2186
|
+
});
|
|
2187
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2188
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
2189
|
+
return {
|
|
2190
|
+
data,
|
|
2191
|
+
status: res.status,
|
|
2192
|
+
headers: res.headers,
|
|
2193
|
+
};
|
|
2194
|
+
};
|
|
2195
|
+
export const getListVirtualPrivateCloudSubnetsUrl = (virtualPrivateCloudId, params) => {
|
|
2196
|
+
const normalizedParams = new URLSearchParams();
|
|
2197
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2198
|
+
if (value !== undefined) {
|
|
2199
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2203
|
+
return stringifiedParams.length > 0
|
|
2204
|
+
? `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets?${stringifiedParams}`
|
|
2205
|
+
: `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets`;
|
|
2206
|
+
};
|
|
2207
|
+
/**
|
|
2208
|
+
* The subnets of the virtual private cloud, or with `-` those of every virtual private cloud of the project. A subnet is dual-stack once IPv6 is enabled on its virtual private cloud, which gives every subnet a /64 of the cloud's /56.
|
|
2209
|
+
* @summary List subnets
|
|
2210
|
+
*/
|
|
2211
|
+
export const listVirtualPrivateCloudSubnets = async (virtualPrivateCloudId, params, options, fetchFn) => {
|
|
2212
|
+
const res = await (fetchFn ?? fetch)(getListVirtualPrivateCloudSubnetsUrl(virtualPrivateCloudId, params), {
|
|
2213
|
+
...options,
|
|
2214
|
+
method: "GET",
|
|
2215
|
+
});
|
|
2216
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2217
|
+
const data = body ? JSON.parse(body) : {};
|
|
2218
|
+
return {
|
|
2219
|
+
data,
|
|
2220
|
+
status: res.status,
|
|
2221
|
+
headers: res.headers,
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2224
|
+
export const getCreateVirtualPrivateCloudSubnetUrl = (virtualPrivateCloudId) => {
|
|
2225
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets`;
|
|
2226
|
+
};
|
|
2227
|
+
/**
|
|
2228
|
+
* The IPv4 CIDR must fall inside the virtual private cloud's CIDR and must not overlap another subnet of it; to find a free one, read the virtual private cloud's `free-subnet-cidr`. In a virtual private cloud with IPv6 enabled the subnet also takes the lowest free /64 of the cloud's /56, refused with 409 `VIRTUAL_PRIVATE_CLOUD_SUBNET_IPV6_CIDR_EXHAUSTED` when none is left.
|
|
2229
|
+
* @summary Create a subnet
|
|
2230
|
+
*/
|
|
2231
|
+
export const createVirtualPrivateCloudSubnet = async (virtualPrivateCloudId, createVirtualPrivateCloudSubnetRequestBody, options, fetchFn) => {
|
|
2232
|
+
const getHeaders = (h) => {
|
|
2233
|
+
if (!h)
|
|
2234
|
+
return {};
|
|
2235
|
+
if (h instanceof Headers)
|
|
2236
|
+
return Object.fromEntries(h.entries());
|
|
2237
|
+
if (Symbol.iterator in h) {
|
|
2238
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2239
|
+
}
|
|
2240
|
+
const headers = {};
|
|
2241
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2242
|
+
if (value !== undefined)
|
|
2243
|
+
headers[name] = value;
|
|
2244
|
+
}
|
|
2245
|
+
return headers;
|
|
2246
|
+
};
|
|
2247
|
+
const res = await (fetchFn ?? fetch)(getCreateVirtualPrivateCloudSubnetUrl(virtualPrivateCloudId), {
|
|
2248
|
+
...options,
|
|
2249
|
+
method: "POST",
|
|
2250
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2251
|
+
body: JSON.stringify(createVirtualPrivateCloudSubnetRequestBody),
|
|
2252
|
+
});
|
|
2253
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2254
|
+
const data = body ? JSON.parse(body) : {};
|
|
2255
|
+
return {
|
|
2256
|
+
data,
|
|
2257
|
+
status: res.status,
|
|
2258
|
+
headers: res.headers,
|
|
2259
|
+
};
|
|
2260
|
+
};
|
|
2261
|
+
export const getGetVirtualPrivateCloudSubnetUrl = (virtualPrivateCloudId, subnetId) => {
|
|
2262
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets/${encodeURIComponent(String(subnetId))}`;
|
|
2263
|
+
};
|
|
2264
|
+
/**
|
|
2265
|
+
* @summary Get a subnet
|
|
2266
|
+
*/
|
|
2267
|
+
export const getVirtualPrivateCloudSubnet = async (virtualPrivateCloudId, subnetId, options, fetchFn) => {
|
|
2268
|
+
const res = await (fetchFn ?? fetch)(getGetVirtualPrivateCloudSubnetUrl(virtualPrivateCloudId, subnetId), {
|
|
2269
|
+
...options,
|
|
2270
|
+
method: "GET",
|
|
2271
|
+
});
|
|
2272
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2273
|
+
const data = body ? JSON.parse(body) : {};
|
|
2274
|
+
return { data, status: res.status, headers: res.headers };
|
|
2275
|
+
};
|
|
2276
|
+
export const getUpdateVirtualPrivateCloudSubnetUrl = (virtualPrivateCloudId, subnetId) => {
|
|
2277
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets/${encodeURIComponent(String(subnetId))}`;
|
|
2278
|
+
};
|
|
2279
|
+
/**
|
|
2280
|
+
* Only the name can change. The CIDR is fixed for the subnet's life, because addresses already handed out inside it would fall outside a changed range.
|
|
2281
|
+
* @summary Update a subnet
|
|
2282
|
+
*/
|
|
2283
|
+
export const updateVirtualPrivateCloudSubnet = async (virtualPrivateCloudId, subnetId, updateVirtualPrivateCloudSubnetRequestBody, options, fetchFn) => {
|
|
2284
|
+
const getHeaders = (h) => {
|
|
2285
|
+
if (!h)
|
|
2286
|
+
return {};
|
|
2287
|
+
if (h instanceof Headers)
|
|
2288
|
+
return Object.fromEntries(h.entries());
|
|
2289
|
+
if (Symbol.iterator in h) {
|
|
2290
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2291
|
+
}
|
|
2292
|
+
const headers = {};
|
|
2293
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2294
|
+
if (value !== undefined)
|
|
2295
|
+
headers[name] = value;
|
|
2296
|
+
}
|
|
2297
|
+
return headers;
|
|
2298
|
+
};
|
|
2299
|
+
const res = await (fetchFn ?? fetch)(getUpdateVirtualPrivateCloudSubnetUrl(virtualPrivateCloudId, subnetId), {
|
|
2300
|
+
...options,
|
|
2301
|
+
method: "PATCH",
|
|
2302
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2303
|
+
body: JSON.stringify(updateVirtualPrivateCloudSubnetRequestBody),
|
|
2304
|
+
});
|
|
2305
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2306
|
+
const data = body ? JSON.parse(body) : {};
|
|
2307
|
+
return {
|
|
2308
|
+
data,
|
|
2309
|
+
status: res.status,
|
|
2310
|
+
headers: res.headers,
|
|
2311
|
+
};
|
|
2312
|
+
};
|
|
2313
|
+
export const getDeleteVirtualPrivateCloudSubnetUrl = (virtualPrivateCloudId, subnetId) => {
|
|
2314
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/subnets/${encodeURIComponent(String(subnetId))}`;
|
|
2315
|
+
};
|
|
2316
|
+
/**
|
|
2317
|
+
* Refused while network interfaces remain in the subnet, or while a static route has a next hop inside its CIDR. Its /64 goes back to the virtual private cloud's /56.
|
|
2318
|
+
* @summary Delete a subnet
|
|
2319
|
+
*/
|
|
2320
|
+
export const deleteVirtualPrivateCloudSubnet = async (virtualPrivateCloudId, subnetId, options, fetchFn) => {
|
|
2321
|
+
const res = await (fetchFn ?? fetch)(getDeleteVirtualPrivateCloudSubnetUrl(virtualPrivateCloudId, subnetId), {
|
|
2322
|
+
...options,
|
|
2323
|
+
method: "DELETE",
|
|
2324
|
+
});
|
|
2325
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2326
|
+
const data = body ? JSON.parse(body) : undefined;
|
|
2327
|
+
return {
|
|
2328
|
+
data,
|
|
2329
|
+
status: res.status,
|
|
2330
|
+
headers: res.headers,
|
|
2331
|
+
};
|
|
2332
|
+
};
|
|
2333
|
+
export const getListVirtualPrivateCloudsUrl = (params) => {
|
|
2334
|
+
const normalizedParams = new URLSearchParams();
|
|
2335
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2336
|
+
if (value !== undefined) {
|
|
2337
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2338
|
+
}
|
|
2339
|
+
});
|
|
2340
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2341
|
+
return stringifiedParams.length > 0
|
|
2342
|
+
? `https://compute.leaflow.cloud/api/v2/virtual-private-clouds?${stringifiedParams}`
|
|
2343
|
+
: `https://compute.leaflow.cloud/api/v2/virtual-private-clouds`;
|
|
2344
|
+
};
|
|
2345
|
+
/**
|
|
2346
|
+
* @summary List virtual private clouds
|
|
2347
|
+
*/
|
|
2348
|
+
export const listVirtualPrivateClouds = async (params, options, fetchFn) => {
|
|
2349
|
+
const res = await (fetchFn ?? fetch)(getListVirtualPrivateCloudsUrl(params), {
|
|
2350
|
+
...options,
|
|
2351
|
+
method: "GET",
|
|
2352
|
+
});
|
|
2353
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2354
|
+
const data = body ? JSON.parse(body) : {};
|
|
2355
|
+
return { data, status: res.status, headers: res.headers };
|
|
2356
|
+
};
|
|
2357
|
+
export const getCreateVirtualPrivateCloudUrl = () => {
|
|
2358
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds`;
|
|
2359
|
+
};
|
|
2360
|
+
/**
|
|
2361
|
+
* Creates a virtual private cloud definition and its default security group. The default security group denies all inbound traffic and permits all outbound traffic.
|
|
2362
|
+
* @summary Create a virtual private cloud
|
|
2363
|
+
*/
|
|
2364
|
+
export const createVirtualPrivateCloud = async (createVirtualPrivateCloudRequestBody, options, fetchFn) => {
|
|
2365
|
+
const getHeaders = (h) => {
|
|
2366
|
+
if (!h)
|
|
2367
|
+
return {};
|
|
2368
|
+
if (h instanceof Headers)
|
|
2369
|
+
return Object.fromEntries(h.entries());
|
|
2370
|
+
if (Symbol.iterator in h) {
|
|
2371
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2372
|
+
}
|
|
2373
|
+
const headers = {};
|
|
2374
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2375
|
+
if (value !== undefined)
|
|
2376
|
+
headers[name] = value;
|
|
2377
|
+
}
|
|
2378
|
+
return headers;
|
|
2379
|
+
};
|
|
2380
|
+
const res = await (fetchFn ?? fetch)(getCreateVirtualPrivateCloudUrl(), {
|
|
2381
|
+
...options,
|
|
2382
|
+
method: "POST",
|
|
2383
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2384
|
+
body: JSON.stringify(createVirtualPrivateCloudRequestBody),
|
|
2385
|
+
});
|
|
2386
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2387
|
+
const data = body ? JSON.parse(body) : {};
|
|
2388
|
+
return { data, status: res.status, headers: res.headers };
|
|
2389
|
+
};
|
|
2390
|
+
export const getGetVirtualPrivateCloudUrl = (virtualPrivateCloudId) => {
|
|
2391
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}`;
|
|
2392
|
+
};
|
|
2393
|
+
/**
|
|
2394
|
+
* @summary Retrieve a virtual private cloud
|
|
2395
|
+
*/
|
|
2396
|
+
export const getVirtualPrivateCloud = async (virtualPrivateCloudId, options, fetchFn) => {
|
|
2397
|
+
const res = await (fetchFn ?? fetch)(getGetVirtualPrivateCloudUrl(virtualPrivateCloudId), {
|
|
2398
|
+
...options,
|
|
2399
|
+
method: "GET",
|
|
2400
|
+
});
|
|
2401
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2402
|
+
const data = body ? JSON.parse(body) : {};
|
|
2403
|
+
return { data, status: res.status, headers: res.headers };
|
|
2404
|
+
};
|
|
2405
|
+
export const getUpdateVirtualPrivateCloudUrl = (virtualPrivateCloudId) => {
|
|
2406
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}`;
|
|
2407
|
+
};
|
|
2408
|
+
/**
|
|
2409
|
+
* Only the name can change. The CIDR is fixed for the network's life, because every subnet and address inside it was allocated from it.
|
|
2410
|
+
* @summary Update a virtual private cloud
|
|
2411
|
+
*/
|
|
2412
|
+
export const updateVirtualPrivateCloud = async (virtualPrivateCloudId, updateVirtualPrivateCloudRequestBody, options, fetchFn) => {
|
|
2413
|
+
const getHeaders = (h) => {
|
|
2414
|
+
if (!h)
|
|
2415
|
+
return {};
|
|
2416
|
+
if (h instanceof Headers)
|
|
2417
|
+
return Object.fromEntries(h.entries());
|
|
2418
|
+
if (Symbol.iterator in h) {
|
|
2419
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2420
|
+
}
|
|
2421
|
+
const headers = {};
|
|
2422
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2423
|
+
if (value !== undefined)
|
|
2424
|
+
headers[name] = value;
|
|
2425
|
+
}
|
|
2426
|
+
return headers;
|
|
2427
|
+
};
|
|
2428
|
+
const res = await (fetchFn ?? fetch)(getUpdateVirtualPrivateCloudUrl(virtualPrivateCloudId), {
|
|
2429
|
+
...options,
|
|
2430
|
+
method: "PATCH",
|
|
2431
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2432
|
+
body: JSON.stringify(updateVirtualPrivateCloudRequestBody),
|
|
2433
|
+
});
|
|
2434
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2435
|
+
const data = body ? JSON.parse(body) : {};
|
|
2436
|
+
return { data, status: res.status, headers: res.headers };
|
|
2437
|
+
};
|
|
2438
|
+
export const getDeleteVirtualPrivateCloudUrl = (virtualPrivateCloudId) => {
|
|
2439
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}`;
|
|
2440
|
+
};
|
|
2441
|
+
/**
|
|
2442
|
+
* Deletion is rejected while instances or network interfaces remain in the network. Its subnets, routes, security groups and IPv6 configuration are removed with it.
|
|
2443
|
+
* @summary Release a virtual private cloud
|
|
2444
|
+
*/
|
|
2445
|
+
export const deleteVirtualPrivateCloud = async (virtualPrivateCloudId, options, fetchFn) => {
|
|
2446
|
+
const res = await (fetchFn ?? fetch)(getDeleteVirtualPrivateCloudUrl(virtualPrivateCloudId), {
|
|
2447
|
+
...options,
|
|
2448
|
+
method: "DELETE",
|
|
2449
|
+
});
|
|
2450
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2451
|
+
const data = body ? JSON.parse(body) : {};
|
|
2452
|
+
return { data, status: res.status, headers: res.headers };
|
|
2453
|
+
};
|
|
2454
|
+
export const getEnableVirtualPrivateCloudIpv6Url = (virtualPrivateCloudId) => {
|
|
2455
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}:enableIpv6`;
|
|
2456
|
+
};
|
|
2457
|
+
/**
|
|
2458
|
+
* Gives the virtual private cloud a /56 that is routed to it, and every subnet of it a /64 of that /56; a subnet created afterwards takes its /64 at creation. It requires no elastic IP or NAT gateway: IPv6 is routed, not translated. A network interface created afterwards receives an address of its subnet's /64; addresses cannot be requested or released individually, and security groups apply to them as to IPv4. An interface created before IPv6 was enabled keeps only its IPv4 address.
|
|
2459
|
+
*
|
|
2460
|
+
* Enabling IPv6 that is already enabled answers with the virtual private cloud as it is.
|
|
2461
|
+
* @summary Enable IPv6 on a virtual private cloud
|
|
2462
|
+
*/
|
|
2463
|
+
export const enableVirtualPrivateCloudIpv6 = async (virtualPrivateCloudId, options, fetchFn) => {
|
|
2464
|
+
const res = await (fetchFn ?? fetch)(getEnableVirtualPrivateCloudIpv6Url(virtualPrivateCloudId), {
|
|
2465
|
+
...options,
|
|
2466
|
+
method: "POST",
|
|
2467
|
+
});
|
|
2468
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2469
|
+
const data = body ? JSON.parse(body) : {};
|
|
2470
|
+
return {
|
|
2471
|
+
data,
|
|
2472
|
+
status: res.status,
|
|
2473
|
+
headers: res.headers,
|
|
2474
|
+
};
|
|
2475
|
+
};
|
|
2476
|
+
export const getDisableVirtualPrivateCloudIpv6Url = (virtualPrivateCloudId) => {
|
|
2477
|
+
return `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}:disableIpv6`;
|
|
2478
|
+
};
|
|
2479
|
+
/**
|
|
2480
|
+
* Removes the IPv6 of every subnet and gives the /56 back. Refused while a network interface remains in the virtual private cloud, since its IPv6 address would stop working with nothing reporting it.
|
|
2481
|
+
* @summary Disable IPv6 on a virtual private cloud
|
|
2482
|
+
*/
|
|
2483
|
+
export const disableVirtualPrivateCloudIpv6 = async (virtualPrivateCloudId, options, fetchFn) => {
|
|
2484
|
+
const res = await (fetchFn ?? fetch)(getDisableVirtualPrivateCloudIpv6Url(virtualPrivateCloudId), {
|
|
2485
|
+
...options,
|
|
2486
|
+
method: "POST",
|
|
2487
|
+
});
|
|
2488
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2489
|
+
const data = body ? JSON.parse(body) : {};
|
|
2490
|
+
return {
|
|
2491
|
+
data,
|
|
2492
|
+
status: res.status,
|
|
2493
|
+
headers: res.headers,
|
|
2494
|
+
};
|
|
2495
|
+
};
|
|
2496
|
+
export const getGetVirtualPrivateCloudFreeSubnetCidrUrl = (virtualPrivateCloudId, params) => {
|
|
2497
|
+
const normalizedParams = new URLSearchParams();
|
|
2498
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2499
|
+
if (value !== undefined) {
|
|
2500
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2504
|
+
return stringifiedParams.length > 0
|
|
2505
|
+
? `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/free-subnet-cidr?${stringifiedParams}`
|
|
2506
|
+
: `https://compute.leaflow.cloud/api/v2/virtual-private-clouds/${encodeURIComponent(String(virtualPrivateCloudId))}/free-subnet-cidr`;
|
|
2507
|
+
};
|
|
2508
|
+
/**
|
|
2509
|
+
* The first CIDR of the given prefix length inside the virtual private cloud that no subnet overlaps. It is not reserved; creating the subnet checks it again.
|
|
2510
|
+
* @summary Get a free subnet CIDR
|
|
2511
|
+
*/
|
|
2512
|
+
export const getVirtualPrivateCloudFreeSubnetCidr = async (virtualPrivateCloudId, params, options, fetchFn) => {
|
|
2513
|
+
const res = await (fetchFn ?? fetch)(getGetVirtualPrivateCloudFreeSubnetCidrUrl(virtualPrivateCloudId, params), {
|
|
2514
|
+
...options,
|
|
2515
|
+
method: "GET",
|
|
2516
|
+
});
|
|
2517
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2518
|
+
const data = body ? JSON.parse(body) : {};
|
|
2519
|
+
return {
|
|
2520
|
+
data,
|
|
2521
|
+
status: res.status,
|
|
2522
|
+
headers: res.headers,
|
|
2523
|
+
};
|
|
2524
|
+
};
|
|
2525
|
+
export const getListVolumeBackupsUrl = (params) => {
|
|
2526
|
+
const normalizedParams = new URLSearchParams();
|
|
2527
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2528
|
+
if (value !== undefined) {
|
|
2529
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2533
|
+
return stringifiedParams.length > 0
|
|
2534
|
+
? `https://compute.leaflow.cloud/api/v2/volume-backups?${stringifiedParams}`
|
|
2535
|
+
: `https://compute.leaflow.cloud/api/v2/volume-backups`;
|
|
2536
|
+
};
|
|
2537
|
+
/**
|
|
2538
|
+
* @summary List volume backups
|
|
2539
|
+
*/
|
|
2540
|
+
export const listVolumeBackups = async (params, options, fetchFn) => {
|
|
2541
|
+
const res = await (fetchFn ?? fetch)(getListVolumeBackupsUrl(params), {
|
|
2542
|
+
...options,
|
|
2543
|
+
method: "GET",
|
|
2544
|
+
});
|
|
2545
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2546
|
+
const data = body ? JSON.parse(body) : {};
|
|
2547
|
+
return { data, status: res.status, headers: res.headers };
|
|
2548
|
+
};
|
|
2549
|
+
export const getCreateVolumeBackupUrl = () => {
|
|
2550
|
+
return `https://compute.leaflow.cloud/api/v2/volume-backups`;
|
|
2551
|
+
};
|
|
2552
|
+
/**
|
|
2553
|
+
* Creates a backup of the volume. It remains restorable after the source volume is deleted and may be restored to another availability zone in the same region, by creating a volume with `volume_backup_id` (`create-volume`). A running instance may produce a file-system-inconsistent backup. Pending backups count toward Compute project quotas until cleanup is confirmed.
|
|
2554
|
+
*
|
|
2555
|
+
* It is metered by the hour on a subscription of its own and takes no billing choice. It is bought through a Billing Checkout Session: automatic checkout completes at once for metered pricing and the backup is taken as soon as the order is accepted; with deferred checkout it stays `pending` until the customer completes checkout in Billing. The source and project quotas are checked before the Checkout Session is created, and a refused request creates nothing.
|
|
2556
|
+
*
|
|
2557
|
+
* The backup shows the `create` operation from the moment its Checkout Session is created until it is delivered or its checkout or order ends. Every other operation on it is refused with `COMPUTE_RESOURCE_BUSY` meanwhile, and its deletion with `COMPUTE_PURCHASE_PENDING` while its purchase awaits checkout or payment.
|
|
2558
|
+
* @summary Create a volume backup
|
|
2559
|
+
*/
|
|
2560
|
+
export const createVolumeBackup = async (createVolumeBackupRequestBody, options, fetchFn) => {
|
|
2561
|
+
const getHeaders = (h) => {
|
|
2562
|
+
if (!h)
|
|
2563
|
+
return {};
|
|
2564
|
+
if (h instanceof Headers)
|
|
2565
|
+
return Object.fromEntries(h.entries());
|
|
2566
|
+
if (Symbol.iterator in h) {
|
|
2567
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2568
|
+
}
|
|
2569
|
+
const headers = {};
|
|
2570
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2571
|
+
if (value !== undefined)
|
|
2572
|
+
headers[name] = value;
|
|
2573
|
+
}
|
|
2574
|
+
return headers;
|
|
2575
|
+
};
|
|
2576
|
+
const res = await (fetchFn ?? fetch)(getCreateVolumeBackupUrl(), {
|
|
2577
|
+
...options,
|
|
2578
|
+
method: "POST",
|
|
2579
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2580
|
+
body: JSON.stringify(createVolumeBackupRequestBody),
|
|
2581
|
+
});
|
|
2582
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2583
|
+
const data = body ? JSON.parse(body) : {};
|
|
2584
|
+
return { data, status: res.status, headers: res.headers };
|
|
2585
|
+
};
|
|
2586
|
+
export const getGetVolumeBackupUrl = (volumeBackupId) => {
|
|
2587
|
+
return `https://compute.leaflow.cloud/api/v2/volume-backups/${encodeURIComponent(String(volumeBackupId))}`;
|
|
2588
|
+
};
|
|
2589
|
+
/**
|
|
2590
|
+
* Returns the stored state of the backup; it does not query the cloud. Use it to poll creation progress.
|
|
2591
|
+
* @summary Retrieve a volume backup
|
|
2592
|
+
*/
|
|
2593
|
+
export const getVolumeBackup = async (volumeBackupId, options, fetchFn) => {
|
|
2594
|
+
const res = await (fetchFn ?? fetch)(getGetVolumeBackupUrl(volumeBackupId), {
|
|
2595
|
+
...options,
|
|
2596
|
+
method: "GET",
|
|
2597
|
+
});
|
|
2598
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2599
|
+
const data = body ? JSON.parse(body) : {};
|
|
2600
|
+
return { data, status: res.status, headers: res.headers };
|
|
2601
|
+
};
|
|
2602
|
+
export const getUpdateVolumeBackupUrl = (volumeBackupId) => {
|
|
2603
|
+
return `https://compute.leaflow.cloud/api/v2/volume-backups/${encodeURIComponent(String(volumeBackupId))}`;
|
|
2604
|
+
};
|
|
2605
|
+
/**
|
|
2606
|
+
* Changes the name only. A backup's source volume and capacity cannot be changed.
|
|
2607
|
+
* @summary Update a volume backup
|
|
2608
|
+
*/
|
|
2609
|
+
export const updateVolumeBackup = async (volumeBackupId, updateVolumeBackupRequestBody, options, fetchFn) => {
|
|
2610
|
+
const getHeaders = (h) => {
|
|
2611
|
+
if (!h)
|
|
2612
|
+
return {};
|
|
2613
|
+
if (h instanceof Headers)
|
|
2614
|
+
return Object.fromEntries(h.entries());
|
|
2615
|
+
if (Symbol.iterator in h) {
|
|
2616
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2617
|
+
}
|
|
2618
|
+
const headers = {};
|
|
2619
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2620
|
+
if (value !== undefined)
|
|
2621
|
+
headers[name] = value;
|
|
2622
|
+
}
|
|
2623
|
+
return headers;
|
|
2624
|
+
};
|
|
2625
|
+
const res = await (fetchFn ?? fetch)(getUpdateVolumeBackupUrl(volumeBackupId), {
|
|
2626
|
+
...options,
|
|
2627
|
+
method: "PATCH",
|
|
2628
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2629
|
+
body: JSON.stringify(updateVolumeBackupRequestBody),
|
|
2630
|
+
});
|
|
2631
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2632
|
+
const data = body ? JSON.parse(body) : {};
|
|
2633
|
+
return { data, status: res.status, headers: res.headers };
|
|
2634
|
+
};
|
|
2635
|
+
export const getDeleteVolumeBackupUrl = (volumeBackupId, params) => {
|
|
2636
|
+
const normalizedParams = new URLSearchParams();
|
|
2637
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2638
|
+
if (value !== undefined) {
|
|
2639
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2640
|
+
}
|
|
2641
|
+
});
|
|
2642
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2643
|
+
return stringifiedParams.length > 0
|
|
2644
|
+
? `https://compute.leaflow.cloud/api/v2/volume-backups/${encodeURIComponent(String(volumeBackupId))}?${stringifiedParams}`
|
|
2645
|
+
: `https://compute.leaflow.cloud/api/v2/volume-backups/${encodeURIComponent(String(volumeBackupId))}`;
|
|
2646
|
+
};
|
|
2647
|
+
/**
|
|
2648
|
+
* Independent of the source volume: deletion succeeds whether or not that volume still exists. Metering of the backup ends once it is deleted.
|
|
2649
|
+
*
|
|
2650
|
+
* Quota capacity and storage metering are released only after cleanup is confirmed.
|
|
2651
|
+
*
|
|
2652
|
+
* A resource whose purchase still awaits checkout or payment is refused with `COMPUTE_PURCHASE_PENDING`; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead. A subscribed resource is released through its subscription cancellation. Cleanup must be confirmed before metering is stopped; unknown cleanup is not proof of release.
|
|
2653
|
+
*
|
|
2654
|
+
* While subscriptions pay for the volume backup (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the volume backup working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
2655
|
+
* @summary Delete a volume backup
|
|
2656
|
+
*/
|
|
2657
|
+
export const deleteVolumeBackup = async (volumeBackupId, params, options, fetchFn) => {
|
|
2658
|
+
const res = await (fetchFn ?? fetch)(getDeleteVolumeBackupUrl(volumeBackupId, params), {
|
|
2659
|
+
...options,
|
|
2660
|
+
method: "DELETE",
|
|
2661
|
+
});
|
|
2662
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2663
|
+
const data = body ? JSON.parse(body) : {};
|
|
2664
|
+
return { data, status: res.status, headers: res.headers };
|
|
2665
|
+
};
|
|
2666
|
+
export const getListVolumeSnapshotsUrl = (params) => {
|
|
2667
|
+
const normalizedParams = new URLSearchParams();
|
|
2668
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2669
|
+
if (value !== undefined) {
|
|
2670
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2673
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2674
|
+
return stringifiedParams.length > 0
|
|
2675
|
+
? `https://compute.leaflow.cloud/api/v2/volume-snapshots?${stringifiedParams}`
|
|
2676
|
+
: `https://compute.leaflow.cloud/api/v2/volume-snapshots`;
|
|
2677
|
+
};
|
|
2678
|
+
/**
|
|
2679
|
+
* @summary List snapshots
|
|
2680
|
+
*/
|
|
2681
|
+
export const listVolumeSnapshots = async (params, options, fetchFn) => {
|
|
2682
|
+
const res = await (fetchFn ?? fetch)(getListVolumeSnapshotsUrl(params), {
|
|
2683
|
+
...options,
|
|
2684
|
+
method: "GET",
|
|
2685
|
+
});
|
|
2686
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2687
|
+
const data = body ? JSON.parse(body) : {};
|
|
2688
|
+
return { data, status: res.status, headers: res.headers };
|
|
2689
|
+
};
|
|
2690
|
+
export const getCreateVolumeSnapshotUrl = () => {
|
|
2691
|
+
return `https://compute.leaflow.cloud/api/v2/volume-snapshots`;
|
|
2692
|
+
};
|
|
2693
|
+
/**
|
|
2694
|
+
* Creates a snapshot of the volume. A running instance may produce a file-system-inconsistent snapshot; flush pending writes first. A boot volume cannot be reverted while attached. Pending snapshots count toward Compute project quotas until creation fails and cleanup is confirmed.
|
|
2695
|
+
*
|
|
2696
|
+
* It is metered by the hour on a subscription of its own and takes no billing choice. It is bought through a Billing Checkout Session: automatic checkout completes at once for metered pricing and the snapshot is taken as soon as the order is accepted; with deferred checkout it stays `pending` until the customer completes checkout in Billing. The source and project quotas are checked before the Checkout Session is created, and a refused request creates nothing.
|
|
2697
|
+
*
|
|
2698
|
+
* The snapshot shows the `create` operation from the moment its Checkout Session is created until it is delivered or its checkout or order ends. Every other operation on it is refused with `COMPUTE_RESOURCE_BUSY` meanwhile, and its deletion with `COMPUTE_PURCHASE_PENDING` while its purchase awaits checkout or payment.
|
|
2699
|
+
* @summary Create a snapshot
|
|
2700
|
+
*/
|
|
2701
|
+
export const createVolumeSnapshot = async (createVolumeSnapshotRequestBody, options, fetchFn) => {
|
|
2702
|
+
const getHeaders = (h) => {
|
|
2703
|
+
if (!h)
|
|
2704
|
+
return {};
|
|
2705
|
+
if (h instanceof Headers)
|
|
2706
|
+
return Object.fromEntries(h.entries());
|
|
2707
|
+
if (Symbol.iterator in h) {
|
|
2708
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2709
|
+
}
|
|
2710
|
+
const headers = {};
|
|
2711
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2712
|
+
if (value !== undefined)
|
|
2713
|
+
headers[name] = value;
|
|
2714
|
+
}
|
|
2715
|
+
return headers;
|
|
2716
|
+
};
|
|
2717
|
+
const res = await (fetchFn ?? fetch)(getCreateVolumeSnapshotUrl(), {
|
|
2718
|
+
...options,
|
|
2719
|
+
method: "POST",
|
|
2720
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2721
|
+
body: JSON.stringify(createVolumeSnapshotRequestBody),
|
|
2722
|
+
});
|
|
2723
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2724
|
+
const data = body ? JSON.parse(body) : {};
|
|
2725
|
+
return { data, status: res.status, headers: res.headers };
|
|
2726
|
+
};
|
|
2727
|
+
export const getGetVolumeSnapshotUrl = (volumeSnapshotId) => {
|
|
2728
|
+
return `https://compute.leaflow.cloud/api/v2/volume-snapshots/${encodeURIComponent(String(volumeSnapshotId))}`;
|
|
2729
|
+
};
|
|
2730
|
+
/**
|
|
2731
|
+
* @summary Retrieve a snapshot
|
|
2732
|
+
*/
|
|
2733
|
+
export const getVolumeSnapshot = async (volumeSnapshotId, options, fetchFn) => {
|
|
2734
|
+
const res = await (fetchFn ?? fetch)(getGetVolumeSnapshotUrl(volumeSnapshotId), {
|
|
2735
|
+
...options,
|
|
2736
|
+
method: "GET",
|
|
2737
|
+
});
|
|
2738
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2739
|
+
const data = body ? JSON.parse(body) : {};
|
|
2740
|
+
return { data, status: res.status, headers: res.headers };
|
|
2741
|
+
};
|
|
2742
|
+
export const getUpdateVolumeSnapshotUrl = (volumeSnapshotId) => {
|
|
2743
|
+
return `https://compute.leaflow.cloud/api/v2/volume-snapshots/${encodeURIComponent(String(volumeSnapshotId))}`;
|
|
2744
|
+
};
|
|
2745
|
+
/**
|
|
2746
|
+
* Changes the name only. A snapshot's source volume and capacity cannot be changed.
|
|
2747
|
+
* @summary Update a snapshot
|
|
2748
|
+
*/
|
|
2749
|
+
export const updateVolumeSnapshot = async (volumeSnapshotId, updateVolumeSnapshotRequestBody, options, fetchFn) => {
|
|
2750
|
+
const getHeaders = (h) => {
|
|
2751
|
+
if (!h)
|
|
2752
|
+
return {};
|
|
2753
|
+
if (h instanceof Headers)
|
|
2754
|
+
return Object.fromEntries(h.entries());
|
|
2755
|
+
if (Symbol.iterator in h) {
|
|
2756
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2757
|
+
}
|
|
2758
|
+
const headers = {};
|
|
2759
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2760
|
+
if (value !== undefined)
|
|
2761
|
+
headers[name] = value;
|
|
2762
|
+
}
|
|
2763
|
+
return headers;
|
|
2764
|
+
};
|
|
2765
|
+
const res = await (fetchFn ?? fetch)(getUpdateVolumeSnapshotUrl(volumeSnapshotId), {
|
|
2766
|
+
...options,
|
|
2767
|
+
method: "PATCH",
|
|
2768
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2769
|
+
body: JSON.stringify(updateVolumeSnapshotRequestBody),
|
|
2770
|
+
});
|
|
2771
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2772
|
+
const data = body ? JSON.parse(body) : {};
|
|
2773
|
+
return { data, status: res.status, headers: res.headers };
|
|
2774
|
+
};
|
|
2775
|
+
export const getDeleteVolumeSnapshotUrl = (volumeSnapshotId, params) => {
|
|
2776
|
+
const normalizedParams = new URLSearchParams();
|
|
2777
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2778
|
+
if (value !== undefined) {
|
|
2779
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2780
|
+
}
|
|
2781
|
+
});
|
|
2782
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2783
|
+
return stringifiedParams.length > 0
|
|
2784
|
+
? `https://compute.leaflow.cloud/api/v2/volume-snapshots/${encodeURIComponent(String(volumeSnapshotId))}?${stringifiedParams}`
|
|
2785
|
+
: `https://compute.leaflow.cloud/api/v2/volume-snapshots/${encodeURIComponent(String(volumeSnapshotId))}`;
|
|
2786
|
+
};
|
|
2787
|
+
/**
|
|
2788
|
+
* Deletes this resource. Quota capacity and storage metering are released only after cleanup is confirmed.
|
|
2789
|
+
*
|
|
2790
|
+
* A resource whose purchase still awaits checkout or payment is refused with `COMPUTE_PURCHASE_PENDING`; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead. A subscribed resource is released through its subscription cancellation. Cleanup must be confirmed before metering is stopped; unknown cleanup is not proof of release.
|
|
2791
|
+
*
|
|
2792
|
+
* While subscriptions pay for the snapshot (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the snapshot working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
2793
|
+
* @summary Delete a snapshot
|
|
2794
|
+
*/
|
|
2795
|
+
export const deleteVolumeSnapshot = async (volumeSnapshotId, params, options, fetchFn) => {
|
|
2796
|
+
const res = await (fetchFn ?? fetch)(getDeleteVolumeSnapshotUrl(volumeSnapshotId, params), {
|
|
2797
|
+
...options,
|
|
2798
|
+
method: "DELETE",
|
|
2799
|
+
});
|
|
2800
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2801
|
+
const data = body ? JSON.parse(body) : {};
|
|
2802
|
+
return { data, status: res.status, headers: res.headers };
|
|
2803
|
+
};
|
|
2804
|
+
export const getListVolumeTypesUrl = (params) => {
|
|
2805
|
+
const normalizedParams = new URLSearchParams();
|
|
2806
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2807
|
+
if (value !== undefined) {
|
|
2808
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2809
|
+
}
|
|
2810
|
+
});
|
|
2811
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2812
|
+
return stringifiedParams.length > 0
|
|
2813
|
+
? `https://compute.leaflow.cloud/api/v2/volume-types?${stringifiedParams}`
|
|
2814
|
+
: `https://compute.leaflow.cloud/api/v2/volume-types`;
|
|
2815
|
+
};
|
|
2816
|
+
/**
|
|
2817
|
+
* Volume types on sale are listed, and sold-out ones with `sale_status` `sold_out`. Any of them boots an instance of its zone, holds data or takes a restore. A withdrawn one disappears from here and can no longer be bought, while the volumes already on it keep working and can still be resized.
|
|
2818
|
+
* @summary List volume types on sale
|
|
2819
|
+
*/
|
|
2820
|
+
export const listVolumeTypes = async (params, options, fetchFn) => {
|
|
2821
|
+
const res = await (fetchFn ?? fetch)(getListVolumeTypesUrl(params), {
|
|
2822
|
+
...options,
|
|
2823
|
+
method: "GET",
|
|
2824
|
+
});
|
|
2825
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2826
|
+
const data = body ? JSON.parse(body) : {};
|
|
2827
|
+
return { data, status: res.status, headers: res.headers };
|
|
2828
|
+
};
|
|
2829
|
+
export const getGetVolumeTypeUrl = (volumeTypeId) => {
|
|
2830
|
+
return `https://compute.leaflow.cloud/api/v2/volume-types/${encodeURIComponent(String(volumeTypeId))}`;
|
|
2831
|
+
};
|
|
2832
|
+
/**
|
|
2833
|
+
* Retrieve capacity and performance constraints for an existing volume, including types withdrawn from sale.
|
|
2834
|
+
* @summary Get a volume type
|
|
2835
|
+
*/
|
|
2836
|
+
export const getVolumeType = async (volumeTypeId, options, fetchFn) => {
|
|
2837
|
+
const res = await (fetchFn ?? fetch)(getGetVolumeTypeUrl(volumeTypeId), {
|
|
2838
|
+
...options,
|
|
2839
|
+
method: "GET",
|
|
2840
|
+
});
|
|
2841
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2842
|
+
const data = body ? JSON.parse(body) : {};
|
|
2843
|
+
return { data, status: res.status, headers: res.headers };
|
|
2844
|
+
};
|
|
2845
|
+
export const getListVolumesUrl = (params) => {
|
|
2846
|
+
const normalizedParams = new URLSearchParams();
|
|
2847
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2848
|
+
if (value !== undefined) {
|
|
2849
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2850
|
+
}
|
|
2851
|
+
});
|
|
2852
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2853
|
+
return stringifiedParams.length > 0
|
|
2854
|
+
? `https://compute.leaflow.cloud/api/v2/volumes?${stringifiedParams}`
|
|
2855
|
+
: `https://compute.leaflow.cloud/api/v2/volumes`;
|
|
2856
|
+
};
|
|
2857
|
+
/**
|
|
2858
|
+
* When both `region_id` and `availability_zone_id` are supplied, only volumes attachable to an instance at that location are returned.
|
|
2859
|
+
* @summary List volumes
|
|
2860
|
+
*/
|
|
2861
|
+
export const listVolumes = async (params, options, fetchFn) => {
|
|
2862
|
+
const res = await (fetchFn ?? fetch)(getListVolumesUrl(params), {
|
|
2863
|
+
...options,
|
|
2864
|
+
method: "GET",
|
|
2865
|
+
});
|
|
2866
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2867
|
+
const data = body ? JSON.parse(body) : {};
|
|
2868
|
+
return { data, status: res.status, headers: res.headers };
|
|
2869
|
+
};
|
|
2870
|
+
export const getCreateVolumeUrl = () => {
|
|
2871
|
+
return `https://compute.leaflow.cloud/api/v2/volumes`;
|
|
2872
|
+
};
|
|
2873
|
+
/**
|
|
2874
|
+
* The volume is created in the availability zone of its volume type, and only an instance in the same zone can attach it.
|
|
2875
|
+
*
|
|
2876
|
+
* The type has to have room for it, checked before anything is ordered: refused with 409 `VOLUME_TYPE_SOLD_OUT` when the type takes no new volumes for now, `VOLUME_TYPE_CAPACITY_REACHED` when what is sold of it is used up, and `VOLUME_TYPE_NO_POOL_ROOM` when the storage of its zone cannot take the volume. Two orders placed at the same moment can both pass; the one that finds the type full when its order is accepted is not created and is refunded, ending `failed` with `provisioning_failed`.
|
|
2877
|
+
*
|
|
2878
|
+
* The volume is empty, or is restored from exactly one source: `volume_snapshot_id` or `volume_backup_id`. Giving both is refused with 422 `VOLUME_SOURCE_CONFLICT`. A restore is a purchase of a **new** volume; the source volume is unaffected and need not still exist.
|
|
2879
|
+
*
|
|
2880
|
+
* - **From a snapshot**, the volume type has to be of the snapshot's availability zone (422 `VOLUME_SNAPSHOT_OTHER_AVAILABILITY_ZONE`), because a snapshot lives in the same storage pool as its source and restores only into its own zone. `size_gib` is required and must be no smaller than the snapshot.
|
|
2881
|
+
* - **From a volume backup**, the volume type may be of any zone of the backup's region, because a backup is an independent copy in different storage. `size_gib` matches the size of the backup when omitted, and when given it must not be smaller than the backup. The volume cannot be attached until it is `available`.
|
|
2882
|
+
*
|
|
2883
|
+
* A volume type that is off sale is rejected with `VOLUME_TYPE_OFF_SALE`, even though its identifier still resolves. Types that are off sale do not appear in the volume type listing; volumes already bought on one keep working and can still be resized.
|
|
2884
|
+
*
|
|
2885
|
+
* A volume bought on its own is licensed: `billing.usage_type` `metered` is refused with `VOLUME_USAGE_TYPE_UNAVAILABLE`. A volume created with an instance follows the machine's terms instead and may be metered.
|
|
2886
|
+
*
|
|
2887
|
+
* The volume shows the `create` operation from the moment its Checkout Session is created until it is delivered or its checkout or order ends. Every other operation on it is refused with `COMPUTE_RESOURCE_BUSY` meanwhile, and its deletion with `COMPUTE_PURCHASE_PENDING` while its purchase awaits checkout or payment.
|
|
2888
|
+
* @summary Create a volume
|
|
2889
|
+
*/
|
|
2890
|
+
export const createVolume = async (createVolumeRequestBody, options, fetchFn) => {
|
|
2891
|
+
const getHeaders = (h) => {
|
|
2892
|
+
if (!h)
|
|
2893
|
+
return {};
|
|
2894
|
+
if (h instanceof Headers)
|
|
2895
|
+
return Object.fromEntries(h.entries());
|
|
2896
|
+
if (Symbol.iterator in h) {
|
|
2897
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2898
|
+
}
|
|
2899
|
+
const headers = {};
|
|
2900
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2901
|
+
if (value !== undefined)
|
|
2902
|
+
headers[name] = value;
|
|
2903
|
+
}
|
|
2904
|
+
return headers;
|
|
2905
|
+
};
|
|
2906
|
+
const res = await (fetchFn ?? fetch)(getCreateVolumeUrl(), {
|
|
2907
|
+
...options,
|
|
2908
|
+
method: "POST",
|
|
2909
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2910
|
+
body: JSON.stringify(createVolumeRequestBody),
|
|
2911
|
+
});
|
|
2912
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2913
|
+
const data = body ? JSON.parse(body) : {};
|
|
2914
|
+
return { data, status: res.status, headers: res.headers };
|
|
2915
|
+
};
|
|
2916
|
+
export const getGetVolumeUrl = (volumeId) => {
|
|
2917
|
+
return `https://compute.leaflow.cloud/api/v2/volumes/${encodeURIComponent(String(volumeId))}`;
|
|
2918
|
+
};
|
|
2919
|
+
/**
|
|
2920
|
+
* Returns the stored state of the volume; it does not query the cloud.
|
|
2921
|
+
* @summary Retrieve a volume
|
|
2922
|
+
*/
|
|
2923
|
+
export const getVolume = async (volumeId, options, fetchFn) => {
|
|
2924
|
+
const res = await (fetchFn ?? fetch)(getGetVolumeUrl(volumeId), {
|
|
2925
|
+
...options,
|
|
2926
|
+
method: "GET",
|
|
2927
|
+
});
|
|
2928
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2929
|
+
const data = body ? JSON.parse(body) : {};
|
|
2930
|
+
return { data, status: res.status, headers: res.headers };
|
|
2931
|
+
};
|
|
2932
|
+
export const getUpdateVolumeUrl = (volumeId) => {
|
|
2933
|
+
return `https://compute.leaflow.cloud/api/v2/volumes/${encodeURIComponent(String(volumeId))}`;
|
|
2934
|
+
};
|
|
2935
|
+
/**
|
|
2936
|
+
* Changes the name, the capacity or the volume type. The availability zone is immutable.
|
|
2937
|
+
*
|
|
2938
|
+
* `size_gib` and `volume_type_id` are operational fields: each starts a change and cannot be combined with any other field in the same request, including the other one. Such a request is refused with 422 `UPDATE_FIELDS_COMBINED`, because a rename that committed beside a change that was then refused would leave the request half applied. `checkout` and `proration_date` belong to the purchase of the change and are accepted only together with one of them.
|
|
2939
|
+
*
|
|
2940
|
+
* **Renaming** is not an operation and is accepted at any time. It returns 200 with `checkout_session_id` and `order_id` null.
|
|
2941
|
+
*
|
|
2942
|
+
* **Resizing** accepts only an increase; a smaller `size_gib` is refused with `VOLUME_CANNOT_SHRINK` (422), since a file system cannot be shrunk from outside the instance. It returns 202 with the volume and the Checkout Session for the resize, which keeps the volume's usage type and period. The volume shows the `resize` operation until the resize is applied, its Checkout Session expires or its order is canceled, so other operations and a second resize are refused with `COMPUTE_RESOURCE_BUSY` meanwhile. The volume keeps its current size until the resize is applied; once `size_gib` shows the new size, extend the file system inside the instance. If checkout is not completed, the order is not accepted or the resize fails, the volume keeps its size and Billing shows the outcome.
|
|
2943
|
+
*
|
|
2944
|
+
* **Changing the type** moves the volume to another volume type at the same capacity, priced as that type, and returns 202 with the volume and the Checkout Session for the change, which keeps the volume's usage type and period. The volume has to be detached (409 `VOLUME_RETYPE_ATTACHED`), so a boot volume cannot change its type. The target has to be on sale (`VOLUME_TYPE_OFF_SALE`), in the volume's region (422 `VOLUME_RETYPE_OTHER_REGION`), of the volume's availability zone (422 `VOLUME_TYPE_OTHER_AVAILABILITY_ZONE`) with room for the volume (409 `VOLUME_TYPE_SOLD_OUT`, `VOLUME_TYPE_CAPACITY_REACHED`, `VOLUME_TYPE_NO_POOL_ROOM`), admit the volume's capacity (422 `VOLUME_SIZE_OUT_OF_RANGE`, `VOLUME_SIZE_NOT_ON_STEP`) and differ from the current one (422 `VOLUME_RETYPE_SAME_TYPE`). The volume shows the `retype` operation until the change is applied, its Checkout Session expires or its order is canceled. A target on the same storage backend takes effect at once; one on another backend copies the volume's data there first, which takes longer the larger the volume is. The volume keeps its type until `volume_type_id` shows the new one, and its `performance` follows from then on; a change that did not take effect leaves the volume as it was and is refunded.
|
|
2945
|
+
*
|
|
2946
|
+
* An attached volume, including a boot volume, can be resized. The capacity is usable at once, and the volume's `performance` shows what its type gives the new size. **That performance applies from the volume's next attachment, or the next start of its stopped instance**: the storage reads a volume's limits only while connecting it. Until then the attachment's `performance` shows what is in effect.
|
|
2947
|
+
* @summary Update a volume
|
|
2948
|
+
*/
|
|
2949
|
+
export const updateVolume = async (volumeId, updateVolumeRequestBody, options, fetchFn) => {
|
|
2950
|
+
const getHeaders = (h) => {
|
|
2951
|
+
if (!h)
|
|
2952
|
+
return {};
|
|
2953
|
+
if (h instanceof Headers)
|
|
2954
|
+
return Object.fromEntries(h.entries());
|
|
2955
|
+
if (Symbol.iterator in h) {
|
|
2956
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2957
|
+
}
|
|
2958
|
+
const headers = {};
|
|
2959
|
+
for (const [name, value] of Object.entries(h)) {
|
|
2960
|
+
if (value !== undefined)
|
|
2961
|
+
headers[name] = value;
|
|
2962
|
+
}
|
|
2963
|
+
return headers;
|
|
2964
|
+
};
|
|
2965
|
+
const res = await (fetchFn ?? fetch)(getUpdateVolumeUrl(volumeId), {
|
|
2966
|
+
...options,
|
|
2967
|
+
method: "PATCH",
|
|
2968
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
2969
|
+
body: JSON.stringify(updateVolumeRequestBody),
|
|
2970
|
+
});
|
|
2971
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
2972
|
+
const data = body ? JSON.parse(body) : {};
|
|
2973
|
+
return { data, status: res.status, headers: res.headers };
|
|
2974
|
+
};
|
|
2975
|
+
export const getDeleteVolumeUrl = (volumeId, params) => {
|
|
2976
|
+
const normalizedParams = new URLSearchParams();
|
|
2977
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2978
|
+
if (value !== undefined) {
|
|
2979
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2980
|
+
}
|
|
2981
|
+
});
|
|
2982
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2983
|
+
return stringifiedParams.length > 0
|
|
2984
|
+
? `https://compute.leaflow.cloud/api/v2/volumes/${encodeURIComponent(String(volumeId))}?${stringifiedParams}`
|
|
2985
|
+
: `https://compute.leaflow.cloud/api/v2/volumes/${encodeURIComponent(String(volumeId))}`;
|
|
2986
|
+
};
|
|
2987
|
+
/**
|
|
2988
|
+
* Deletion is rejected while the volume is attached, or while snapshots created from it still exist.
|
|
2989
|
+
*
|
|
2990
|
+
* Refused with `COMPUTE_PURCHASE_PENDING` while the purchase that created it still awaits checkout or payment; `meta.checkout_session_id` names its Checkout Session and `meta.order_id` its order once checkout created one. Expire the session or cancel the order in Billing instead.
|
|
2991
|
+
*
|
|
2992
|
+
* While subscriptions pay for the volume (those in its `release_set`), deleting it cancels them rather than being refused: Compute creates one Billing cancellation for the whole set and answers with it in `cancellation`. `cancellation_mode` chooses when: `immediate` cancels the set now, a licensed subscription being refunded under its terms, and `period_end` keeps the volume working until `scheduled_at` and releases it then. Asking again while that cancellation is pending answers with it again, whatever mode is asked for.
|
|
2993
|
+
* @summary Delete a volume
|
|
2994
|
+
*/
|
|
2995
|
+
export const deleteVolume = async (volumeId, params, options, fetchFn) => {
|
|
2996
|
+
const res = await (fetchFn ?? fetch)(getDeleteVolumeUrl(volumeId, params), {
|
|
2997
|
+
...options,
|
|
2998
|
+
method: "DELETE",
|
|
2999
|
+
});
|
|
3000
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
3001
|
+
const data = body ? JSON.parse(body) : {};
|
|
3002
|
+
return { data, status: res.status, headers: res.headers };
|
|
3003
|
+
};
|
|
3004
|
+
export const getRevertVolumeUrl = (volumeId) => {
|
|
3005
|
+
return `https://compute.leaflow.cloud/api/v2/volumes/${encodeURIComponent(String(volumeId))}:revert`;
|
|
3006
|
+
};
|
|
3007
|
+
/**
|
|
3008
|
+
* Restores the contents of the volume to the moment the snapshot was taken. **All data written after that moment is lost and cannot be recovered.**
|
|
3009
|
+
*
|
|
3010
|
+
* Three restrictions apply: only the most recent snapshot of the volume can be reverted to; the volume must be detached from its instance first; and a volume resized since the snapshot was taken cannot be reverted. To return to an earlier point in time, or to keep the existing volume, create a new volume from the snapshot instead.
|
|
3011
|
+
*
|
|
3012
|
+
* The revert is a request of its own rather than a state of the volume: the response is the volume, which shows the `revert` operation until the revert is complete.
|
|
3013
|
+
* @summary Revert a volume to a snapshot
|
|
3014
|
+
*/
|
|
3015
|
+
export const revertVolume = async (volumeId, revertVolumeRequestBody, options, fetchFn) => {
|
|
3016
|
+
const getHeaders = (h) => {
|
|
3017
|
+
if (!h)
|
|
3018
|
+
return {};
|
|
3019
|
+
if (h instanceof Headers)
|
|
3020
|
+
return Object.fromEntries(h.entries());
|
|
3021
|
+
if (Symbol.iterator in h) {
|
|
3022
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
3023
|
+
}
|
|
3024
|
+
const headers = {};
|
|
3025
|
+
for (const [name, value] of Object.entries(h)) {
|
|
3026
|
+
if (value !== undefined)
|
|
3027
|
+
headers[name] = value;
|
|
3028
|
+
}
|
|
3029
|
+
return headers;
|
|
3030
|
+
};
|
|
3031
|
+
const res = await (fetchFn ?? fetch)(getRevertVolumeUrl(volumeId), {
|
|
3032
|
+
...options,
|
|
3033
|
+
method: "POST",
|
|
3034
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
3035
|
+
body: JSON.stringify(revertVolumeRequestBody),
|
|
3036
|
+
});
|
|
3037
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
3038
|
+
const data = body ? JSON.parse(body) : {};
|
|
3039
|
+
return { data, status: res.status, headers: res.headers };
|
|
3040
|
+
};
|