diff --git a/.github/workflows/build-workflow.yaml b/.github/workflows/build-workflow.yaml index fa95645..258cd1b 100644 --- a/.github/workflows/build-workflow.yaml +++ b/.github/workflows/build-workflow.yaml @@ -4,8 +4,8 @@ on: # Run when pushing to stable branches push: branches: - - 'master' - - 'release-*' + - "master" + - "release-*" # Run on branch/tag creation create: # Run on pull requests @@ -22,36 +22,36 @@ jobs: env: MIX_ENV: ci steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: deps - key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - - uses: actions/cache@v1 - with: - path: _build - key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - - id: plt_cache - uses: actions/cache@v1 - with: - path: dialyzer_cache - key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache- - - uses: erlef/setup-beam@v1.15 - with: - otp-version: ${{ env.otp_version }} - elixir-version: ${{ env.elixir_version }} - - name: Install Dependencies - run: mix deps.get - - name: Create PLTs dir - if: ${{steps.plt_cache.outputs.cache-hit != 'true'}} - run: mkdir -p dialyzer_cache && mix dialyzer --plt - - name: Run dialyzer - # FIXME: This should be set to fail when dialyzer issues are fixed - run: mix dialyzer || exit 0 + - uses: actions/checkout@v5 + - uses: actions/cache@v4 + with: + path: deps + key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - uses: actions/cache@v4 + with: + path: _build + key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - id: plt_cache + uses: actions/cache@v4 + with: + path: dialyzer_cache + key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-dialyzer_cache- + - uses: erlef/setup-beam@v1.20 + with: + otp-version: ${{ env.otp_version }} + elixir-version: ${{ env.elixir_version }} + - name: Install Dependencies + run: mix deps.get + - name: Create PLTs dir + if: ${{steps.plt_cache.outputs.cache-hit != 'true'}} + run: mkdir -p dialyzer_cache && mix dialyzer --plt + - name: Run dialyzer + # FIXME: This should be set to fail when dialyzer issues are fixed + run: mix dialyzer || exit 0 test-coverage: name: Build and Test @@ -62,42 +62,42 @@ jobs: strategy: matrix: rabbitmq: - - "rabbitmq:3.12.0-management" + - "rabbitmq:3.12.0-management" services: rabbitmq: image: ${{ matrix.rabbitmq }} ports: - - 5672:5672 - - 15672:15672 + - 5672:5672 + - 15672:15672 env: MIX_ENV: test RABBITMQ_HOST: localhost steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v1 - with: - path: deps - key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - - uses: actions/cache@v1 - with: - path: _build - key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} - - uses: erlef/setup-beam@v1.15 - with: - otp-version: ${{ env.otp_version }} - elixir-version: ${{ env.elixir_version }} - - name: Install Dependencies - run: mix deps.get - - name: Check formatting - run: mix format --check-formatted - - name: Compile - run: mix compile - - name: Test and Coverage - run: mix coveralls.json --exclude wip -o coverage_results - - name: Upload Coverage Results to CodeCov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | - bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN + - uses: actions/checkout@v5 + - uses: actions/cache@v4 + with: + path: deps + key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - uses: actions/cache@v4 + with: + path: _build + key: ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ env.elixir_version }}-${{ env.otp_version }}-_build-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} + - uses: erlef/setup-beam@v1.20 + with: + otp-version: ${{ env.otp_version }} + elixir-version: ${{ env.elixir_version }} + - name: Install Dependencies + run: mix deps.get + - name: Check formatting + run: mix format --check-formatted + - name: Compile + run: mix compile + - name: Test and Coverage + run: mix coveralls.json --exclude wip -o coverage_results + - name: Upload Coverage Results to CodeCov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: | + bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN diff --git a/lib/astarte_rpc/protocol/data_updater_plant.ex b/lib/astarte_rpc/protocol/data_updater_plant.ex deleted file mode 100644 index 88048f2..0000000 --- a/lib/astarte_rpc/protocol/data_updater_plant.ex +++ /dev/null @@ -1,21 +0,0 @@ -# -# This file is part of Astarte. -# -# Copyright 2018 Ispirata Srl -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -defmodule Astarte.RPC.Protocol.DataUpdaterPlant do - use Astarte.RPC.Protocol, amqp_queue: "data_updater_plant_rpc" -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/call.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/call.pb.ex deleted file mode 100644 index 277b445..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/call.pb.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.Call do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Call" - - oneof :call, 0 - - field :version, 1, type: :int32, deprecated: true - - field :install_volatile_trigger, 2, - type: Astarte.RPC.Protocol.DataUpdaterPlant.InstallVolatileTrigger, - json_name: "installVolatileTrigger", - oneof: 0 - - field :delete_volatile_trigger, 3, - type: Astarte.RPC.Protocol.DataUpdaterPlant.DeleteVolatileTrigger, - json_name: "deleteVolatileTrigger", - oneof: 0 -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/call.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/call.proto deleted file mode 100644 index 4e273b8..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/call.proto +++ /dev/null @@ -1,32 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -import "lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.proto"; -import "lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.proto"; - -message Call { - int32 version = 1 [deprecated = true]; - - oneof call { - InstallVolatileTrigger install_volatile_trigger = 2; - DeleteVolatileTrigger delete_volatile_trigger = 3; - } -} - diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.pb.ex deleted file mode 100644 index 7716b05..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.pb.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.DeleteVolatileTrigger do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "DeleteVolatileTrigger" - - field :realm_name, 1, proto3_optional: true, type: :string, json_name: "realmName" - field :device_id, 2, proto3_optional: true, type: :string, json_name: "deviceId" - field :trigger_id, 3, proto3_optional: true, type: :bytes, json_name: "triggerId" -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.proto deleted file mode 100644 index 8665970..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/delete_volatile_trigger.proto +++ /dev/null @@ -1,25 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message DeleteVolatileTrigger { - optional string realm_name = 1; - optional string device_id = 2; - optional bytes trigger_id = 3; -} diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.pb.ex deleted file mode 100644 index 14539ba..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.pb.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.GenericErrorReply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "GenericErrorReply" - - field :error_name, 1, proto3_optional: true, type: :string, json_name: "errorName" - - field :user_readable_error_name, 2, - proto3_optional: true, - type: :string, - json_name: "userReadableErrorName" - - field :user_readable_message, 3, - proto3_optional: true, - type: :string, - json_name: "userReadableMessage" - - field :error_data, 4, proto3_optional: true, type: :string, json_name: "errorData" -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.proto deleted file mode 100644 index f132197..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.proto +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message GenericErrorReply { - optional string error_name = 1; - optional string user_readable_error_name = 2; - optional string user_readable_message = 3; - optional string error_data = 4; -} diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.pb.ex deleted file mode 100644 index 78972b6..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.pb.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.GenericOkReply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "GenericOkReply" - - field :async_operation, 1, type: :bool, json_name: "asyncOperation" -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.proto deleted file mode 100644 index fbd58b4..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.proto +++ /dev/null @@ -1,23 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message GenericOkReply { - bool async_operation = 1; -} diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.pb.ex deleted file mode 100644 index 15f2b6b..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.pb.ex +++ /dev/null @@ -1,16 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.InstallVolatileTrigger do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "InstallVolatileTrigger" - - field :realm_name, 1, proto3_optional: true, type: :string, json_name: "realmName" - field :device_id, 2, proto3_optional: true, type: :string, json_name: "deviceId" - field :object_id, 3, proto3_optional: true, type: :bytes, json_name: "objectId" - field :object_type, 4, type: :int32, json_name: "objectType" - field :parent_id, 5, proto3_optional: true, type: :bytes, json_name: "parentId" - field :simple_trigger_id, 8, proto3_optional: true, type: :bytes, json_name: "simpleTriggerId" - field :simple_trigger, 6, proto3_optional: true, type: :bytes, json_name: "simpleTrigger" - field :trigger_target, 7, proto3_optional: true, type: :bytes, json_name: "triggerTarget" -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.proto deleted file mode 100644 index e395c4c..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/install_volatile_trigger.proto +++ /dev/null @@ -1,30 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message InstallVolatileTrigger { - optional string realm_name = 1; - optional string device_id = 2; - optional bytes object_id = 3; - int32 object_type = 4; - optional bytes parent_id = 5; - optional bytes simple_trigger_id = 8; - optional bytes simple_trigger = 6; - optional bytes trigger_target = 7; -} diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.pb.ex b/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.pb.ex deleted file mode 100644 index c966587..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.pb.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule Astarte.RPC.Protocol.DataUpdaterPlant.Reply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Reply" - - oneof :reply, 0 - - field :version, 1, type: :int32, deprecated: true - field :error, 2, type: :bool - - field :generic_ok_reply, 3, - type: Astarte.RPC.Protocol.DataUpdaterPlant.GenericOkReply, - json_name: "genericOkReply", - oneof: 0 - - field :generic_error_reply, 4, - type: Astarte.RPC.Protocol.DataUpdaterPlant.GenericErrorReply, - json_name: "genericErrorReply", - oneof: 0 -end diff --git a/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.proto b/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.proto deleted file mode 100644 index eb27112..0000000 --- a/lib/astarte_rpc/protocol/proto/data_updater_plant/reply.proto +++ /dev/null @@ -1,32 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -import "lib/astarte_rpc/protocol/proto/data_updater_plant/generic_ok_reply.proto"; -import "lib/astarte_rpc/protocol/proto/data_updater_plant/generic_error_reply.proto"; - -message Reply { - int32 version = 1 [deprecated = true]; - bool error = 2; - - oneof reply { - GenericOkReply generic_ok_reply = 3; - GenericErrorReply generic_error_reply = 4; - } -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/call.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/call.pb.ex deleted file mode 100644 index 32171d9..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/call.pb.ex +++ /dev/null @@ -1,14 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.Call do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Call" - - oneof :call, 0 - - field :version, 1, type: :int32, deprecated: true - field :disconnect, 3, type: Astarte.RPC.Protocol.VMQ.Plugin.Disconnect, oneof: 0 - field :publish, 2, type: Astarte.RPC.Protocol.VMQ.Plugin.Publish, oneof: 0 - field :delete, 4, type: Astarte.RPC.Protocol.VMQ.Plugin.Delete, oneof: 0 -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/call.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/call.proto deleted file mode 100644 index 8b8ab32..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/call.proto +++ /dev/null @@ -1,33 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 - 2023 SECO Mind Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -import "lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.proto"; -import "lib/astarte_rpc/protocol/proto/vmq_plugin/publish.proto"; -import "lib/astarte_rpc/protocol/proto/vmq_plugin/delete.proto"; - -message Call { - int32 version = 1 [deprecated = true]; - - oneof call { - Disconnect disconnect = 3; - Publish publish = 2; - Delete delete = 4; - } -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.pb.ex deleted file mode 100644 index 91796bd..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.pb.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.Delete do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Delete" - - field :realm_name, 1, proto3_optional: true, type: :string, json_name: "realmName" - field :device_id, 2, proto3_optional: true, type: :string, json_name: "deviceId" -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.proto deleted file mode 100644 index a6da3e0..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/delete.proto +++ /dev/null @@ -1,24 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2023 SECO Mind Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message Delete { - optional string realm_name = 1; - optional string device_id = 2; -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.pb.ex deleted file mode 100644 index 0650039..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.pb.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.Disconnect do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Disconnect" - - field :client_id, 1, proto3_optional: true, type: :string, json_name: "clientId" - field :discard_state, 2, type: :bool, json_name: "discardState" -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.proto deleted file mode 100644 index 0dc5367..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/disconnect.proto +++ /dev/null @@ -1,24 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message Disconnect { - optional string client_id = 1; - bool discard_state = 2; -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.pb.ex deleted file mode 100644 index a09bf6b..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.pb.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.GenericErrorReply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "GenericErrorReply" - - field :error_name, 1, proto3_optional: true, type: :string, json_name: "errorName" - - field :user_readable_error_name, 2, - proto3_optional: true, - type: :string, - json_name: "userReadableErrorName" - - field :user_readable_message, 3, - proto3_optional: true, - type: :string, - json_name: "userReadableMessage" - - field :error_data, 4, proto3_optional: true, type: :string, json_name: "errorData" -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.proto deleted file mode 100644 index f132197..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.proto +++ /dev/null @@ -1,26 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message GenericErrorReply { - optional string error_name = 1; - optional string user_readable_error_name = 2; - optional string user_readable_message = 3; - optional string error_data = 4; -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.pb.ex deleted file mode 100644 index 402a550..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.pb.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.GenericOkReply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "GenericOkReply" -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.proto deleted file mode 100644 index 9e555e5..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.proto +++ /dev/null @@ -1,22 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message GenericOkReply { -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.pb.ex deleted file mode 100644 index 5ce7d09..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.pb.ex +++ /dev/null @@ -1,11 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.Publish do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Publish" - - field :topic_tokens, 1, repeated: true, type: :string, json_name: "topicTokens" - field :payload, 2, proto3_optional: true, type: :bytes - field :qos, 3, type: :int32 -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.proto deleted file mode 100644 index 6c1dfdd..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish.proto +++ /dev/null @@ -1,25 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message Publish { - repeated string topic_tokens = 1; - optional bytes payload = 2; - int32 qos = 3; -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.pb.ex deleted file mode 100644 index 31f9f9a..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.pb.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.PublishReply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "PublishReply" - - field :local_matches, 1, type: :int32, json_name: "localMatches" - field :remote_matches, 2, type: :int32, json_name: "remoteMatches" -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.proto deleted file mode 100644 index a77697b..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.proto +++ /dev/null @@ -1,24 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2020 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -message PublishReply { - int32 local_matches = 1; - int32 remote_matches = 2; -} diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.pb.ex b/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.pb.ex deleted file mode 100644 index 551fafa..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.pb.ex +++ /dev/null @@ -1,27 +0,0 @@ -defmodule Astarte.RPC.Protocol.VMQ.Plugin.Reply do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - - def fully_qualified_name, do: "Reply" - - oneof :reply, 0 - - field :version, 1, type: :int32, deprecated: true - field :error, 2, type: :bool - - field :generic_ok_reply, 3, - type: Astarte.RPC.Protocol.VMQ.Plugin.GenericOkReply, - json_name: "genericOkReply", - oneof: 0 - - field :generic_error_reply, 4, - type: Astarte.RPC.Protocol.VMQ.Plugin.GenericErrorReply, - json_name: "genericErrorReply", - oneof: 0 - - field :publish_reply, 5, - type: Astarte.RPC.Protocol.VMQ.Plugin.PublishReply, - json_name: "publishReply", - oneof: 0 -end diff --git a/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.proto b/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.proto deleted file mode 100644 index 82d76d5..0000000 --- a/lib/astarte_rpc/protocol/proto/vmq_plugin/reply.proto +++ /dev/null @@ -1,34 +0,0 @@ -// -// This file is part of Astarte. -// -// Copyright 2017 Ispirata Srl -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -import "lib/astarte_rpc/protocol/proto/vmq_plugin/generic_ok_reply.proto"; -import "lib/astarte_rpc/protocol/proto/vmq_plugin/generic_error_reply.proto"; -import "lib/astarte_rpc/protocol/proto/vmq_plugin/publish_reply.proto"; - -message Reply { - int32 version = 1 [deprecated = true]; - bool error = 2; - - oneof reply { - GenericOkReply generic_ok_reply = 3; - GenericErrorReply generic_error_reply = 4; - PublishReply publish_reply = 5; - } -} diff --git a/lib/astarte_rpc/protocol/vmq_plugin.ex b/lib/astarte_rpc/protocol/vmq_plugin.ex deleted file mode 100644 index 2f306d1..0000000 --- a/lib/astarte_rpc/protocol/vmq_plugin.ex +++ /dev/null @@ -1,21 +0,0 @@ -# -# This file is part of Astarte. -# -# Copyright 2018 Ispirata Srl -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -defmodule Astarte.RPC.Protocol.VMQ.Plugin do - use Astarte.RPC.Protocol, amqp_queue: "vmq_plugin_rpc" -end diff --git a/test/astarte/rpc/protocol/data_updater_plant_test.exs b/test/astarte/rpc/protocol/data_updater_plant_test.exs deleted file mode 100644 index b3b32cc..0000000 --- a/test/astarte/rpc/protocol/data_updater_plant_test.exs +++ /dev/null @@ -1,42 +0,0 @@ -# -# This file is part of Astarte. -# -# Copyright 2022 SECO Mind Srl -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -defmodule Astarte.RPC.Protocol.DataUpdaterPlantTest do - use ExUnit.Case - - describe "payload serialized with ExProtobuf" do - test "still works for DeleteVolatileTrigger" do - alias Astarte.RPC.Protocol.DataUpdaterPlant.DeleteVolatileTrigger - - serialized_payload = - <<10, 4, 116, 101, 115, 116, 18, 22, 73, 68, 66, 54, 50, 68, 100, 89, 83, 121, 71, 105, - 100, 50, 97, 81, 114, 100, 71, 97, 82, 81, 26, 36, 57, 48, 49, 55, 101, 100, 55, 56, 45, - 51, 99, 54, 53, 45, 52, 51, 55, 101, 45, 57, 56, 54, 98, 45, 56, 52, 55, 99, 100, 57, - 56, 53, 51, 100, 50, 98>> - - delete_trigger_call = %DeleteVolatileTrigger{ - realm_name: "test", - device_id: "IDB62DdYSyGid2aQrdGaRQ", - trigger_id: "9017ed78-3c65-437e-986b-847cd9853d2b" - } - - assert DeleteVolatileTrigger.encode(delete_trigger_call) == serialized_payload - assert DeleteVolatileTrigger.decode(serialized_payload) == delete_trigger_call - end - end -end