Skip to content

400 Bad Request #11

@muzzah

Description

@muzzah

Hi

Im trying to use the java API in a kotlin command line based application though get a 400 request. Any help figuring out what Im doing wrong would be appreciated

Here is the code I am using

try {
            log.d("Creating new exoscale instance")

            val response = exoscaleApi.listInstanceTypes()
            val tinyInstance =
                response.instanceTypes?.find { it.size == InstanceType.SizeEnum.TINY && it.family == InstanceType.FamilyEnum.STANDARD }

            if (tinyInstance == null) {
                log.e("Couldn't find tiny instance type")
                return false
            }

            val createInstanceRequest = CreateInstanceRequest().also {
                it.name = "WurstV2"
                it.template = exoscaleApi.getTemplate(UUID.fromString(exoscaleConfig().templateId))
                it.instanceType = tinyInstance
                it.sshKey = SshKey(exoscaleConfig().sshKey)
                it.publicIpAssignment = PublicIpAssignment.INET4
                it.diskSize = 10L
            }
            val operation: Operation = exoscaleApi.createInstance(createInstanceRequest)

        } catch (e: Throwable) {
            log.d("Problem when creating new instance : ${e.message}")
            return false
        }

Here is a sample request below.

Image

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions