Skip to content

Commit

Permalink
Merge pull request #76 from Annopaolo/realm-update
Browse files Browse the repository at this point in the history
Add support to realm update
  • Loading branch information
rbino authored Oct 24, 2023
2 parents 9abbbb6 + 8018203 commit 22df296
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- Add support for device deletion.
- Add support to realm update.

## [1.1.0] - 2023-06-20

Expand Down
5 changes: 5 additions & 0 deletions lib/astarte_rpc/protocol/proto/housekeeping/call.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ defmodule Astarte.RPC.Protocol.Housekeeping.Call do
type: Astarte.RPC.Protocol.Housekeeping.DeleteRealm,
json_name: "deleteRealm",
oneof: 0

field :update_realm, 8,
type: Astarte.RPC.Protocol.Housekeeping.UpdateRealm,
json_name: "updateRealm",
oneof: 0
end
4 changes: 3 additions & 1 deletion lib/astarte_rpc/protocol/proto/housekeeping/call.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// This file is part of Astarte.
//
// Copyright 2017 Ispirata Srl
// 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.
Expand All @@ -24,6 +24,7 @@ import "lib/astarte_rpc/protocol/proto/housekeeping/get_realms_list.proto";
import "lib/astarte_rpc/protocol/proto/housekeeping/get_realm.proto";
import "lib/astarte_rpc/protocol/proto/housekeeping/get_health.proto";
import "lib/astarte_rpc/protocol/proto/housekeeping/delete_realm.proto";
import "lib/astarte_rpc/protocol/proto/housekeeping/update_realm.proto";

message Call {
int32 version = 1 [deprecated = true];
Expand All @@ -35,6 +36,7 @@ message Call {
GetRealm get_realm = 5;
GetHealth get_health = 6;
DeleteRealm delete_realm = 7;
UpdateRealm update_realm = 8;
}
}

38 changes: 38 additions & 0 deletions lib/astarte_rpc/protocol/proto/housekeeping/update_realm.pb.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
defmodule Astarte.RPC.Protocol.Housekeeping.UpdateRealm.DatacenterReplicationFactorsEntry do
@moduledoc false

use Protobuf, map: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto3

def fully_qualified_name, do: "UpdateRealm.DatacenterReplicationFactorsEntry"

field :key, 1, type: :string
field :value, 2, type: :int32
end

defmodule Astarte.RPC.Protocol.Housekeeping.UpdateRealm do
@moduledoc false

use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3

def fully_qualified_name, do: "UpdateRealm"

field :realm, 1, proto3_optional: true, type: :string
field :jwt_public_key_pem, 3, proto3_optional: true, type: :string, json_name: "jwtPublicKeyPem"

field :replication_factor, 4,
proto3_optional: true,
type: :int32,
json_name: "replicationFactor"

field :replication_class, 5,
proto3_optional: true,
type: Astarte.RPC.Protocol.Housekeeping.ReplicationClass,
json_name: "replicationClass",
enum: true

field :datacenter_replication_factors, 6,
repeated: true,
type: Astarte.RPC.Protocol.Housekeeping.UpdateRealm.DatacenterReplicationFactorsEntry,
json_name: "datacenterReplicationFactors",
map: true
end
29 changes: 29 additions & 0 deletions lib/astarte_rpc/protocol/proto/housekeeping/update_realm.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// 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";

import "lib/astarte_rpc/protocol/proto/housekeeping/replication_class.proto";

message UpdateRealm {
optional string realm = 1;
optional string jwt_public_key_pem = 3;
optional int32 replication_factor = 4;
optional ReplicationClass replication_class = 5;
map<string, int32> datacenter_replication_factors = 6;
}

0 comments on commit 22df296

Please sign in to comment.