Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: namespace's connection announcement #3508

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

heiytor
Copy link
Contributor

@heiytor heiytor commented Feb 1, 2024

The connection announcement of a namespace is a custom UTF-8 valid
string provided by the user, with a maximum length of 127 characters,
which which can be written in a SSH session.

The SSH server must decide when to write this message in an established
connection and must skip this stage if the connection announcement is an
empty string.

A user can set the connection announcement by making a PUT request to
the existing /api/namespaces/:tenant route. The announcement must
leave under's settings.connection_announcement body:

A user can set the connection announcement by making a PUT request to
the existing /api/namespaces/:tenant route. The announcement must be
placed under the settings.connection_announcement field:

{
    "settings": {
        "connection_announcement": "My awesome connection announcement"
    }
}

NOTE: An empty string can be sent in this request to disable this
feature.

To retrieve the announcement, users can make a GET request to
api/namespaces/:tenant, where the announcement will be available in
settings.connection_announcement.

To retrieve the announcement, users can make a GET request to
api/namespaces/:tenant, where the announcement will be available in
settings.connection_announcement.

There are also two important things to notice:

  1. A new method NamespaceLookup is introduced in the internal client,
    which can help the SSH session retrieve the connection announcement.
    The server must decide when to write this message in the session.

  2. A new migration with ID 64 is added to automatically set the connection
    announcement to an empty string for already existing namespaces.


Progress:

  • Edit the announcement
  • Retrieve the announcement
  • Write the announcement
  • Store/Service tests
  • Define the rules for the announcement (e.g., max length, allowed characters, etc.)
  • Define the required user role to edit the announcement (the prototype suggests owner)
  • Define the storage location for the announcement (the prototype suggests settings.connection_announcement)

@heiytor heiytor self-assigned this Feb 1, 2024
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch 12 times, most recently from 2f2f1dd to a61a4ae Compare February 5, 2024 21:13
@heiytor heiytor marked this pull request as ready for review February 5, 2024 21:14
@heiytor heiytor requested review from a team as code owners February 5, 2024 21:14
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch 6 times, most recently from a832105 to 62d9d17 Compare February 6, 2024 15:40
henrybarreto
henrybarreto previously approved these changes Feb 7, 2024
@otavio
Copy link
Member

otavio commented Feb 7, 2024

Please fix CI issues.

@heiytor
Copy link
Contributor Author

heiytor commented Feb 7, 2024

Please fix CI issues.

Fixed! It was an mock interface issue.

henrybarreto
henrybarreto previously approved these changes Feb 7, 2024
@heiytor heiytor requested a review from a team as a code owner February 8, 2024 11:51
@luannmoreira luannmoreira force-pushed the feat/namespace-connection-announcement branch 3 times, most recently from 246858d to f2a7369 Compare February 8, 2024 13:06
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch 5 times, most recently from c41fcfd to b43a0ce Compare February 9, 2024 19:04
ssh/server/handler/ssh.go Outdated Show resolved Hide resolved
ssh/server/handler/ssh.go Show resolved Hide resolved
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch from b43a0ce to d0a2805 Compare February 9, 2024 19:56
@heiytor heiytor requested a review from otavio February 9, 2024 19:57
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch 2 times, most recently from e820e96 to c0decf3 Compare February 9, 2024 20:02
@luannmoreira luannmoreira force-pushed the feat/namespace-connection-announcement branch from c0decf3 to 1d18984 Compare February 9, 2024 21:11
heiytor and others added 3 commits February 9, 2024 18:27
The connection announcement of a namespace is a custom UTF-8 valid
string provided by the user, with a maximum length of 127 characters,
which which can be written in a SSH session.

The SSH server must decide when to write this message in an established
connection and must skip this stage if the connection announcement is an
empty string.

A user can set the connection announcement by making a PUT request to
the existing `/api/namespaces/:tenant` route. The announcement must
leave under's `settings.connection_announcement` body:

A user can set the connection announcement by making a PUT request to
the existing `/api/namespaces/:tenant` route. The announcement must be
placed under the `settings.connection_announcement` field:

```json
{
    "settings": {
        "connection_announcement": "My awesome connection announcement"
    }
}
```

> NOTE: An empty string can be sent in this request to disable this
feature.

To retrieve the announcement, users can make a GET request to
`api/namespaces/:tenant`, where the announcement will be available in
`settings.connection_announcement`.

To retrieve the announcement, users can make a GET request to
`api/namespaces/:tenant`, where the announcement will be available in
`settings.connection_announcement`.

There are also two important things to notice:

1. A new method `NamespaceLookup` is introduced in the internal client,
   which can help the SSH session retrieve the connection announcement.
   The server must decide when to write this message in the session.

2. A new migration with ID 64 is added to automatically set the connection
   announcement to an empty string for already existing namespaces.
This commit is aimed to add the interface and unitary tests of the
new feature connection announcement.
@heiytor heiytor force-pushed the feat/namespace-connection-announcement branch from 1d18984 to 40dd6e9 Compare February 9, 2024 21:29
@otavio otavio merged commit 25c9147 into master Feb 9, 2024
8 checks passed
@otavio otavio deleted the feat/namespace-connection-announcement branch February 9, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants