Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Nov 13, 2024
1 parent a7d7b86 commit 5bc0005
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 78 deletions.
17 changes: 4 additions & 13 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,6 @@ const docTemplate = `{
"api.AddUploadsRequest": {
"type": "object",
"required": [
"artifacts",
"uploads"
],
"properties": {
Expand Down Expand Up @@ -3388,9 +3387,6 @@ const docTemplate = `{
},
"api.ContentUnitSearchRequest": {
"type": "object",
"required": [
"search"
],
"properties": {
"limit": {
"description": "Maximum number of records to return for the search",
Expand Down Expand Up @@ -3430,9 +3426,6 @@ const docTemplate = `{
},
"api.DetectRpmsRequest": {
"type": "object",
"required": [
"rpm_names"
],
"properties": {
"limit": {
"description": "Maximum number of records to return for the search",
Expand Down Expand Up @@ -3968,9 +3961,6 @@ const docTemplate = `{
},
"api.RepositoryIntrospectRequest": {
"type": "object",
"required": [
"reset_count"
],
"properties": {
"reset_count": {
"description": "Reset the failed introspections count",
Expand Down Expand Up @@ -4047,6 +4037,10 @@ const docTemplate = `{
},
"api.RepositoryRequest": {
"type": "object",
"required": [
"name",
"origin"
],
"properties": {
"distribution_arch": {
"description": "Architecture to restrict client usage to",
Expand Down Expand Up @@ -4642,9 +4636,6 @@ const docTemplate = `{
},
"api.SnapshotSearchRpmRequest": {
"type": "object",
"required": [
"search"
],
"properties": {
"limit": {
"description": "Maximum number of records to return for the search",
Expand Down
17 changes: 4 additions & 13 deletions api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
}
},
"required": [
"artifacts",
"uploads"
],
"type": "object"
Expand Down Expand Up @@ -62,9 +61,6 @@
"type": "array"
}
},
"required": [
"search"
],
"type": "object"
},
"api.CreateUploadRequest": {
Expand Down Expand Up @@ -107,9 +103,6 @@
"type": "array"
}
},
"required": [
"rpm_names"
],
"type": "object"
},
"api.DetectRpmsResponse": {
Expand Down Expand Up @@ -614,9 +607,6 @@
"type": "boolean"
}
},
"required": [
"reset_count"
],
"type": "object"
},
"api.RepositoryPackageGroup": {
Expand Down Expand Up @@ -732,6 +722,10 @@
"type": "string"
}
},
"required": [
"name",
"origin"
],
"type": "object"
},
"api.RepositoryResponse": {
Expand Down Expand Up @@ -1283,9 +1277,6 @@
"type": "array"
}
},
"required": [
"search"
],
"type": "object"
},
"api.TaskInfoCollectionResponse": {
Expand Down
14 changes: 7 additions & 7 deletions pkg/api/content_units.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package api

type ContentUnitListRequest struct {
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search" validate:"required"` // Search string based query to optionally filter-on
SortBy string `query:"sort_by" validate:"required"` // SortBy sets the sort order of the result
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search" validate:"required"` // Search string based query to optionally filter-on
SortBy string `query:"sort_by"` // SortBy sets the sort order of the result
}

type ContentUnitSearchRequest struct {
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
Search string `json:"search" validate:"required"` // Search string to search content unit names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
Search string `json:"search"` // Search string to search content unit names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
}

const ContentUnitSearchRequestLimitDefault int = 100
Expand Down
29 changes: 14 additions & 15 deletions pkg/api/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,19 @@ type RepositoryResponse struct {

// RepositoryRequest holds data received from request to create repository
type RepositoryRequest struct {
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
AccountID *string `json:"account_id" readonly:"true" swaggerignore:"true"` // Account ID of the owner
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true"` // Organization ID of the owner
Origin *string `json:"origin" readonly:"true"` // Origin of the repository
ContentType *string `json:"content_type" readonly:"true" swaggerignore:"true"` // Content Type (rpm) of the repository

Name *string `json:"name"` // Name of the remote yum repository
URL *string `json:"url"` // URL of the remote yum repository
DistributionVersions *[]string `json:"distribution_versions" example:"7,8"` // Versions to restrict client usage to
DistributionArch *string `json:"distribution_arch" example:"x86_64"` // Architecture to restrict client usage to
GpgKey *string `json:"gpg_key"` // GPG key for repository
MetadataVerification *bool `json:"metadata_verification"` // Verify packages
ModuleHotfixes *bool `json:"module_hotfixes"` // Disable modularity filtering on this repository
Snapshot *bool `json:"snapshot"` // Enable snapshotting and hosting of this repository
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
AccountID *string `json:"account_id" readonly:"true" swaggerignore:"true"` // Account ID of the owner
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true"` // Organization ID of the owner
Origin *string `json:"origin" readonly:"true" validate:"required"` // Origin of the repository
ContentType *string `json:"content_type" readonly:"true" swaggerignore:"true"` // Content Type (rpm) of the repository
Name *string `json:"name" validate:"required"` // Name of the remote yum repository
URL *string `json:"url"` // URL of the remote yum repository
DistributionVersions *[]string `json:"distribution_versions" example:"7,8"` // Versions to restrict client usage to
DistributionArch *string `json:"distribution_arch" example:"x86_64"` // Architecture to restrict client usage to
GpgKey *string `json:"gpg_key"` // GPG key for repository
MetadataVerification *bool `json:"metadata_verification"` // Verify packages
ModuleHotfixes *bool `json:"module_hotfixes"` // Disable modularity filtering on this repository
Snapshot *bool `json:"snapshot"` // Enable snapshotting and hosting of this repository
}

type RepositoryUpdateRequest struct {
Expand Down Expand Up @@ -147,7 +146,7 @@ func (r *RepositoryRequest) FillDefaults() {
}

type RepositoryIntrospectRequest struct {
ResetCount bool `json:"reset_count" validate:"required"` // Reset the failed introspections count
ResetCount bool `json:"reset_count"` // Reset the failed introspections count
}

type RepositoryExportRequest struct {
Expand Down
36 changes: 18 additions & 18 deletions pkg/api/rpms.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ type RepositoryRpmCollectionResponse struct {
}

type SnapshotErrataListRequest struct {
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search" validate:"required"` // Errata Id to optionally filter-on
Type []string `query:"type" validate:"required"` // Type to optionally filter-on
Severity []string `query:"severity" validate:"required"` // Severity to optionally filter-on
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search"` // Errata Id to optionally filter-on
Type []string `query:"type"` // Type to optionally filter-on
Severity []string `query:"severity"` // Severity to optionally filter-on
}

type SnapshotErrata struct {
Expand Down Expand Up @@ -59,29 +59,29 @@ type SnapshotRpmCollectionResponse struct {
}

type RepositoryRpmRequest struct {
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search" validate:"required"` // Search string based query to optionally filter-on
SortBy string `query:"sort_by" validate:"required"` // SortBy sets the sort order of the result
UUID string `param:"uuid" validate:"required"` // Identifier of the repository
Search string `query:"search"` // Search string based query to optionally filter-on
SortBy string `query:"sort_by"` // SortBy sets the sort order of the result
}

type SearchRpmRequest struct {
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
Search string `json:"search" validate:"required"` // Search string to search rpm names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
Search string `json:"search"` // Search string to search rpm names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
}

type SnapshotSearchRpmRequest struct {
UUIDs []string `json:"uuids,omitempty"` // List of Snapshot UUIDs to search
Search string `json:"search" validate:"required"` // Search string to search rpm names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
UUIDs []string `json:"uuids,omitempty"` // List of Snapshot UUIDs to search
Search string `json:"search"` // Search string to search rpm names
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
}

type DetectRpmsRequest struct {
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
RpmNames []string `json:"rpm_names" validate:"required"` // List of rpm names to search
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
URLs []string `json:"urls,omitempty"` // URLs of repositories to search
UUIDs []string `json:"uuids,omitempty"` // List of repository UUIDs to search
RpmNames []string `json:"rpm_names"` // List of rpm names to search
Limit *int `json:"limit,omitempty"` // Maximum number of records to return for the search
}

const SearchRpmRequestLimitDefault int = 100
Expand Down
20 changes: 10 additions & 10 deletions pkg/api/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (

type TemplateRequest struct {
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
Name *string `json:"name" validate:"required"` // Name of the template
Description *string `json:"description"` // Description of the template
RepositoryUUIDS []string `json:"repository_uuids" validate:"required"` // Repositories to add to the template
Arch *string `json:"arch" validate:"required"` // Architecture of the template
Version *string `json:"version" validate:"required"` // Version of the template
Date *EmptiableDate `json:"date"` // Latest date to include snapshots for
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true" validate:"required"` // Organization ID of the owner
User *string `json:"created_by" readonly:"true" swaggerignore:"true" validate:"required"` // User creating the template
UseLatest *bool `json:"use_latest"` // Use latest snapshot for all repositories in the template
Name *string `json:"name" validate:"required"` // Name of the template
Description *string `json:"description"` // Description of the template
RepositoryUUIDS []string `json:"repository_uuids" validate:"required"` // Repositories to add to the template
Arch *string `json:"arch" validate:"required"` // Architecture of the template
Version *string `json:"version" validate:"required"` // Version of the template
Date *EmptiableDate `json:"date"` // Latest date to include snapshots for
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true"` // Organization ID of the owner
User *string `json:"created_by" readonly:"true" swaggerignore:"true"` // User creating the template
UseLatest *bool `json:"use_latest"` // Use latest snapshot for all repositories in the template
}

type TemplateResponse struct {
Expand All @@ -45,7 +45,7 @@ type TemplateResponse struct {

// We use a separate struct because version and arch cannot be updated
type TemplateUpdateRequest struct {
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true" validate:"required"`
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
Name *string `json:"name"` // Name of the template
Description *string `json:"description"` // Description of the template
RepositoryUUIDS []string `json:"repository_uuids"` // Repositories to add to the template
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/uploads.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package api
import "time"

type AddUploadsRequest struct {
Uploads []Upload `json:"uploads" validate:"required"` // List of unfinished uploads
Artifacts []Artifact `json:"artifacts" validate:"required"` // List of created artifacts
Uploads []Upload `json:"uploads" validate:"required"` // List of unfinished uploads
Artifacts []Artifact `json:"artifacts"` // List of created artifacts
}

type Upload struct {
Expand Down

0 comments on commit 5bc0005

Please sign in to comment.