Skip to content

Di 23858 add monitor apis#702

Closed
rbajoria26 wants to merge 18 commits intolinode:mainfrom
rbajoria26:DI-23858-add-monitor-apis
Closed

Di 23858 add monitor apis#702
rbajoria26 wants to merge 18 commits intolinode:mainfrom
rbajoria26:DI-23858-add-monitor-apis

Conversation

@rbajoria26
Copy link
Copy Markdown
Contributor

@rbajoria26 rbajoria26 commented Mar 27, 2025

📝 Description

This PR adds the monitor APIs used by the ACLP functionality

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?
The changes can be verified by running the following code:

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/linode/linodego"

	"golang.org/x/oauth2"
)

func main() {
	apiKey, ok := os.LookupEnv("LINODE_TOKEN")
	if !ok {
		log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
	}
	tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})

	oauth2Client := &http.Client{
		Transport: &oauth2.Transport{
			Source: tokenSource,
		},
	}

	linodeClient := linodego.NewClient(oauth2Client)
	linodeClient.SetDebug(true)

	res, err := linodeClient.ListMonitorServices(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", res)
}

How do I run the relevant unit/integration tests?
Run integration test as follows:

make test-int TEST_ARGS="-run TestMonitorServices_Get_smoke"
make test-int TEST_ARGS="-run TestMonitorDashboards_Get_smoke"
make fixtures TEST_ARGS="-run TestMonitorMetricDefinitions_Get_smoke"
make fixtures TEST_ARGS="-run TestMonitorServicesTokenCreation_Get_smoke"

Run unit test as follows:

make test-unit TEST_ARGS="-run TestListMonitorServices" 
make test-unit TEST_ARGS="-run TestListMonitorDashboards"
make test-unit TEST_ARGS="-run TestListMonitorMetricDefinitionsByType"
make test-unit TEST_ARGS="-run TestCreateMonitorServicesToken"

@rbajoria26 rbajoria26 marked this pull request as ready for review March 27, 2025 09:44
@rbajoria26 rbajoria26 requested a review from a team as a code owner March 27, 2025 09:44
@rbajoria26 rbajoria26 requested review from yec-akamai and zliang-akamai and removed request for a team March 27, 2025 09:44
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Thank you for starting contributing to linodego for ACLP! I reviewed the dashboard change and find there are some common issue in the implementation. Can you fix them given the comments as well as in the rest of the PR? i.e. naming, enum, etc.

Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
@rbajoria26 rbajoria26 requested a review from yec-akamai April 7, 2025 10:43
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_dashboards.go Outdated
Comment thread monitor_metrics_definitions.go Outdated
Comment thread monitor_services.go Outdated
Comment thread monitor_services_create_token.go Outdated
@rbajoria26 rbajoria26 requested a review from yec-akamai April 10, 2025 07:37
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Can you fix the issue reported by GHA?

Comment thread test/unit/monitor_dashboards_test.go
@rbajoria26 rbajoria26 requested a review from yec-akamai April 17, 2025 07:17
Copy link
Copy Markdown
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Tests passed on my end, nice work!

@rbajoria26 rbajoria26 force-pushed the DI-23858-add-monitor-apis branch from dd86bb3 to eb9d203 Compare April 17, 2025 16:07
@rbajoria26 rbajoria26 requested a review from yec-akamai April 17, 2025 16:09
rbajoria26 and others added 15 commits April 17, 2025 21:47
Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>
build(deps): bump crazy-max/ghaction-github-labeler from 5.2.0 to 5.3.0 (linode#704)

Bumps [crazy-max/ghaction-github-labeler](https://github.com/crazy-max/ghaction-github-labeler) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/crazy-max/ghaction-github-labeler/releases)
- [Commits](crazy-max/ghaction-github-labeler@31674a3...24d110a)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-github-labeler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* lke-e node pool

* lint

build(deps): bump golangci/golangci-lint-action from 6 to 7 (linode#705)

* build(deps): bump golangci/golangci-lint-action from 6 to 7

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@v6...v7)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* golangci-lint migrate

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zhiwei Liang <zliang@akamai.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>
build(deps): bump golang.org/x/net from 0.37.0 to 0.38.0 (linode#703)

* build(deps): bump golang.org/x/net from 0.37.0 to 0.38.0

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0.
- [Commits](golang/net@v0.37.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ye Chen <yechen@akamai.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>

Add option to disable cloud firewall when running integration tests (linode#712)

* add environment variable option to disable cfw

* update backup disk size

* update backup disk size
build(deps): bump github.com/jarcoal/httpmock from 1.3.1 to 1.4.0 (linode#710)

* build(deps): bump github.com/jarcoal/httpmock from 1.3.1 to 1.4.0

Bumps [github.com/jarcoal/httpmock](https://github.com/jarcoal/httpmock) from 1.3.1 to 1.4.0.
- [Release notes](https://github.com/jarcoal/httpmock/releases)
- [Commits](jarcoal/httpmock@v1.3.1...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/jarcoal/httpmock
  dependency-version: 1.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Ran make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ezilber-akamai <ezilber@akamai.com>

Update LDE capability name and tests (linode#718)

* update lde capability name and tests

* Fix failing fixture

* Fix failing fixture

* Fix failing fixture
build(deps): bump golang.org/x/net from 0.38.0 to 0.39.0 (linode#716)

* build(deps): bump golang.org/x/net from 0.38.0 to 0.39.0

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.38.0 to 0.39.0.
- [Commits](golang/net@v0.38.0...v0.39.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Ran make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ezilber-akamai <ezilber@akamai.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>

build(deps): bump golang.org/x/oauth2 from 0.28.0 to 0.29.0 (linode#709)

* build(deps): bump golang.org/x/oauth2 from 0.28.0 to 0.29.0

Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.28.0 to 0.29.0.
- [Commits](golang/oauth2@v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-version: 0.29.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zhiwei Liang <zliang@akamai.com>
@rbajoria26 rbajoria26 force-pushed the DI-23858-add-monitor-apis branch 4 times, most recently from 5be250b to 800ccff Compare April 17, 2025 16:35
@rbajoria26
Copy link
Copy Markdown
Contributor Author

#722 - created a new PR with updates, the current one got messed up

@yec-akamai
Copy link
Copy Markdown
Contributor

Close this PR in favor of #722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants