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: add resource_monitor_v2_destination #129

Merged
merged 19 commits into from
Aug 2, 2024
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
39 changes: 39 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,45 @@ func (c *Client) DeleteMonitorV2Action(ctx context.Context, id string) error {
return c.Meta.DeleteMonitorV2Action(ctx, id)
}

func (c *Client) SaveActionWithDestinationLinks(ctx context.Context, actionId string, destinationLinks []meta.ActionDestinationLinkInput) (*meta.MonitorV2Action, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.SaveActionWithDestinationLinks(ctx, actionId, destinationLinks)
}

func (c *Client) CreateMonitorV2Destination(ctx context.Context, workspaceId string, input *meta.MonitorV2DestinationInput) (*meta.MonitorV2Destination, 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.CreateMonitorV2Destination(ctx, workspaceId, input)
}

func (c *Client) UpdateMonitorV2Destination(ctx context.Context, id string, input *meta.MonitorV2DestinationInput) (*meta.MonitorV2Destination, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
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()
defer c.obs2110.Unlock()
}
return c.Meta.DeleteMonitorV2Destination(ctx, id)
}

func (c *Client) LookupMonitorV2(ctx context.Context, workspaceId *string, nameExact *string) (*meta.MonitorV2, error) {
return c.Meta.LookupMonitorV2(ctx, workspaceId, nameExact)
}
Expand Down
80 changes: 80 additions & 0 deletions client/internal/meta/operation/monitorv2_destination.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
fragment MonitorV2Destination on MonitorV2Destination {
inline
type
# @genqlient(flatten: true)
email {
...MonitorV2EmailDestination
}
# @genqlient(flatten: true)
webhook {
...MonitorV2WebhookDestination
}
id
workspaceId
name
iconUrl
description
createdBy
}

# @genqlient(for: "MonitorV2DestinationInput.inline", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.email", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.users", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.addresses", omitempty: true)
mutation createMonitorV2Destination(
$workspaceId: ObjectId!,
$input: MonitorV2DestinationInput!
) {
# @genqlient(flatten: true)
monitorV2Destination: createMonitorV2Destination(workspaceId: $workspaceId, input: $input) {
...MonitorV2Destination
}
}

# @genqlient(for: "MonitorV2DestinationInput.inline", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.email", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.webhook", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2DestinationInput.description", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.users", omitempty: true)
# @genqlient(for: "MonitorV2EmailDestinationInput.addresses", omitempty: true)
mutation updateMonitorV2Destination(
$id: ObjectId!,
$input: MonitorV2DestinationInput!
) {
# @genqlient(flatten: true)
monitorV2Destination: updateMonitorV2Destination(id: $id, input: $input) {
...MonitorV2Destination
}
}

query getMonitorV2Destination($id: ObjectId!) {
# @genqlient(flatten: true)
monitorV2Destination: monitorV2Destination(id: $id) {
...MonitorV2Destination
}
}

mutation deleteMonitorV2Destination($id: ObjectId!) {
# @genqlient(flatten: true)
resultStatus: deleteMonitorV2Destination(id: $id) {
...ResultStatus
}
}

# @genqlient(for: "ActionDestinationLinkInput.sendEndNotifications", omitempty: true)
# @genqlient(for: "ActionDestinationLinkInput.sendRemindersInterval", omitempty: true)
mutation saveActionWithDestinationLinks(
$actionId: ObjectId!,
$destinationLinks: [ActionDestinationLinkInput!]!
) {
# @genqlient(flatten: true)
monitorV2Action: saveActionWithDestinationLinks(actionId: $actionId, destinationLinks: $destinationLinks) {
...MonitorV2Action
}
}
Loading
Loading