Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into pkcs12_sample
  • Loading branch information
xiazhvera committed Jul 11, 2023
2 parents c8c4fb1 + fc8501e commit deb541d
Show file tree
Hide file tree
Showing 16 changed files with 722 additions and 23 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ env:
CI_SECURE_TUNNEL: arn:aws:iam::180635532705:role/CI_SecureTunnel_Role
CI_X509_ROLE: arn:aws:iam::180635532705:role/CI_X509_Role
CI_MQTT5_ROLE: arn:aws:iam::180635532705:role/CI_MQTT5_Role
CI_GREENGRASS_ROLE: arn:aws:iam::180635532705:role/CI_Greengrass_Role

jobs:
linux-compat:
Expand Down Expand Up @@ -518,6 +519,14 @@ jobs:
- name: run X509 sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_x509_connect_cfg.json
- name: configure AWS credentials (Greengrass)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_GREENGRASS_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Greengrass Discovery sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_greengrass_discovery_cfg.json
# check that docs can still build
check-docs:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/ci_run_greengrass_discovery_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"language": "CPP",
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/greengrass/basic_discovery/basic-discovery",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
{
"name": "--cert",
"secret": "ci/Greengrass/cert",
"filename": "tmp_certificate.pem"
},
{
"name": "--key",
"secret": "ci/Greengrass/key",
"filename": "tmp_key.pem"
},
{
"name": "--ca_file",
"secret": "ci/Greengrass/ca",
"filename": "tmp_ca.pem"
},
{
"name": "--region",
"data": "us-east-1"
},
{
"name": "--thing_name",
"data": "CI_GreenGrass_Thing"
},
{
"name": "--is_ci",
"data": "true"
},
{
"name": "--print_discover_resp_only",
"data": ""
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ We need your help in making this SDK great. Please participate in the community

This library is licensed under the [Apache 2.0 License](./documents/LICENSE).

Latest released version: v1.24.0
Latest released version: v1.25.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.24.0
1.25.0
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ namespace Aws

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

std::shared_ptr<CancelLocalDeploymentOperation> NewCancelLocalDeployment() noexcept;

std::shared_ptr<ListNamedShadowsForThingOperation> NewListNamedShadowsForThing() noexcept;

std::shared_ptr<SubscribeToComponentUpdatesOperation> NewSubscribeToComponentUpdates(
Expand Down
198 changes: 197 additions & 1 deletion greengrass_ipc/include/aws/greengrass/GreengrassCoreIpcModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ namespace Aws
Aws::Crt::Optional<Aws::Crt::String> m_value;
};

enum DetailedDeploymentStatus
{
DETAILED_DEPLOYMENT_STATUS_SUCCESSFUL,
DETAILED_DEPLOYMENT_STATUS_FAILED_NO_STATE_CHANGE,
DETAILED_DEPLOYMENT_STATUS_FAILED_ROLLBACK_NOT_REQUESTED,
DETAILED_DEPLOYMENT_STATUS_FAILED_ROLLBACK_COMPLETE,
DETAILED_DEPLOYMENT_STATUS_REJECTED
};

class MessageContext : public AbstractShapeBase
{
public:
Expand Down Expand Up @@ -88,12 +97,64 @@ namespace Aws
METRIC_UNIT_TYPE_SECONDS
};

class DeploymentStatusDetails : public AbstractShapeBase
{
public:
DeploymentStatusDetails() noexcept {}
DeploymentStatusDetails(const DeploymentStatusDetails &) = default;
void SetDetailedDeploymentStatus(DetailedDeploymentStatus detailedDeploymentStatus) noexcept;
Aws::Crt::Optional<DetailedDeploymentStatus> GetDetailedDeploymentStatus() noexcept;
void SetDeploymentErrorStack(const Aws::Crt::Vector<Aws::Crt::String> &deploymentErrorStack) noexcept
{
m_deploymentErrorStack = deploymentErrorStack;
}
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> GetDeploymentErrorStack() noexcept
{
return m_deploymentErrorStack;
}
void SetDeploymentErrorTypes(const Aws::Crt::Vector<Aws::Crt::String> &deploymentErrorTypes) noexcept
{
m_deploymentErrorTypes = deploymentErrorTypes;
}
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> GetDeploymentErrorTypes() noexcept
{
return m_deploymentErrorTypes;
}
void SetDeploymentFailureCause(const Aws::Crt::String &deploymentFailureCause) noexcept
{
m_deploymentFailureCause = deploymentFailureCause;
}
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentFailureCause() noexcept
{
return m_deploymentFailureCause;
}
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
static void s_loadFromJsonView(DeploymentStatusDetails &, const Aws::Crt::JsonView &) noexcept;
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
Aws::Crt::StringView,
Aws::Crt::Allocator *) noexcept;
static void s_customDeleter(DeploymentStatusDetails *) noexcept;
/* This needs to be defined so that `DeploymentStatusDetails` can be used as a key in maps. */
bool operator<(const DeploymentStatusDetails &) const noexcept;
static const char *MODEL_NAME;

protected:
Aws::Crt::String GetModelName() const noexcept override;

private:
Aws::Crt::Optional<Aws::Crt::String> m_detailedDeploymentStatus;
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> m_deploymentErrorStack;
Aws::Crt::Optional<Aws::Crt::Vector<Aws::Crt::String>> m_deploymentErrorTypes;
Aws::Crt::Optional<Aws::Crt::String> m_deploymentFailureCause;
};

