From 4b94c84d0925d6275d3c1972af976ad73a24f773 Mon Sep 17 00:00:00 2001 From: Gamya Date: Wed, 18 Dec 2024 01:06:16 +0530 Subject: [PATCH] feat: implement list pack registries (#144) * feat: implement list pack registries * chore: add generate target & generate models * chore: make reviewable --------- Signed-off-by: Tyler Gillson Co-authored-by: Tyler Gillson --- .pre-commit-config.yaml | 2 +- Makefile | 7 ++++++- api/models/v1_iam_roles_anywhere.go | 3 --- api/models/v1_subnet.go | 7 ++----- api/spec/palette-apis-spec.json | 12 ++---------- api/spec/palette.json | 12 ++---------- client/registry.go | 10 ++++++++++ 7 files changed, 23 insertions(+), 30 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cef64582..ed2cba2d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: conventional-pre-commit stages: [commit-msg] - repo: https://github.com/golangci/golangci-lint - rev: v1.59.1 + rev: v1.62.2 hooks: - id: golangci-lint entry: golangci-lint run --new-from-rev HEAD --whole-files --fix diff --git a/Makefile b/Makefile index 61ca597f..a4ee9ddd 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ ERR = echo ${TIME} ${RED}[ ERR ]${CNone} "error:" help: ## Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[0m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) +##@ Build Targets + +generate: ## Generate models + (cd api && ./generate.sh ./) + ##@ Static Analysis Targets check-diff: reviewable ## Execute branch is clean @@ -58,7 +63,7 @@ BIN_DIR ?= ./bin bin-dir: test -d $(BIN_DIR) || mkdir $(BIN_DIR) -GOLANGCI_VERSION ?= 1.59.1 +GOLANGCI_VERSION ?= 1.62.2 .PHONY: golangci-lint golangci-lint: bin-dir if ! test -f $(BIN_DIR)/golangci-lint-linux-amd64; then \ diff --git a/api/models/v1_iam_roles_anywhere.go b/api/models/v1_iam_roles_anywhere.go index cc2ca854..88dc241b 100644 --- a/api/models/v1_iam_roles_anywhere.go +++ b/api/models/v1_iam_roles_anywhere.go @@ -15,9 +15,6 @@ import ( // swagger:model v1IamRolesAnywhere type V1IamRolesAnywhere struct { - // AssumeRoleARN specifies the IAM role ARN to assume - AssumeRoleArn string `json:"assumeRoleArn,omitempty"` - // ProfileARN specifies the IAM profile ARN ProfileArn string `json:"profileArn,omitempty"` diff --git a/api/models/v1_subnet.go b/api/models/v1_subnet.go index 81a09e99..8768ab94 100644 --- a/api/models/v1_subnet.go +++ b/api/models/v1_subnet.go @@ -21,11 +21,8 @@ type V1Subnet struct { // name Name string `json:"name,omitempty"` - // Network security group of the subnet - NetworkSecurityGroup string `json:"networkSecurityGroup,omitempty"` - - // Resource group associated with a subnet - ResourceGroup string `json:"resourceGroup,omitempty"` + // Resource group associated with a network security group + NsgResourceGroup string `json:"nsgResourceGroup,omitempty"` // Network Security Group(NSG) to be attached to subnet. NSG for a control plane subnet, should allow inbound to port 6443, as port 6443 is used by kubeadm to bootstrap the control planes SecurityGroupName string `json:"securityGroupName,omitempty"` diff --git a/api/spec/palette-apis-spec.json b/api/spec/palette-apis-spec.json index b9f6e8f6..5474a8d2 100644 --- a/api/spec/palette-apis-spec.json +++ b/api/spec/palette-apis-spec.json @@ -42593,10 +42593,6 @@ "description": "IamRolesAnywhere specifies the IAM Roles Anywhere configuration for the AWS/EKS cluster", "type": "object", "properties": { - "assumeRoleArn": { - "description": "AssumeRoleARN specifies the IAM role ARN to assume", - "type": "string" - }, "profileArn": { "description": "ProfileARN specifies the IAM profile ARN", "type": "string" @@ -53218,12 +53214,8 @@ "name": { "type": "string" }, - "networkSecurityGroup": { - "description": "Network security group of the subnet", - "type": "string" - }, - "resourceGroup": { - "description": "Resource group associated with a subnet", + "nsgResourceGroup": { + "description": "Resource group associated with a network security group", "type": "string" }, "securityGroupName": { diff --git a/api/spec/palette.json b/api/spec/palette.json index ef73dcf3..45754d4a 100644 --- a/api/spec/palette.json +++ b/api/spec/palette.json @@ -42610,10 +42610,6 @@ "description": "IamRolesAnywhere specifies the IAM Roles Anywhere configuration for the AWS/EKS cluster", "type": "object", "properties": { - "assumeRoleArn": { - "description": "AssumeRoleARN specifies the IAM role ARN to assume", - "type": "string" - }, "profileArn": { "description": "ProfileARN specifies the IAM profile ARN", "type": "string" @@ -53235,12 +53231,8 @@ "name": { "type": "string" }, - "networkSecurityGroup": { - "description": "Network security group of the subnet", - "type": "string" - }, - "resourceGroup": { - "description": "Resource group associated with a subnet", + "nsgResourceGroup": { + "description": "Resource group associated with a network security group", "type": "string" }, "securityGroupName": { diff --git a/client/registry.go b/client/registry.go index 44dfd16d..7e2d3e5e 100644 --- a/client/registry.go +++ b/client/registry.go @@ -52,6 +52,16 @@ func (h *V1Client) GetPackRegistryByName(registryName string) (*models.V1PackReg return nil, fmt.Errorf("registry '%s' not found", registryName) } +// ListPackRegistries retries a list of all Pack registries. +func (h *V1Client) ListPackRegistries() ([]*models.V1PackRegistrySummary, error) { + params := clientv1.NewV1RegistriesPackSummaryListParamsWithContext(h.ctx) + resp, err := h.Client.V1RegistriesPackSummaryList(params) + if err != nil { + return nil, err + } + return resp.Payload.Items, nil +} + // ListHelmRegistries retrieves a list of all Helm registries, filtered by scope. func (h *V1Client) ListHelmRegistries(scope string) ([]*models.V1HelmRegistrySummary, error) { params := clientv1.NewV1RegistriesHelmSummaryListParamsWithContext(h.ctx).