From 12026af864e0b76dc8a998de23ba89f659bcd475 Mon Sep 17 00:00:00 2001 From: Kevin Soltysiak Date: Fri, 16 Jul 2021 10:25:24 +0200 Subject: [PATCH] fix(containers): handle no-op scalingo --- CHANGELOG.md | 4 ++++ src/Containers/index.ts | 11 ++++++++--- src/models/regional/containers.ts | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e723bc37..15e7c806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +## 0.3.11 + +* Containers: scaling can be a no-op (no operations return) + ## 0.3.10 * Typo diff --git a/src/Containers/index.ts b/src/Containers/index.ts index 141a4d23..e0bd52b2 100644 --- a/src/Containers/index.ts +++ b/src/Containers/index.ts @@ -51,9 +51,14 @@ export default class Containers { "containers", { hasOperation: true } ); - const operation = new Operation(this._client, result.operation); - await operation.refresh(); - return { formation: result.data, operation: operation }; + + if (result.operation) { + const operation = new Operation(this._client, result.operation); + await operation.refresh(); + return { formation: result.data, operation: operation }; + } else { + return { formation: result.data }; + } } /** diff --git a/src/models/regional/containers.ts b/src/models/regional/containers.ts index 5875e2da..dbcf8800 100644 --- a/src/models/regional/containers.ts +++ b/src/models/regional/containers.ts @@ -4,7 +4,7 @@ export interface ContainersOperation { /** Response of the API call */ formation: Container[]; /** Operation information */ - operation: Operation; + operation?: Operation; } export interface Container {