Skip to content

Commit 074a52e

Browse files
bretambroseBret Ambrose
and
Bret Ambrose
authored
Update model and client for GG 2.11 (#597)
Co-authored-by: Bret Ambrose <bambrose@amazon.com>
1 parent b5b0f10 commit 074a52e

File tree

4 files changed

+606
-5
lines changed

4 files changed

+606
-5
lines changed

greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ namespace Aws
102102

103103
std::shared_ptr<UpdateStateOperation> NewUpdateState() noexcept;
104104

105+
std::shared_ptr<CancelLocalDeploymentOperation> NewCancelLocalDeployment() noexcept;
106+
105107
std::shared_ptr<ListNamedShadowsForThingOperation> NewListNamedShadowsForThing() noexcept;
106108

107109
std::shared_ptr<SubscribeToComponentUpdatesOperation> NewSubscribeToComponentUpdates(

greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h

Lines changed: 197 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ namespace Aws
4848
Aws::Crt::Optional<Aws::Crt::String> m_value;
4949
};
5050

51+
enum DetailedDeploymentStatus
52+
{
53+
DETAILED_DEPLOYMENT_STATUS_SUCCESSFUL,
54+
DETAILED_DEPLOYMENT_STATUS_FAILED_NO_STATE_CHANGE,
55+
DETAILED_DEPLOYMENT_STATUS_FAILED_ROLLBACK_NOT_REQUESTED,
56+
DETAILED_DEPLOYMENT_STATUS_FAILED_ROLLBACK_COMPLETE,
57+
DETAILED_DEPLOYMENT_STATUS_REJECTED
58+
};
59+
5160
class MessageContext : public AbstractShapeBase
5261
{
5362
public:
@@ -88,12 +97,64 @@ namespace Aws
8897
METRIC_UNIT_TYPE_SECONDS
8998
};
9099

100+
class DeploymentStatusDetails : public AbstractShapeBase
101+
{
102+
public:
103+
DeploymentStatusDetails() noexcept {}
104+
DeploymentStatusDetails(const DeploymentStatusDetails &) = default;
105+
void SetDetailedDeploymentStatus(DetailedDeploymentStatus detailedDeploymentStatus) noexcept;
106+
Aws::Crt::Optional<DetailedDeploymentStatus> GetDetailedDeploymentStatus() noexcept;
107+
void SetDeploymentErrorStack(const Aws::Crt::Vector<Aws::Crt::String> &deploymentErrorStack) noexcept
108+
{
109+
m_deploymentErrorStack = deploymentErrorStack;
110+
}
111+
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> GetDeploymentErrorStack() noexcept
112+
{
113+
return m_deploymentErrorStack;
114+
}
115+
void SetDeploymentErrorTypes(const Aws::Crt::Vector<Aws::Crt::String> &deploymentErrorTypes) noexcept
116+
{
117+
m_deploymentErrorTypes = deploymentErrorTypes;
118+
}
119+
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> GetDeploymentErrorTypes() noexcept
120+
{
121+
return m_deploymentErrorTypes;
122+
}
123+
void SetDeploymentFailureCause(const Aws::Crt::String &deploymentFailureCause) noexcept
124+
{
125+
m_deploymentFailureCause = deploymentFailureCause;
126+
}
127+
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentFailureCause() noexcept
128+
{
129+
return m_deploymentFailureCause;
130+
}
131+
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
132+
static void s_loadFromJsonView(DeploymentStatusDetails &, const Aws::Crt::JsonView &) noexcept;
133+
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
134+
Aws::Crt::StringView,
135+
Aws::Crt::Allocator *) noexcept;
136+
static void s_customDeleter(DeploymentStatusDetails *) noexcept;
137+
/* This needs to be defined so that `DeploymentStatusDetails` can be used as a key in maps. */
138+
bool operator<(const DeploymentStatusDetails &) const noexcept;
139+
static const char *MODEL_NAME;
140+
141+
protected:
142+
Aws::Crt::String GetModelName() const noexcept override;
143+
144+
private:
145+
Aws::Crt::Optional<Aws::Crt::String> m_detailedDeploymentStatus;
146+
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> m_deploymentErrorStack;
147+
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> m_deploymentErrorTypes;
148+
Aws::Crt::Optional<Aws::Crt::String> m_deploymentFailureCause;
149+
};
150+
91151
enum DeploymentStatus
92152
{
93153
DEPLOYMENT_STATUS_QUEUED,
94154
DEPLOYMENT_STATUS_IN_PROGRESS,
95155
DEPLOYMENT_STATUS_SUCCEEDED,
96-
DEPLOYMENT_STATUS_FAILED
156+
DEPLOYMENT_STATUS_FAILED,
157+
DEPLOYMENT_STATUS_CANCELED
97158
};
98159