enum DeploymentStatus
{
DEPLOYMENT_STATUS_QUEUED,
DEPLOYMENT_STATUS_IN_PROGRESS,
DEPLOYMENT_STATUS_SUCCEEDED,
DEPLOYMENT_STATUS_FAILED
DEPLOYMENT_STATUS_FAILED,
DEPLOYMENT_STATUS_CANCELED
};

enum LifecycleState
Expand Down Expand Up @@ -450,6 +511,16 @@ namespace Aws
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentId() noexcept { return m_deploymentId; }
void SetStatus(DeploymentStatus status) noexcept;
Aws::Crt::Optional<DeploymentStatus> GetStatus() noexcept;
void SetCreatedOn(const Aws::Crt::String &createdOn) noexcept { m_createdOn = createdOn; }
Aws::Crt::Optional<Aws::Crt::String> GetCreatedOn() noexcept { return m_createdOn; }
void SetDeploymentStatusDetails(const DeploymentStatusDetails &deploymentStatusDetails) noexcept
{
m_deploymentStatusDetails = deploymentStatusDetails;
}
Aws::Crt::Optional<DeploymentStatusDetails> GetDeploymentStatusDetails() noexcept
{
return m_deploymentStatusDetails;
}
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
static void s_loadFromJsonView(LocalDeployment &, const Aws::Crt::JsonView &) noexcept;
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
Expand All @@ -466,6 +537,8 @@ namespace Aws
private:
Aws::Crt::Optional<Aws::Crt::String> m_deploymentId;
Aws::Crt::Optional<Aws::Crt::String> m_status;
Aws::Crt::Optional<Aws::Crt::String> m_createdOn;
Aws::Crt::Optional<DeploymentStatusDetails> m_deploymentStatusDetails;
};

class ComponentDetails : public AbstractShapeBase
Expand Down Expand Up @@ -1160,6 +1233,12 @@ namespace Aws
Aws::Crt::Optional<MQTTCredential> m_mqttCredential;
};

enum FailureHandlingPolicy
{
FAILURE_HANDLING_POLICY_ROLLBACK,
FAILURE_HANDLING_POLICY_DO_NOTHING
};

class InvalidArgumentsError : public OperationError
{
public:
Expand Down Expand Up @@ -3067,6 +3146,8 @@ namespace Aws
{
return m_artifactsDirectoryPath;
}
void SetFailureHandlingPolicy(FailureHandlingPolicy failureHandlingPolicy) noexcept;
Aws::Crt::Optional<FailureHandlingPolicy> GetFailureHandlingPolicy() noexcept;
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
static void s_loadFromJsonView(CreateLocalDeploymentRequest &, const Aws::Crt::JsonView &) noexcept;
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
Expand All @@ -3088,6 +3169,7 @@ namespace Aws
Aws::Crt::Optional<Aws::Crt::Map<Aws::Crt::String, RunWithInfo>> m_componentToRunWithInfo;
Aws::Crt::Optional<Aws::Crt::String> m_recipeDirectoryPath;
Aws::Crt::Optional<Aws::Crt::String> m_artifactsDirectoryPath;
Aws::Crt::Optional<Aws::Crt::String> m_failureHandlingPolicy;
};

class CreateDebugPasswordResponse : public AbstractShapeBase
Expand Down Expand Up @@ -3156,6 +3238,54 @@ namespace Aws
private:
};

class CancelLocalDeploymentResponse : public AbstractShapeBase
{
public:
CancelLocalDeploymentResponse() noexcept {}
CancelLocalDeploymentResponse(const CancelLocalDeploymentResponse &) = default;
void SetMessage(const Aws::Crt::String &message) noexcept { m_message = message; }
Aws::Crt::Optional<Aws::Crt::String> GetMessage() noexcept { return m_message; }
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
static void s_loadFromJsonView(CancelLocalDeploymentResponse &, const Aws::Crt::JsonView &) noexcept;
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
Aws::Crt::StringView,
Aws::Crt::Allocator *) noexcept;
static void s_customDeleter(CancelLocalDeploymentResponse *) noexcept;
/* This needs to be defined so that `CancelLocalDeploymentResponse` can be used as a key in maps. */
bool operator<(const CancelLocalDeploymentResponse &) const noexcept;
static const char *MODEL_NAME;

protected:
Aws::Crt::String GetModelName() const noexcept override;

private:
Aws::Crt::Optional<Aws::Crt::String> m_message;
};

class CancelLocalDeploymentRequest : public AbstractShapeBase
{
public:
CancelLocalDeploymentRequest() noexcept {}
CancelLocalDeploymentRequest(const CancelLocalDeploymentRequest &) = default;
void SetDeploymentId(const Aws::Crt::String &deploymentId) noexcept { m_deploymentId = deploymentId; }
Aws::Crt::Optional<Aws::Crt::String> GetDeploymentId() noexcept { return m_deploymentId; }
void SerializeToJsonObject(Aws::Crt::JsonObject &payloadObject) const noexcept override;
static void s_loadFromJsonView(CancelLocalDeploymentRequest &, const Aws::Crt::JsonView &) noexcept;
static Aws::Crt::ScopedResource<AbstractShapeBase> s_allocateFromPayload(
Aws::Crt::StringView,
Aws::Crt::Allocator *) noexcept;
static void s_customDeleter(CancelLocalDeploymentRequest *) noexcept;
/* This needs to be defined so that `CancelLocalDeploymentRequest` can be used as a key in maps. */
bool operator<(const CancelLocalDeploymentRequest &) const noexcept;
static const char *MODEL_NAME;

protected:
Aws::Crt::String GetModelName() const noexcept override;

private:
Aws::Crt::Optional<Aws::Crt::String> m_deploymentId;
};

class InvalidClientDeviceAuthTokenError : public OperationError
{
public:
Expand Down Expand Up @@ -5269,6 +5399,71 @@ namespace Aws
Aws::Crt::String GetModelName() const noexcept override;
};

