Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into monitorv2-destinati…
Browse files Browse the repository at this point in the history
…on-resource
  • Loading branch information
obs-gh-owengoebel committed Jul 30, 2024
2 parents 3b83521 + 7d16fb4 commit 393895e
Show file tree
Hide file tree
Showing 25 changed files with 2,626 additions and 62 deletions.
43 changes: 39 additions & 4 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,37 @@ func (c *Client) GetMonitorV2(ctx context.Context, id string) (*meta.MonitorV2,
return c.Meta.GetMonitorV2(ctx, id)
}

func (c *Client) CreateMonitorV2Action(ctx context.Context, workspaceId string, input *meta.MonitorV2ActionInput) (*meta.MonitorV2Action, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
if c.Config.ManagingObjectID != nil {
input.ManagedById = c.Config.ManagingObjectID
}
return c.Meta.CreateMonitorV2Action(ctx, workspaceId, input)
}

func (c *Client) UpdateMonitorV2Action(ctx context.Context, id string, input *meta.MonitorV2ActionInput) (*meta.MonitorV2Action, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.UpdateMonitorV2Action(ctx, id, input)
}

func (c *Client) GetMonitorV2Action(ctx context.Context, id string) (*meta.MonitorV2Action, error) {
return c.Meta.GetMonitorV2Action(ctx, id)
}

func (c *Client) DeleteMonitorV2Action(ctx context.Context, id string) error {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.DeleteMonitorV2Action(ctx, id)
}

func (c *Client) CreateMonitorV2Destination(ctx context.Context, workspaceId string, input *meta.MonitorV2DestinationInput) (*meta.MonitorV2Destination, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
Expand All @@ -544,6 +575,10 @@ func (c *Client) UpdateMonitorV2Destination(ctx context.Context, id string, inpu
return c.Meta.UpdateMonitorV2Destination(ctx, id, input)
}

func (c *Client) GetMonitorV2Destination(ctx context.Context, id string) (*meta.MonitorV2Destination, error) {
return c.Meta.GetMonitorV2Destination(ctx, id)
}

func (c *Client) DeleteMonitorV2Destination(ctx context.Context, id string) error {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
Expand All @@ -552,8 +587,8 @@ func (c *Client) DeleteMonitorV2Destination(ctx context.Context, id string) erro
return c.Meta.DeleteMonitorV2Destination(ctx, id)
}

func (c *Client) GetMonitorV2Destination(ctx context.Context, id string) (*meta.MonitorV2Destination, error) {
return c.Meta.GetMonitorV2Destination(ctx, id)
func (c *Client) LookupMonitorV2(ctx context.Context, workspaceId *string, nameExact *string) (*meta.MonitorV2, error) {
return c.Meta.LookupMonitorV2(ctx, workspaceId, nameExact)
}

// CreateMonitorActionAttachment creates a monitor action attachment
Expand Down Expand Up @@ -745,12 +780,12 @@ func (c *Client) LookupDatastream(ctx context.Context, workspaceID string, name
}

// CreateDatastreamToken creates a datastream token
func (c *Client) CreateDatastreamToken(ctx context.Context, datastreamId string, input *meta.DatastreamTokenInput) (*meta.DatastreamToken, error) {
func (c *Client) CreateDatastreamToken(ctx context.Context, datastreamId string, input *meta.DatastreamTokenInput, password *string) (*meta.DatastreamToken, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.CreateDatastreamToken(ctx, datastreamId, input)
return c.Meta.CreateDatastreamToken(ctx, datastreamId, input, password)
}

// GetDatastreamToken by ID
Expand Down
4 changes: 2 additions & 2 deletions client/internal/meta/operation/datastream_token.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ query getDatastreamToken($id: String!) {
}
}

mutation createDatastreamToken($datastreamId: ObjectId!, $token: DatastreamTokenInput!) {
mutation createDatastreamToken($datastreamId: ObjectId!, $token: DatastreamTokenInput!, $password: String) {
# @genqlient(flatten: true)
datastreamToken: createDatastreamToken(datastreamId:$datastreamId, token: $token) {
datastreamToken: createDatastreamToken(datastreamId:$datastreamId, token: $token, password: $password) {
...DatastreamToken
}
}
Expand Down
13 changes: 9 additions & 4 deletions client/internal/meta/operation/monitorv2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ fragment MonitorV2Scheduling on MonitorV2Scheduling {
}
}

fragment MonitorV2SearchResult on MonitorV2SearchResult {
# @genqlient(flatten: true)
results {
...MonitorV2
}
}

# @genqlient(for: "MonitorV2Input.comment", omitempty: true)
# @genqlient(for: "MonitorV2Input.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2Input.description", omitempty: true)
Expand Down Expand Up @@ -271,10 +278,8 @@ mutation deleteMonitorV2($id: ObjectId!) {
}

query lookupMonitorV2($workspaceId: ObjectId, $folderId: ObjectId, $nameExact: String, $nameSubstring: String) {
# @genqlient(flatten: true)
monitorV2s: searchMonitorV2(workspaceId: $workspaceId, folderId: $folderId, nameExact: $nameExact, nameSubstring: $nameSubstring) {
# @genqlient(flatten: true)
results {
...MonitorV2
}
...MonitorV2SearchResult
}
}
134 changes: 134 additions & 0 deletions client/internal/meta/operation/monitorv2_action.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
fragment MonitorV2WebhookDestination on MonitorV2WebhookDestination {
url
method
}

fragment MonitorV2EmailDestination on MonitorV2EmailDestination {
users
addresses
}

fragment MonitorV2DestinationDefinition on MonitorV2DestinationDefinition {
inline
type
# @genqlient(flatten: true)
email {
...MonitorV2EmailDestination
}
# @genqlient(flatten: true)
webhook {
...MonitorV2WebhookDestination
}
}

fragment ActionDestinationLink on ActionDestinationLink {
destinationID
sendEndNotifications
sendRemindersInterval
# @genqlient(flatten: true)
definition {
...MonitorV2DestinationDefinition
}
}

fragment MonitorV2EmailAction on MonitorV2EmailAction {
subject
body
fragments
}

fragment MonitorV2WebhookHeader on MonitorV2WebhookHeader {
header
value
}

fragment MonitorV2WebhookAction on MonitorV2WebhookAction {
# @genqlient(flatten: true)
headers {
...MonitorV2WebhookHeader
}
body
fragments
}

fragment MonitorV2Action on MonitorV2Action {
inline
type
# @genqlient(flatten: true)
destinationLinks {
...ActionDestinationLink
}
# @genqlient(flatten: true)
email {
...MonitorV2EmailAction
}
# @genqlient(flatten: true)
webhook {
...MonitorV2WebhookAction
}
id
workspaceId
name
iconUrl
description
createdBy
createdDate
}

# @genqlient(for: "MonitorV2ActionInput.email", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.description", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.managedById", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.folderId", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.subject", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.body", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.fragments", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.headers", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.body", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.fragments", omitempty: true)
mutation createMonitorV2Action(
$workspaceId: ObjectId!,
$input: MonitorV2ActionInput!
) {
# @genqlient(flatten: true)
monitorV2Action: createMonitorV2Action(workspaceId:$workspaceId, input:$input) {
...MonitorV2Action
}
}

# @genqlient(for: "MonitorV2ActionInput.email", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.description", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.managedById", omitempty: true)
# @genqlient(for: "MonitorV2ActionInput.folderId", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.subject", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.body", omitempty: true)
# @genqlient(for: "MonitorV2EmailActionInput.fragments", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.headers", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.body", omitempty: true)
# @genqlient(for: "MonitorV2WebhookActionInput.fragments", omitempty: true)
mutation updateMonitorV2Action(
$id: ObjectId!,
$input: MonitorV2ActionInput!
) {
# @genqlient(flatten: true)
monitorV2Action: updateMonitorV2Action(id:$id, input:$input) {
...MonitorV2Action
}
}

query getMonitorV2Action($id: ObjectId!) {
# @genqlient(flatten: true)
monitorV2Action: monitorV2Action(id:$id) {
...MonitorV2Action
}
}

mutation deleteMonitorV2Action($id: ObjectId!) {
# @genqlient(flatten: true)
resultStatus: deleteMonitorV2Action(id: $id) {
...ResultStatus
}
}
10 changes: 0 additions & 10 deletions client/internal/meta/operation/monitorv2_destination.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ fragment MonitorV2Destination on MonitorV2Destination {
createdBy
}

fragment MonitorV2EmailDestination on MonitorV2EmailDestination {
users
addresses
}

fragment MonitorV2WebhookDestination on MonitorV2WebhookDestination {
url
method
}

# @genqlient(for: "MonitorV2DestinationInput.inline", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.email", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.webhook", omitempty: true)
Expand Down
2 changes: 1 addition & 1 deletion client/internal/meta/schema/datastream_token.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extend type Query {
}

extend type Mutation {
createDatastreamToken(datastreamId: ObjectId!, token: DatastreamTokenInput!): DatastreamToken!
createDatastreamToken(datastreamId: ObjectId!, token: DatastreamTokenInput!, password: String): DatastreamToken!
updateDatastreamToken(id: String!, token: DatastreamTokenInput!): DatastreamToken!
deleteDatastreamToken(id: String!): ResultStatus!
}
Expand Down
2 changes: 1 addition & 1 deletion client/internal/meta/schema/poller.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ type PollerConfluentCloudConfig implements PollerConfig @goModel(model: "observe
input PollerChunkInput @goModel(model: "observe/meta/metatypes.PollerChunkInput") {
enabled: Boolean!
size: Int64
}
}

"""
Config is mandatory, but varies based on the poller kind
Expand Down
4 changes: 2 additions & 2 deletions client/meta/datastream_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func datastreamTokenOrError(d datastreamTokenResponse, err error) (*DatastreamTo
return &result, nil
}

func (client *Client) CreateDatastreamToken(ctx context.Context, workspaceId string, input *DatastreamTokenInput) (*DatastreamToken, error) {
resp, err := createDatastreamToken(ctx, client.Gql, workspaceId, *input)
func (client *Client) CreateDatastreamToken(ctx context.Context, workspaceId string, input *DatastreamTokenInput, password *string) (*DatastreamToken, error) {
resp, err := createDatastreamToken(ctx, client.Gql, workspaceId, *input, password)
return datastreamTokenOrError(resp, err)
}

Expand Down
Loading

0 comments on commit 393895e

Please sign in to comment.