Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Column::new(
"timestamp".to_string(),
false,
move |value: &str, _row: &Map<String, Value>| {
let timestamp = value.to_string();
view! { <span class="text-gray-900">{timestamp}</span> }.into_view()
},
ColumnSortable::No,
Expandable::Disabled,
default_column_formatter,
),

timestamp is still present as the key column. Is this okay?

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module Io.Superposition.Model.ListAuditLogsInput (
setTables,
setAction,
setUsername,
setSortBy,
build,
ListAuditLogsInputBuilder,
ListAuditLogsInput,
Expand All @@ -21,7 +22,8 @@ module Io.Superposition.Model.ListAuditLogsInput (
to_date,
tables,
action,
username
username,
sort_by
) where
import qualified Control.Applicative
import qualified Control.Monad.State.Strict
Expand All @@ -35,6 +37,7 @@ import qualified Data.Text
import qualified Data.Time
import qualified GHC.Generics
import qualified GHC.Show
import qualified Io.Superposition.Model.SortBy
import qualified Io.Superposition.Utility
import qualified Network.HTTP.Types.Method

Expand All @@ -48,7 +51,8 @@ data ListAuditLogsInput = ListAuditLogsInput {
to_date :: Data.Maybe.Maybe Data.Time.UTCTime,
tables :: Data.Maybe.Maybe Data.Text.Text,
action :: Data.Maybe.Maybe Data.Text.Text,
username :: Data.Maybe.Maybe Data.Text.Text
username :: Data.Maybe.Maybe Data.Text.Text,
sort_by :: Data.Maybe.Maybe Io.Superposition.Model.SortBy.SortBy
} deriving (
GHC.Show.Show,
Data.Eq.Eq,
Expand All @@ -66,7 +70,8 @@ instance Data.Aeson.ToJSON ListAuditLogsInput where
"to_date" Data.Aeson..= to_date a,
"tables" Data.Aeson..= tables a,
"action" Data.Aeson..= action a,
"username" Data.Aeson..= username a
"username" Data.Aeson..= username a,
"sort_by" Data.Aeson..= sort_by a
]


Expand All @@ -84,6 +89,7 @@ instance Data.Aeson.FromJSON ListAuditLogsInput where
Control.Applicative.<*> (v Data.Aeson..: "tables")
Control.Applicative.<*> (v Data.Aeson..: "action")
Control.Applicative.<*> (v Data.Aeson..: "username")
Control.Applicative.<*> (v Data.Aeson..: "sort_by")



Expand All @@ -98,7 +104,8 @@ data ListAuditLogsInputBuilderState = ListAuditLogsInputBuilderState {
to_dateBuilderState :: Data.Maybe.Maybe Data.Time.UTCTime,
tablesBuilderState :: Data.Maybe.Maybe Data.Text.Text,
actionBuilderState :: Data.Maybe.Maybe Data.Text.Text,
usernameBuilderState :: Data.Maybe.Maybe Data.Text.Text
usernameBuilderState :: Data.Maybe.Maybe Data.Text.Text,
sort_byBuilderState :: Data.Maybe.Maybe Io.Superposition.Model.SortBy.SortBy
} deriving (
GHC.Generics.Generic
)
Expand All @@ -114,7 +121,8 @@ defaultBuilderState = ListAuditLogsInputBuilderState {
to_dateBuilderState = Data.Maybe.Nothing,
tablesBuilderState = Data.Maybe.Nothing,
actionBuilderState = Data.Maybe.Nothing,
usernameBuilderState = Data.Maybe.Nothing
usernameBuilderState = Data.Maybe.Nothing,
sort_byBuilderState = Data.Maybe.Nothing
}

type ListAuditLogsInputBuilder = Control.Monad.State.Strict.State ListAuditLogsInputBuilderState
Expand Down Expand Up @@ -159,6 +167,10 @@ setUsername :: Data.Maybe.Maybe Data.Text.Text -> ListAuditLogsInputBuilder ()
setUsername value =
Control.Monad.State.Strict.modify (\s -> (s { usernameBuilderState = value }))

setSortBy :: Data.Maybe.Maybe Io.Superposition.Model.SortBy.SortBy -> ListAuditLogsInputBuilder ()
setSortBy value =
Control.Monad.State.Strict.modify (\s -> (s { sort_byBuilderState = value }))

build :: ListAuditLogsInputBuilder () -> Data.Either.Either Data.Text.Text ListAuditLogsInput
build builder = do
let (_, st) = Control.Monad.State.Strict.runState builder defaultBuilderState
Expand All @@ -172,6 +184,7 @@ build builder = do
tables' <- Data.Either.Right (tablesBuilderState st)
action' <- Data.Either.Right (actionBuilderState st)
username' <- Data.Either.Right (usernameBuilderState st)
sort_by' <- Data.Either.Right (sort_byBuilderState st)
Data.Either.Right (ListAuditLogsInput {
workspace_id = workspace_id',
org_id = org_id',
Expand All @@ -182,7 +195,8 @@ build builder = do
to_date = to_date',
tables = tables',
action = action',
username = username'
username = username',
sort_by = sort_by'
})


Expand All @@ -199,6 +213,7 @@ instance Io.Superposition.Utility.IntoRequestBuilder ListAuditLogsInput where
Io.Superposition.Utility.serQuery "count" (count self)
Io.Superposition.Utility.serQuery "action" (action self)
Io.Superposition.Utility.serQuery "page" (page self)
Io.Superposition.Utility.serQuery "sort_by" (sort_by self)
Io.Superposition.Utility.serQuery "username" (username self)
Io.Superposition.Utility.serHeader "x-workspace" (workspace_id self)
Io.Superposition.Utility.serHeader "x-org-id" (org_id self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public final class ListAuditLogsInput implements SerializableStruct {
new HttpQueryTrait("action"))
.putMember("username", PreludeSchemas.STRING,
new HttpQueryTrait("username"))
.putMember("sort_by", SortBy.$SCHEMA,
new HttpQueryTrait("sort_by"))
.build();

private static final Schema $SCHEMA_WORKSPACE_ID = $SCHEMA.member("workspace_id");
Expand All @@ -57,6 +59,7 @@ public final class ListAuditLogsInput implements SerializableStruct {
private static final Schema $SCHEMA_TABLES = $SCHEMA.member("tables");
private static final Schema $SCHEMA_ACTION = $SCHEMA.member("action");
private static final Schema $SCHEMA_USERNAME = $SCHEMA.member("username");
private static final Schema $SCHEMA_SORT_BY = $SCHEMA.member("sort_by");

private final transient String workspaceId;
private final transient String orgId;
Expand All @@ -68,6 +71,7 @@ public final class ListAuditLogsInput implements SerializableStruct {
private final transient String tables;
private final transient String action;
private final transient String username;
private final transient SortBy sortBy;

private ListAuditLogsInput(Builder builder) {
this.workspaceId = builder.workspaceId;
Expand All @@ -80,6 +84,7 @@ private ListAuditLogsInput(Builder builder) {
this.tables = builder.tables;
this.action = builder.action;
this.username = builder.username;
this.sortBy = builder.sortBy;
}

public String workspaceId() {
Expand Down Expand Up @@ -137,6 +142,10 @@ public String username() {
return username;
}

public SortBy sortBy() {
return sortBy;
}

@Override
public String toString() {
return ToStringSerializer.serialize(this);
Expand All @@ -160,12 +169,13 @@ public boolean equals(Object other) {
&& Objects.equals(this.toDate, that.toDate)
&& Objects.equals(this.tables, that.tables)
&& Objects.equals(this.action, that.action)
&& Objects.equals(this.username, that.username);
&& Objects.equals(this.username, that.username)
&& Objects.equals(this.sortBy, that.sortBy);
}

@Override
public int hashCode() {
return Objects.hash(workspaceId, orgId, count, page, all, fromDate, toDate, tables, action, username);
return Objects.hash(workspaceId, orgId, count, page, all, fromDate, toDate, tables, action, username, sortBy);
}

@Override
Expand Down Expand Up @@ -201,6 +211,9 @@ public void serializeMembers(ShapeSerializer serializer) {
if (username != null) {
serializer.writeString($SCHEMA_USERNAME, username);
}
if (sortBy != null) {
serializer.writeString($SCHEMA_SORT_BY, sortBy.value());
}
}

@Override
Expand All @@ -217,6 +230,7 @@ public <T> T getMemberValue(Schema member) {
case 7 -> (T) SchemaUtils.validateSameMember($SCHEMA_TABLES, member, tables);
case 8 -> (T) SchemaUtils.validateSameMember($SCHEMA_ACTION, member, action);
case 9 -> (T) SchemaUtils.validateSameMember($SCHEMA_USERNAME, member, username);
case 10 -> (T) SchemaUtils.validateSameMember($SCHEMA_SORT_BY, member, sortBy);
default -> throw new IllegalArgumentException("Attempted to get non-existent member: " + member.id());
};
}
Expand All @@ -240,6 +254,7 @@ public Builder toBuilder() {
builder.tables(this.tables);
builder.action(this.action);
builder.username(this.username);
builder.sortBy(this.sortBy);
return builder;
}

Expand All @@ -265,6 +280,7 @@ public static final class Builder implements ShapeBuilder<ListAuditLogsInput> {
private String tables;
private String action;
private String username;
private SortBy sortBy;

private Builder() {}

Expand Down Expand Up @@ -367,6 +383,14 @@ public Builder username(String username) {
return this;
}

/**
* @return this builder.
*/
public Builder sortBy(SortBy sortBy) {
this.sortBy = sortBy;
return this;
}

@Override
public ListAuditLogsInput build() {
tracker.validate();
Expand All @@ -387,6 +411,7 @@ public void setMemberValue(Schema member, Object value) {
case 7 -> tables((String) SchemaUtils.validateSameMember($SCHEMA_TABLES, member, value));
case 8 -> action((String) SchemaUtils.validateSameMember($SCHEMA_ACTION, member, value));
case 9 -> username((String) SchemaUtils.validateSameMember($SCHEMA_USERNAME, member, value));
case 10 -> sortBy((SortBy) SchemaUtils.validateSameMember($SCHEMA_SORT_BY, member, value));
default -> ShapeBuilder.super.setMemberValue(member, value);
}
}
Expand Down Expand Up @@ -433,6 +458,7 @@ public void accept(Builder builder, Schema member, ShapeDeserializer de) {
case 7 -> builder.tables(de.readString(member));
case 8 -> builder.action(de.readString(member));
case 9 -> builder.username(de.readString(member));
case 10 -> builder.sortBy(SortBy.builder().deserializeMember(de, member).build());
default -> throw new IllegalArgumentException("Unexpected member: " + member.memberName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface ListAuditLogsCommandOutput extends ListAuditLogsOutput, __Metad
* tables: "STRING_VALUE",
* action: "STRING_VALUE",
* username: "STRING_VALUE",
* sort_by: "desc" || "asc",
* };
* const command = new ListAuditLogsCommand(input);
* const response = await client.send(command);
Expand Down
43 changes: 24 additions & 19 deletions clients/javascript/sdk/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,25 @@ export interface ApplicableVariantsOutput {
data: (Variant)[] | undefined;
}

/**
* @public
* @enum
*/
export const SortBy = {
/**
* Ascending order (A-Z, oldest first)
*/
Asc: "asc",
/**
* Descending order (Z-A, newest first)
*/
Desc: "desc",
} as const
/**
* @public
*/
export type SortBy = typeof SortBy[keyof typeof SortBy]

/**
* @public
*/
Expand Down Expand Up @@ -194,6 +213,11 @@ export interface ListAuditLogsInput {
action?: string | undefined;

username?: string | undefined;
/**
* Sort order enumeration for list operations.
* @public
*/
sort_by?: SortBy | undefined;
}

/**
Expand Down Expand Up @@ -950,25 +974,6 @@ export const DimensionMatchStrategy = {
*/
export type DimensionMatchStrategy = typeof DimensionMatchStrategy[keyof typeof DimensionMatchStrategy]

/**
* @public
* @enum
*/
export const SortBy = {
/**
* Ascending order (A-Z, oldest first)
*/
Asc: "asc",
/**
* Descending order (Z-A, newest first)
*/
Desc: "desc",
} as const
/**
* @public
*/
export type SortBy = typeof SortBy[keyof typeof SortBy]

/**
* @public
* @enum
Expand Down
1 change: 1 addition & 0 deletions clients/javascript/sdk/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ export const se_ListAuditLogsCommand = async(
[_ta]: [,input[_t]!],
[_ac]: [,input[_ac]!],
[_u]: [,input[_u]!],
[_sb]: [,input[_sb]!],
});
let body: any;
b.m("GET")
Expand Down
60 changes: 35 additions & 25 deletions clients/python/sdk/superposition_sdk/_private/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,31 @@

)

SORT_BY = Schema.collection(
id=ShapeID("io.superposition#SortBy"),
shape_type=ShapeType.ENUM,
members={
"Desc": {
"target": UNIT,
"index": 0,
"traits": [
Trait.new(id=ShapeID("smithy.api#enumValue"), value="desc"),

],
},

"Asc": {
"target": UNIT,
"index": 1,
"traits": [
Trait.new(id=ShapeID("smithy.api#enumValue"), value="asc"),

],
},

}
)

LIST_AUDIT_LOGS_INPUT = Schema.collection(
id=ShapeID("io.superposition#ListAuditLogsInput"),

Expand Down Expand Up @@ -632,6 +657,16 @@
],
},

"sort_by": {
"target": SORT_BY,
"index": 10,
"traits": [
Trait.new(id=ShapeID("smithy.api#notProperty")),
Trait.new(id=ShapeID("smithy.api#httpQuery"), value="sort_by"),

],
},

}
)

Expand Down Expand Up @@ -2923,31 +2958,6 @@
}
)

SORT_BY = Schema.collection(
id=ShapeID("io.superposition#SortBy"),
shape_type=ShapeType.ENUM,
members={
"Desc": {
"target": UNIT,
"index": 0,
"traits": [
Trait.new(id=ShapeID("smithy.api#enumValue"), value="desc"),

],
},

"Asc": {
"target": UNIT,
"index": 1,
"traits": [
Trait.new(id=ShapeID("smithy.api#enumValue"), value="asc"),

],
},

}
)

CONTEXT_FILTER_SORT_ON = Schema.collection(
id=ShapeID("io.superposition#ContextFilterSortOn"),
shape_type=ShapeType.ENUM,
Expand Down
Loading
Loading