class CancelLocalDeploymentOperationContext : public OperationModelContext
{
public:
CancelLocalDeploymentOperationContext(const GreengrassCoreIpcServiceModel &serviceModel) noexcept;
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateInitialResponseFromPayload(
Aws::Crt::StringView stringView,
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override;
Aws::Crt::ScopedResource<AbstractShapeBase> AllocateStreamingResponseFromPayload(
Aws::Crt::StringView stringView,
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) const noexcept override;
Aws::Crt::String GetRequestModelName() const noexcept override;
Aws::Crt::String GetInitialResponseModelName() const noexcept override;
Aws::Crt::Optional<Aws::Crt::String> GetStreamingResponseModelName() const noexcept override;
Aws::Crt::String GetOperationName() const noexcept override;
};

class CancelLocalDeploymentResult
{
public:
CancelLocalDeploymentResult() noexcept {}
CancelLocalDeploymentResult(TaggedResult &&taggedResult) noexcept : m_taggedResult(std::move(taggedResult))
{
}
CancelLocalDeploymentResponse *GetOperationResponse() const noexcept
{
return static_cast<CancelLocalDeploymentResponse *>(m_taggedResult.GetOperationResponse());
}
/**
* @return true if the response is associated with an expected response;
* false if the response is associated with an error.
*/
operator bool() const noexcept { return m_taggedResult == true; }
OperationError *GetOperationError() const noexcept { return m_taggedResult.GetOperationError(); }
RpcError GetRpcError() const noexcept { return m_taggedResult.GetRpcError(); }
ResultType GetResultType() const noexcept { return m_taggedResult.GetResultType(); }

private:
TaggedResult m_taggedResult;
};

class CancelLocalDeploymentOperation : public ClientOperation
{
public:
CancelLocalDeploymentOperation(
ClientConnection &connection,
const CancelLocalDeploymentOperationContext &operationContext,
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept;
/**
* Used to activate a stream for the `CancelLocalDeploymentOperation`
* @param request The request used for the `CancelLocalDeploymentOperation`
* @param onMessageFlushCallback An optional callback that is invoked when the request is flushed.
* @return An `RpcError` that can be used to check whether the stream was activated.
*/
std::future<RpcError> Activate(
const CancelLocalDeploymentRequest &request,
OnMessageFlushCallback onMessageFlushCallback = nullptr) noexcept;
/**
* Retrieve the result from activating the stream.
*/
std::future<CancelLocalDeploymentResult> GetResult() noexcept;

protected:
Aws::Crt::String GetModelName() const noexcept override;
};

class ListNamedShadowsForThingOperationContext : public OperationModelContext
{
public:
Expand Down Expand Up @@ -5755,6 +5950,7 @@ namespace Aws
GetLocalDeploymentStatusOperationContext m_getLocalDeploymentStatusOperationContext;
GetSecretValueOperationContext m_getSecretValueOperationContext;
UpdateStateOperationContext m_updateStateOperationContext;
CancelLocalDeploymentOperationContext m_cancelLocalDeploymentOperationContext;
ListNamedShadowsForThingOperationContext m_listNamedShadowsForThingOperationContext;
SubscribeToComponentUpdatesOperationContext m_subscribeToComponentUpdatesOperationContext;
ListLocalDeploymentsOperationContext m_listLocalDeploymentsOperationContext;
Expand Down
11 changes: 11 additions & 0 deletions greengrass_ipc/source/GreengrassCoreIpcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ namespace Aws
return operation;
}

std::shared_ptr<CancelLocalDeploymentOperation> GreengrassCoreIpcClient::NewCancelLocalDeployment() noexcept
{
auto operation = Aws::Crt::MakeShared<CancelLocalDeploymentOperation>(
m_allocator,
m_connection,
m_greengrassCoreIpcServiceModel.m_cancelLocalDeploymentOperationContext,
m_allocator);
operation->WithLaunchMode(m_asyncLaunchMode);
return operation;
}

std::shared_ptr<ListNamedShadowsForThingOperation> GreengrassCoreIpcClient::
NewListNamedShadowsForThing() noexcept
{
Expand Down
Loading

0 comments on commit deb541d

Please sign in to comment.