Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Tweaks for consistency…
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed May 21, 2022
1 parent bb83f1c commit 02caff7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions cluster_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ func (a AgentToken) String() string {
return Stringify(a)
}

// ListProjectAgentsOptions represents the available ListProjectAgents() options.
// ListAgentsOptions represents the available ListAgents() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/cluster_agents.html#list-the-agents-for-a-project
type ListProjectAgentsOptions ListOptions
type ListAgentsOptions ListOptions

// ListProjectAgents returns a list of agents registered for the project.
// ListAgents returns a list of agents registered for the project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/cluster_agents.html#list-the-agents-for-a-project
func (s *ClusterAgentsService) ListProjectAgents(pid interface{}, opt *ListProjectAgentsOptions, options ...RequestOptionFunc) ([]*Agent, *Response, error) {
func (s *ClusterAgentsService) ListAgents(pid interface{}, opt *ListAgentsOptions, options ...RequestOptionFunc) ([]*Agent, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -131,20 +131,20 @@ func (s *ClusterAgentsService) GetAgent(pid interface{}, id int, options ...Requ
return a, resp, err
}

// RegisterProjectAgentOptions represents the available RegisterProjectAgent()
// RegisterAgentOptions represents the available RegisterAgent()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/cluster_agents.html#register-an-agent-with-a-project
type RegisterProjectAgentOptions struct {
type RegisterAgentOptions struct {
Name *string `url:"name,omitempty" json:"name,omitempty"`
}

// RegisterProjectAgent registers an agent to the project.
// RegisterAgent registers an agent to the project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/cluster_agents.html#register-an-agent-with-a-project
func (s *ClusterAgentsService) RegisterProjectAgent(pid interface{}, opt *RegisterProjectAgentOptions, options ...RequestOptionFunc) (*Agent, *Response, error) {
func (s *ClusterAgentsService) RegisterAgent(pid interface{}, opt *RegisterAgentOptions, options ...RequestOptionFunc) (*Agent, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
Expand Down
8 changes: 4 additions & 4 deletions cluster_agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func ListClusterAgents(t *testing.T) {
`)
})

opt := &ListProjectAgentsOptions{}
clusterAgents, _, err := client.ClusterAgents.ListProjectAgents(20, opt)
opt := &ListAgentsOptions{}
clusterAgents, _, err := client.ClusterAgents.ListAgents(20, opt)
if err != nil {
t.Errorf("ClusterAgents.ListClusterAgents returned error: %v", err)
}
Expand Down Expand Up @@ -185,8 +185,8 @@ func RegisterClusterAgent(t *testing.T) {
`)
})

opt := &RegisterProjectAgentOptions{Name: String("agent-1")}
clusterAgent, _, err := client.ClusterAgents.RegisterProjectAgent(20, opt)
opt := &RegisterAgentOptions{Name: String("agent-1")}
clusterAgent, _, err := client.ClusterAgents.RegisterAgent(20, opt)
if err != nil {
t.Errorf("ClusterAgents.RegisterClusterAgent returned error: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/cluster_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func clusterAgentsExample() {
projectID := 33

// Register Cluster Agent
clusterAgent, _, err := git.ClusterAgents.RegisterProjectAgent(projectID, &gitlab.RegisterProjectAgentOptions{
clusterAgent, _, err := git.ClusterAgents.RegisterAgent(projectID, &gitlab.RegisterAgentOptions{
Name: gitlab.String("agent-2"),
})
if err != nil {
Expand All @@ -42,7 +42,7 @@ func clusterAgentsExample() {
fmt.Printf("Cluster Agent: %+v\n", clusterAgent)

// List Cluster Agents
clusterAgents, _, err := git.ClusterAgents.ListProjectAgents(projectID, nil)
clusterAgents, _, err := git.ClusterAgents.ListAgents(projectID, nil)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 02caff7

Please sign in to comment.