99160
enum LifecycleState
@@ -450,6 +511,16 @@ namespace Aws
450511
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentId() noexcept { return m_deploymentId; }
451512
void SetStatus(DeploymentStatus status) noexcept;
452513
Aws::Crt::Optional<DeploymentStatus> GetStatus() noexcept;
514+
void SetCreatedOn(const Aws::Crt::String &createdOn) noexcept { m_createdOn = createdOn; }
515+
Aws::Crt::Optional<Aws::Crt::String> GetCreatedOn() noexcept { return m_createdOn; }
516+
void SetDeploymentStatusDetails(const DeploymentStatusDetails &deploymentStatusDetails) noexcept
517+
{
518+
m_deploymentStatusDetails = deploymentStatusDetails;
519+
}
520+
Aws::Crt::Optional<DeploymentStatusDetails> GetDeploymentStatusDetails() noexcept
521+
{
522+
return m_deploymentStatusDetails;
523+
}
453524
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
454525
static void s_loadFromJsonView(LocalDeployment &, const Aws::Crt::JsonView &) noexcept;
455526
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
@@ -466,6 +537,8 @@ namespace Aws
466537
private:
467538
Aws::Crt::Optional<Aws::Crt::String> m_deploymentId;
468539
Aws::Crt::Optional<Aws::Crt::String> m_status;
540+
Aws::Crt::Optional<Aws::Crt::String> m_createdOn;
541+
Aws::Crt::Optional<DeploymentStatusDetails> m_deploymentStatusDetails;
469542
};
470543

471544
class ComponentDetails : public AbstractShapeBase
@@ -1160,6 +1233,12 @@ namespace Aws
11601233
Aws::Crt::Optional<MQTTCredential> m_mqttCredential;
11611234
};
11621235

1236+
enum FailureHandlingPolicy
1237+
{
1238+
FAILURE_HANDLING_POLICY_ROLLBACK,
1239+
FAILURE_HANDLING_POLICY_DO_NOTHING
1240+
};
1241+
11631242
class InvalidArgumentsError : public OperationError
11641243
{
11651244
public:
@@ -3067,6 +3146,8 @@ namespace Aws
30673146
{
30683147
return m_artifactsDirectoryPath;
30693148
}
3149+
void SetFailureHandlingPolicy(FailureHandlingPolicy failureHandlingPolicy) noexcept;
3150+
Aws::Crt::Optional<FailureHandlingPolicy> GetFailureHandlingPolicy() noexcept;
30703151
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
30713152
static void s_loadFromJsonView(CreateLocalDeploymentRequest &, const Aws::Crt::JsonView &) noexcept;
30723153
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
@@ -3088,6 +3169,7 @@ namespace Aws
30883169
Aws::Crt::Optional<Aws::Crt::Map<Aws::Crt::String, RunWithInfo>> m_componentToRunWithInfo;
30893170
Aws::Crt::Optional<Aws::Crt::String> m_recipeDirectoryPath;
30903171
Aws::Crt::Optional<Aws::Crt::String> m_artifactsDirectoryPath;
3172+
Aws::Crt::Optional<Aws::Crt::String> m_failureHandlingPolicy;
30913173
};
30923174

30933175
class CreateDebugPasswordResponse : public AbstractShapeBase
@@ -3156,6 +3238,54 @@ namespace Aws
31563238
private:
31573239
};
31583240

3241+
class CancelLocalDeploymentResponse : public AbstractShapeBase
3242+
{
3243+
public:
3244+
CancelLocalDeploymentResponse() noexcept {}
3245+
CancelLocalDeploymentResponse(const CancelLocalDeploymentResponse &) = default;
3246+
void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; }
3247+
Aws::Crt::Optional<Aws::Crt::String> GetMessage() noexcept { return m_message; }
3248+
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
3249+
static void s_loadFromJsonView(CancelLocalDeploymentResponse &, const Aws::Crt::JsonView &) noexcept;
3250+
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
3251+
Aws::Crt::StringView,
3252+
Aws::Crt::Allocator *) noexcept;
3253+
static void s_customDeleter(CancelLocalDeploymentResponse *) noexcept;
3254+
/* This needs to be defined so that `CancelLocalDeploymentResponse` can be used as a key in maps. */
3255+
bool operator<(const CancelLocalDeploymentResponse &) const noexcept;
3256+
static const char *MODEL_NAME;
3257+
3258+
protected:
3259+
Aws::Crt::String GetModelName() const noexcept override;
3260+
3261+
private:
3262+
Aws::Crt::Optional<Aws::Crt::String> m_message;
3263+
};
3264+
3265+
class CancelLocalDeploymentRequest : public AbstractShapeBase
3266+
{
3267+
public:
3268+
CancelLocalDeploymentRequest() noexcept {}
3269+
CancelLocalDeploymentRequest(const CancelLocalDeploymentRequest &) = default;
3270+
void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; }
3271+
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentId() noexcept { return m_deploymentId; }
3272+
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
3273+
static void s_loadFromJsonView(CancelLocalDeploymentRequest &, const Aws::Crt::JsonView &) noexcept;
3274+
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
3275+
Aws::Crt::StringView,
3276+
Aws::Crt::Allocator *) noexcept;
3277+
static void s_customDeleter(CancelLocalDeploymentRequest *) noexcept;
3278+
/* This needs to be defined so that `CancelLocalDeploymentRequest` can be used as a key in maps. */
3279+
bool operator<(const CancelLocalDeploymentRequest &) const noexcept;
3280+
static const char *MODEL_NAME;
3281+
3282+
protected:
3283+
Aws::Crt::String GetModelName() const noexcept override;
3284+
3285+
private:
3286+
Aws::Crt::Optional<Aws::Crt::String> m_deploymentId;
3287+
};
3288+
31593289
class InvalidClientDeviceAuthTokenError : public OperationError
31603290
{
31613291
public:
@@ -5269,6 +5399,71 @@ namespace Aws
52695399
Aws::Crt::String GetModelName() const noexcept override;
52705400
};
52715401

5402+
class CancelLocalDeploymentOperationContext : public OperationModelContext
5403+
{
5404+
public:
5405+
CancelLocalDeploymentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept;
5406+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
5407+
Aws::Crt::StringView stringView,
5408+
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override;
5409+
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
5410+
Aws::Crt::StringView stringView,
5411+
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override;
5412+
Aws::Crt::String GetRequestModelName() const noexcept override;
5413+
Aws::Crt::String GetInitialResponseModelName() const noexcept override;
5414+
Aws::Crt::Optional<Aws::Crt::String> GetStreamingResponseModelName() const noexcept override;
5415+
Aws::Crt::String GetOperationName() const noexcept override;
5416+
};
5417+
5418+
class CancelLocalDeploymentResult
5419+
{
5420+
public:
5421+
CancelLocalDeploymentResult() noexcept {}
5422+
CancelLocalDeploymentResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult))
5423+
{
5424+
}
5425+
CancelLocalDeploymentResponse *GetOperationResponse() const noexcept
5426+
{
5427+
return static_cast<CancelLocalDeploymentResponse *>(m_taggedResult.GetOperationResponse());
5428+
}
5429+
/**
5430+
* @return true if the response is associated with an expected response;
5431+
* false if the response is associated with an error.
5432+
*/
5433+
operator bool() const noexcept { return m_taggedResult == true; }
5434+
OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); }
5435+
RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); }
5436+
ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); }
5437+
5438+
private:
5439+
TaggedResult m_taggedResult;
5440+
};
5441+
5442+
class CancelLocalDeploymentOperation : public ClientOperation
5443+
{
5444+
public:
5445+
CancelLocalDeploymentOperation(
5446+
ClientConnection &connection,
5447+
const CancelLocalDeploymentOperationContext &operationContext,
5448+
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept;
5449+
/**
5450+
* Used to activate a stream for the `CancelLocalDeploymentOperation`
5451+
* @param request The request used for the `CancelLocalDeploymentOperation`
5452+
* @param onMessageFlushCallback An optional callback that is invoked when the request is flushed.
5453+
* @return An `RpcError` that can be used to check whether the stream was activated.
5454+
*/
5455+
std::future<RpcError> Activate(
5456+
const CancelLocalDeploymentRequest &request,
5457+
OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept;
5458+
/**
5459+
* Retrieve the result from activating the stream.
5460+
*/
5461+
std::future<CancelLocalDeploymentResult> GetResult() noexcept;
5462+
5463+
protected:
5464+
Aws::Crt::String GetModelName() const noexcept override;
5465+
};
5466+
52725467
class ListNamedShadowsForThingOperationContext : public OperationModelContext
52735468
{
52745469
public:
@@ -5755,6 +5950,7 @@ namespace Aws
57555950
GetLocalDeploymentStatusOperationContext m_getLocalDeploymentStatusOperationContext;
57565951
GetSecretValueOperationContext m_getSecretValueOperationContext;
57575952
UpdateStateOperationContext m_updateStateOperationContext;
5953+
CancelLocalDeploymentOperationContext m_cancelLocalDeploymentOperationContext;
57585954
ListNamedShadowsForThingOperationContext m_listNamedShadowsForThingOperationContext;
57595955
SubscribeToComponentUpdatesOperationContext m_subscribeToComponentUpdatesOperationContext;
57605956
ListLocalDeploymentsOperationContext m_listLocalDeploymentsOperationContext;

greengrass_ipc/source/GreengrassCoreIpcClient.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ namespace Aws
367367
return operation;
368368
}
369369

370+
std::shared_ptr<CancelLocalDeploymentOperation> GreengrassCoreIpcClient::NewCancelLocalDeployment() noexcept
371+
{
372+
auto operation = Aws::Crt::MakeShared<CancelLocalDeploymentOperation>(
373+
m_allocator,
374+
m_connection,
375+
m_greengrassCoreIpcServiceModel.m_cancelLocalDeploymentOperationContext,
376+
m_allocator);
377+
operation->WithLaunchMode(m_asyncLaunchMode);
378+
return operation;
379+
}
380+
370381
std::shared_ptr<ListNamedShadowsForThingOperation> GreengrassCoreIpcClient::
371382
NewListNamedShadowsForThing() noexcept
372383
{

0 commit comments

Comments
 (0)