diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 533e9a691..c6835fba2 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -16,7 +16,7 @@ npm ci # Install the tsp cli # pinned to the last working version combination -npm install -g @typespec/compiler@0.55.0 +npm install -g @typespec/compiler@0.56.0 # Install azure/oav for validation of openapi and swagger example generation # https://github.com/Azure/oav diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 961769121..7e18ab2c2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,8 +11,6 @@ updates: typespec: patterns: - '@typespec/*' - azure-tools: - patterns: - '@azure-tools/*' schedule: interval: 'weekly' diff --git a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp index 7b6b7b18b..d96bc6906 100644 --- a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp +++ b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp @@ -28,7 +28,7 @@ model HcpOpenShiftClusterResource @segment("hcpOpenShiftClusters") name: string; - ...ManagedServiceIdentity; + ...ManagedServiceIdentityProperty; } // The NodePool needs to be TrackedResource for the following reasons: diff --git a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json index 412f3e8ec..d9e012c6c 100644 --- a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json +++ b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json @@ -2162,24 +2162,6 @@ } } }, - "Versions": { - "type": "string", - "description": "The available API versions.", - "enum": [ - "2024-06-10-preview" - ], - "x-ms-enum": { - "name": "Versions", - "modelAsString": true, - "values": [ - { - "name": "v2024_06_10_preview", - "value": "2024-06-10-preview", - "description": "2024-06-10-preview version" - } - ] - } - }, "Visibility": { "type": "string", "description": "The visibility of the API server", diff --git a/dev-infrastructure/modules/aks-cluster-base.bicep b/dev-infrastructure/modules/aks-cluster-base.bicep index ff72afe11..81ef99811 100644 --- a/dev-infrastructure/modules/aks-cluster-base.bicep +++ b/dev-infrastructure/modules/aks-cluster-base.bicep @@ -395,7 +395,7 @@ module serviceAccounts './aks-manifest.bicep' = { apiVersion: 'v1' kind: 'ServiceAccount' metadata: { - name: workloadIdentities[i].value.uamiName + name: workloadIdentities[i].value.serviceAccountName namespace: workloadIdentities[i].value.namespace annotations: { 'azure.workload.identity/client-id': uami[i].properties.clientId diff --git a/dev-infrastructure/modules/aks-manifest.bicep b/dev-infrastructure/modules/aks-manifest.bicep index c1e9aae5a..6ecb5b3bb 100644 --- a/dev-infrastructure/modules/aks-manifest.bicep +++ b/dev-infrastructure/modules/aks-manifest.bicep @@ -3,15 +3,18 @@ param aksClusterName string param location string param aksManagedIdentityId string param manifests array +param forceUpdateTag string = guid(string(manifests)) -var namespaces = [for manifest in manifests: manifest.metadata.namespace] +var namespaces = [ + for manifest in filter(manifests, m => contains(m.metadata, 'namespace')): manifest.metadata.namespace +] var uniqueNamespaces = union(namespaces, []) var namespaceManifests = [ - for i in range(0, length(uniqueNamespaces)): { + for ns in uniqueNamespaces: { apiVersion: 'v1' kind: 'Namespace' metadata: { - name: uniqueNamespaces[i] + name: ns } } ] @@ -54,6 +57,7 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@2023-08-01' = { // * avoid the need for a network path to the cluster // // right now az aks command invoke fails with `MissingAADClusterToken` when run within a deploymentscript + forceUpdateTag: forceUpdateTag environmentVariables: [ { name: 'AKS_CLUSTER_RG' diff --git a/internal/api/v20240610preview/generated_constants.go b/internal/api/v20240610preview/generated_constants.go index 41a37e922..7bcd6e146 100644 --- a/internal/api/v20240610preview/generated_constants.go +++ b/internal/api/v20240610preview/generated_constants.go @@ -160,21 +160,6 @@ func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { } } -// Versions - The available API versions. -type Versions string - -const ( - // VersionsV20240610Preview - 2024-06-10-preview version - VersionsV20240610Preview Versions = "2024-06-10-preview" -) - -// PossibleVersionsValues returns the possible values for the Versions const type. -func PossibleVersionsValues() []Versions { - return []Versions{ - VersionsV20240610Preview, - } -} - // Visibility - The visibility of the API server type Visibility string diff --git a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go b/internal/api/v20240610preview/hcpopenshiftclusters_methods.go deleted file mode 100644 index 2842ee8de..000000000 --- a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go +++ /dev/null @@ -1,520 +0,0 @@ -package v20240610preview - -// Copyright (c) Microsoft Corporation. -// Licensed under the Apache License 2.0. - -import ( - "net/http" - - configv1 "github.com/openshift/api/config/v1" - - "github.com/Azure/ARO-HCP/internal/api" - "github.com/Azure/ARO-HCP/internal/api/arm" -) - -func newVersionProfile(from *api.VersionProfile) *VersionProfile { - return &VersionProfile{ - ID: api.Ptr(from.ID), - ChannelGroup: api.Ptr(from.ChannelGroup), - AvailableUpgrades: api.StringSliceToStringPtrSlice(from.AvailableUpgrades), - } -} - -func newDNSProfile(from *api.DNSProfile) *DNSProfile { - return &DNSProfile{ - BaseDomain: api.Ptr(from.BaseDomain), - BaseDomainPrefix: api.Ptr(from.BaseDomainPrefix), - } -} - -func newNetworkProfile(from *api.NetworkProfile) *NetworkProfile { - return &NetworkProfile{ - NetworkType: api.Ptr(NetworkType(from.NetworkType)), - PodCidr: api.Ptr(from.PodCIDR), - ServiceCidr: api.Ptr(from.ServiceCIDR), - MachineCidr: api.Ptr(from.MachineCIDR), - HostPrefix: api.Ptr(from.HostPrefix), - } -} - -func newConsoleProfile(from *api.ConsoleProfile) *ConsoleProfile { - return &ConsoleProfile{ - URL: api.Ptr(from.URL), - } -} - -func newAPIProfile(from *api.APIProfile) *APIProfile { - return &APIProfile{ - URL: api.Ptr(from.URL), - IP: api.Ptr(from.IP), - Visibility: api.Ptr(Visibility(from.Visibility)), - } -} - -func newProxyProfile(from *api.ProxyProfile) *ProxyProfile { - return &ProxyProfile{ - HTTPProxy: api.Ptr(from.HTTPProxy), - HTTPSProxy: api.Ptr(from.HTTPSProxy), - NoProxy: api.Ptr(from.NoProxy), - TrustedCa: api.Ptr(from.TrustedCA), - } -} - -func newPlatformProfile(from *api.PlatformProfile) *PlatformProfile { - return &PlatformProfile{ - ManagedResourceGroup: api.Ptr(from.ManagedResourceGroup), - SubnetID: api.Ptr(from.SubnetID), - OutboundType: api.Ptr(OutboundType(from.OutboundType)), - NetworkSecurityGroupID: api.Ptr(from.NetworkSecurityGroupID), - EtcdEncryptionSetID: api.Ptr(from.EtcdEncryptionSetID), - } -} - -func newIngressProfile(from *api.IngressProfile) *IngressProfile { - return &IngressProfile{ - IP: api.Ptr(from.IP), - URL: api.Ptr(from.URL), - Visibility: api.Ptr(Visibility(from.Visibility)), - } -} - -func newExternalAuthProfile(from *configv1.OIDCProvider) *ExternalAuthProfile { - out := &ExternalAuthProfile{ - Issuer: &TokenIssuerProfile{ - URL: api.Ptr(from.Issuer.URL), - Audiences: make([]*string, len(from.Issuer.Audiences)), - Ca: api.Ptr(from.Issuer.CertificateAuthority.Name), - }, - Clients: make([]*ExternalAuthClientProfile, len(from.OIDCClients)), - Claim: &ExternalAuthClaimProfile{ - Mappings: &TokenClaimMappingsProfile{ - Username: &ClaimProfile{ - Claim: api.Ptr(from.ClaimMappings.Username.Claim), - PrefixPolicy: api.Ptr(string(from.ClaimMappings.Username.PrefixPolicy)), - }, - Groups: &ClaimProfile{ - Claim: api.Ptr(from.ClaimMappings.Groups.Claim), - Prefix: api.Ptr(from.ClaimMappings.Groups.Prefix), - }, - }, - ValidationRules: make([]*TokenClaimValidationRuleProfile, len(from.ClaimValidationRules)), - }, - } - - for index, item := range from.Issuer.Audiences { - out.Issuer.Audiences[index] = api.Ptr(string(item)) - } - - for index, item := range from.OIDCClients { - out.Clients[index] = newExternalAuthClientProfile(item) - } - - if from.ClaimMappings.Username.Prefix != nil { - out.Claim.Mappings.Username.Prefix = api.Ptr(from.ClaimMappings.Username.Prefix.PrefixString) - } - - for index, item := range from.ClaimValidationRules { - out.Claim.ValidationRules[index] = newTokenClaimValidationRuleProfile(item) - } - - return out -} - -func newTokenClaimValidationRuleProfile(from configv1.TokenClaimValidationRule) *TokenClaimValidationRuleProfile { - if from.RequiredClaim == nil { - // Should never happen since we create these rules. - panic("TokenClaimValidationRule has no RequiredClaim") - } - - return &TokenClaimValidationRuleProfile{ - Claim: api.Ptr(from.RequiredClaim.Claim), - RequiredValue: api.Ptr(from.RequiredClaim.RequiredValue), - } -} - -func newExternalAuthClientProfile(from configv1.OIDCClientConfig) *ExternalAuthClientProfile { - return &ExternalAuthClientProfile{ - Component: &ExternalAuthClientComponentProfile{ - Name: api.Ptr(from.ComponentName), - AuthClientNamespace: api.Ptr(from.ComponentNamespace), - }, - ID: api.Ptr(from.ClientID), - Secret: api.Ptr(from.ClientSecret.Name), - ExtraScopes: api.StringSliceToStringPtrSlice(from.ExtraScopes), - } -} - -func (v version) NewHCPOpenShiftCluster(from *api.HCPOpenShiftCluster) api.VersionedHCPOpenShiftCluster { - if from == nil { - from = api.NewDefaultHCPOpenShiftCluster() - } - - out := &HcpOpenShiftClusterResource{ - ID: api.Ptr(from.Resource.ID), - Name: api.Ptr(from.Resource.Name), - Type: api.Ptr(from.Resource.Type), - Location: api.Ptr(from.TrackedResource.Location), - Tags: map[string]*string{}, - // FIXME Skipping ManagedServiceIdentity - Properties: &HcpOpenShiftClusterProperties{ - ProvisioningState: api.Ptr(ProvisioningState(from.Properties.ProvisioningState)), - Spec: &ClusterSpec{ - Version: newVersionProfile(&from.Properties.Spec.Version), - DNS: newDNSProfile(&from.Properties.Spec.DNS), - Network: newNetworkProfile(&from.Properties.Spec.Network), - Console: newConsoleProfile(&from.Properties.Spec.Console), - API: newAPIProfile(&from.Properties.Spec.API), - Fips: api.Ptr(from.Properties.Spec.FIPS), - EtcdEncryption: api.Ptr(from.Properties.Spec.EtcdEncryption), - DisableUserWorkloadMonitoring: api.Ptr(from.Properties.Spec.DisableUserWorkloadMonitoring), - Proxy: newProxyProfile(&from.Properties.Spec.Proxy), - Platform: newPlatformProfile(&from.Properties.Spec.Platform), - IssuerURL: api.Ptr(from.Properties.Spec.IssuerURL), - ExternalAuth: &ExternalAuthConfigProfile{ - Enabled: api.Ptr(from.Properties.Spec.ExternalAuth.Enabled), - ExternalAuths: make([]*ExternalAuthProfile, len(from.Properties.Spec.ExternalAuth.ExternalAuths)), - }, - Ingress: make([]*IngressProfile, len(from.Properties.Spec.Ingress)), - }, - }, - } - - if from.Resource.SystemData != nil { - out.SystemData = &SystemData{ - CreatedBy: api.Ptr(from.Resource.SystemData.CreatedBy), - CreatedByType: api.Ptr(CreatedByType(from.Resource.SystemData.CreatedByType)), - CreatedAt: from.Resource.SystemData.CreatedAt, - LastModifiedBy: api.Ptr(from.Resource.SystemData.LastModifiedBy), - LastModifiedByType: api.Ptr(CreatedByType(from.Resource.SystemData.LastModifiedByType)), - LastModifiedAt: from.Resource.SystemData.LastModifiedAt, - } - } - - for key, val := range from.TrackedResource.Tags { - out.Tags[key] = api.Ptr(val) - } - - for index, item := range from.Properties.Spec.ExternalAuth.ExternalAuths { - out.Properties.Spec.ExternalAuth.ExternalAuths[index] = newExternalAuthProfile(item) - } - - for index, item := range from.Properties.Spec.Ingress { - out.Properties.Spec.Ingress[index] = newIngressProfile(item) - } - - return out -} - -func (c *HcpOpenShiftClusterResource) Normalize(out *api.HCPOpenShiftCluster) { - if c.ID != nil { - out.Resource.ID = *c.ID - } - if c.Name != nil { - out.Resource.Name = *c.Name - } - if c.Type != nil { - out.Resource.Type = *c.Type - } - if c.SystemData != nil { - out.Resource.SystemData = &arm.SystemData{ - CreatedAt: c.SystemData.CreatedAt, - LastModifiedAt: c.SystemData.LastModifiedAt, - } - if c.SystemData.CreatedBy != nil { - out.Resource.SystemData.CreatedBy = *c.SystemData.CreatedBy - } - if c.SystemData.CreatedByType != nil { - out.Resource.SystemData.CreatedByType = arm.CreatedByType(*c.SystemData.CreatedByType) - } - if c.SystemData.LastModifiedBy != nil { - out.Resource.SystemData.LastModifiedBy = *c.SystemData.LastModifiedBy - } - if c.SystemData.LastModifiedByType != nil { - out.Resource.SystemData.LastModifiedByType = arm.CreatedByType(*c.SystemData.LastModifiedByType) - } - } - // FIXME Skipping ManagedServiceIdentity - if c.Location != nil { - out.TrackedResource.Location = *c.Location - } - out.Tags = make(map[string]string) - for k, v := range c.Tags { - if v != nil { - out.Tags[k] = *v - } - } - if c.Properties != nil { - if c.Properties.ProvisioningState != nil { - out.Properties.ProvisioningState = arm.ProvisioningState(*c.Properties.ProvisioningState) - } - if c.Properties.Spec != nil { - if c.Properties.Spec.Version != nil { - c.Properties.Spec.Version.Normalize(&out.Properties.Spec.Version) - } - if c.Properties.Spec.DNS != nil { - c.Properties.Spec.DNS.Normalize(&out.Properties.Spec.DNS) - } - if c.Properties.Spec.Network != nil { - c.Properties.Spec.Network.Normalize(&out.Properties.Spec.Network) - } - if c.Properties.Spec.Console != nil { - c.Properties.Spec.Console.Normalize(&out.Properties.Spec.Console) - } - if c.Properties.Spec.API != nil { - c.Properties.Spec.API.Normalize(&out.Properties.Spec.API) - } - if c.Properties.Spec.Fips != nil { - out.Properties.Spec.FIPS = *c.Properties.Spec.Fips - } - if c.Properties.Spec.EtcdEncryption != nil { - out.Properties.Spec.EtcdEncryption = *c.Properties.Spec.EtcdEncryption - } - if c.Properties.Spec.DisableUserWorkloadMonitoring != nil { - out.Properties.Spec.DisableUserWorkloadMonitoring = *c.Properties.Spec.DisableUserWorkloadMonitoring - } - if c.Properties.Spec.Proxy != nil { - c.Properties.Spec.Proxy.Normalize(&out.Properties.Spec.Proxy) - } - if c.Properties.Spec.Platform != nil { - c.Properties.Spec.Platform.Normalize(&out.Properties.Spec.Platform) - } - if c.Properties.Spec.IssuerURL != nil { - out.Properties.Spec.IssuerURL = *c.Properties.Spec.IssuerURL - } - if c.Properties.Spec.ExternalAuth != nil { - c.Properties.Spec.ExternalAuth.Normalize(&out.Properties.Spec.ExternalAuth) - } - ingressSequence := api.DeleteNilsFromPtrSlice(c.Properties.Spec.Ingress) - out.Properties.Spec.Ingress = make([]*api.IngressProfile, len(ingressSequence)) - for index, item := range ingressSequence { - out.Properties.Spec.Ingress[index] = &api.IngressProfile{} - item.Normalize(out.Properties.Spec.Ingress[index]) - } - } - } -} - -func (c *HcpOpenShiftClusterResource) ValidateStatic(current api.VersionedHCPOpenShiftCluster, updating bool, method string) *arm.CloudError { - var normalized api.HCPOpenShiftCluster - var errorDetails []arm.CloudErrorBody - - cloudError := arm.NewCloudError( - http.StatusBadRequest, - arm.CloudErrorCodeMultipleErrorsOccurred, "", - "Content validation failed on multiple fields") - cloudError.Details = make([]arm.CloudErrorBody, 0) - - errorDetails = api.ValidateVisibility(c, current, clusterStructTagMap, updating) - if errorDetails != nil { - cloudError.Details = append(cloudError.Details, errorDetails...) - } - - c.Normalize(&normalized) - - errorDetails = api.ValidateRequest(validate, method, &normalized) - if errorDetails != nil { - cloudError.Details = append(cloudError.Details, errorDetails...) - } - - switch len(cloudError.Details) { - case 0: - cloudError = nil - case 1: - // Promote a single validation error out of details. - cloudError.CloudErrorBody = &cloudError.Details[0] - } - - return cloudError -} - -func (p *VersionProfile) Normalize(out *api.VersionProfile) { - if p.ID != nil { - out.ID = *p.ID - } - if p.ChannelGroup != nil { - out.ChannelGroup = *p.ChannelGroup - } - out.AvailableUpgrades = api.StringPtrSliceToStringSlice(p.AvailableUpgrades) -} - -func (p *DNSProfile) Normalize(out *api.DNSProfile) { - if p.BaseDomain != nil { - out.BaseDomain = *p.BaseDomain - } - if p.BaseDomainPrefix != nil { - out.BaseDomainPrefix = *p.BaseDomainPrefix - } -} - -func (p *NetworkProfile) Normalize(out *api.NetworkProfile) { - if p.NetworkType != nil { - out.NetworkType = api.NetworkType(*p.NetworkType) - } - if p.PodCidr != nil { - out.PodCIDR = *p.PodCidr - } - if p.ServiceCidr != nil { - out.ServiceCIDR = *p.ServiceCidr - } - if p.MachineCidr != nil { - out.MachineCIDR = *p.MachineCidr - } - if p.HostPrefix != nil { - out.HostPrefix = *p.HostPrefix - } -} - -func (p *ConsoleProfile) Normalize(out *api.ConsoleProfile) { - if p.URL != nil { - out.URL = *p.URL - } -} - -func (p *APIProfile) Normalize(out *api.APIProfile) { - if p.URL != nil { - out.URL = *p.URL - } - if p.IP != nil { - out.IP = *p.IP - } - if p.Visibility != nil { - out.Visibility = api.Visibility(*p.Visibility) - } -} - -func (p *ProxyProfile) Normalize(out *api.ProxyProfile) { - if p.HTTPProxy != nil { - out.HTTPProxy = *p.HTTPProxy - } - if p.HTTPSProxy != nil { - out.HTTPSProxy = *p.HTTPSProxy - } - if p.NoProxy != nil { - out.NoProxy = *p.NoProxy - } - if p.TrustedCa != nil { - out.TrustedCA = *p.TrustedCa - } -} - -func (p *PlatformProfile) Normalize(out *api.PlatformProfile) { - if p.ManagedResourceGroup != nil { - out.ManagedResourceGroup = *p.ManagedResourceGroup - } - if p.SubnetID != nil { - out.SubnetID = *p.SubnetID - } - if p.OutboundType != nil { - out.OutboundType = api.OutboundType(*p.OutboundType) - } - if p.NetworkSecurityGroupID != nil { - out.NetworkSecurityGroupID = *p.NetworkSecurityGroupID - } - if p.EtcdEncryptionSetID != nil { - out.EtcdEncryptionSetID = *p.EtcdEncryptionSetID - } -} - -func (p *ExternalAuthConfigProfile) Normalize(out *api.ExternalAuthConfigProfile) { - if p.Enabled != nil { - out.Enabled = *p.Enabled - } - out.ExternalAuths = []*configv1.OIDCProvider{} - for _, item := range api.DeleteNilsFromPtrSlice(p.ExternalAuths) { - provider := &configv1.OIDCProvider{} - - if item.Issuer != nil { - if item.Issuer.URL != nil { - provider.Issuer.URL = *item.Issuer.URL - } - provider.Issuer.Audiences = make([]configv1.TokenAudience, len(item.Issuer.Audiences)) - for index, audience := range item.Issuer.Audiences { - if audience != nil { - provider.Issuer.Audiences[index] = configv1.TokenAudience(*audience) - } - } - if item.Issuer.Ca != nil { - // Slight misuse of the field. It's meant to name a config map holding a - // "ca-bundle.crt" key, whereas we store the data directly in the Name field. - provider.Issuer.CertificateAuthority = configv1.ConfigMapNameReference{ - Name: *item.Issuer.Ca, - } - } - } - - clientSequence := api.DeleteNilsFromPtrSlice(item.Clients) - provider.OIDCClients = make([]configv1.OIDCClientConfig, len(clientSequence)) - for index, client := range clientSequence { - if client.Component != nil { - if client.Component.Name != nil { - provider.OIDCClients[index].ComponentName = *client.Component.Name - } - if client.Component.AuthClientNamespace != nil { - provider.OIDCClients[index].ComponentNamespace = *client.Component.AuthClientNamespace - } - } - if client.ID != nil { - provider.OIDCClients[index].ClientID = *client.ID - } - if client.Secret != nil { - // Slight misuse of the field. It's meant to name a secret holding a - // "clientSecret" key, whereas we store the data directly in the Name field. - provider.OIDCClients[index].ClientSecret.Name = *client.Secret - } - provider.OIDCClients[index].ExtraScopes = api.StringPtrSliceToStringSlice(client.ExtraScopes) - } - - if item.Claim != nil { - if item.Claim.Mappings != nil { - if item.Claim.Mappings.Username != nil { - if item.Claim.Mappings.Username.Claim != nil { - provider.ClaimMappings.Username.TokenClaimMapping.Claim = *item.Claim.Mappings.Username.Claim - } - if item.Claim.Mappings.Username.PrefixPolicy != nil { - provider.ClaimMappings.Username.PrefixPolicy = configv1.UsernamePrefixPolicy(*item.Claim.Mappings.Username.PrefixPolicy) - } - if item.Claim.Mappings.Username.Prefix != nil { - provider.ClaimMappings.Username.Prefix.PrefixString = *item.Claim.Mappings.Username.Prefix - } - } - if item.Claim.Mappings.Groups != nil { - if item.Claim.Mappings.Groups.Claim != nil { - provider.ClaimMappings.Groups.TokenClaimMapping.Claim = *item.Claim.Mappings.Groups.Claim - } - if item.Claim.Mappings.Groups.Prefix != nil { - provider.ClaimMappings.Groups.Prefix = *item.Claim.Mappings.Groups.Prefix - } - } - } - } - - validationRuleSequence := api.DeleteNilsFromPtrSlice(item.Claim.ValidationRules) - provider.ClaimValidationRules = make([]configv1.TokenClaimValidationRule, len(validationRuleSequence)) - for index, rule := range validationRuleSequence { - provider.ClaimValidationRules[index] = configv1.TokenClaimValidationRule{ - Type: configv1.TokenValidationRuleTypeRequiredClaim, - RequiredClaim: &configv1.TokenRequiredClaim{}, - } - if rule.Claim != nil { - provider.ClaimValidationRules[index].RequiredClaim.Claim = *rule.Claim - } - if rule.RequiredValue != nil { - provider.ClaimValidationRules[index].RequiredClaim.RequiredValue = *rule.RequiredValue - } - } - - out.ExternalAuths = append(out.ExternalAuths, provider) - } -} - -func (p *IngressProfile) Normalize(out *api.IngressProfile) { - if p.IP != nil { - out.IP = *p.IP - } - if p.URL != nil { - out.URL = *p.URL - } - if p.Visibility != nil { - out.Visibility = api.Visibility(*p.Visibility) - } -} diff --git a/internal/api/v20240610preview/register.go b/internal/api/v20240610preview/register.go deleted file mode 100644 index 6fe20cf03..000000000 --- a/internal/api/v20240610preview/register.go +++ /dev/null @@ -1,58 +0,0 @@ -package v20240610preview - -// Copyright (c) Microsoft Corporation. -// Licensed under the Apache License 2.0. - -import ( - "fmt" - "strings" - - "github.com/Azure/ARO-HCP/internal/api" -) - -type version struct{} - -// String returns the api-version parameter value for this API. -func (v version) String() string { - return "2024-06-10-preview" -} - -var ( - validate = api.NewValidator() - clusterStructTagMap = api.NewStructTagMap[api.HCPOpenShiftCluster]() -) - -func EnumValidateTag[S ~string](values ...S) string { - s := make([]string, len(values)) - for i, e := range values { - s[i] = string(e) - } - return fmt.Sprintf("oneof=%s", strings.Join(s, " ")) -} - -func init() { - // NOTE: If future versions of the API expand field visibility, such as - // a field with @visibility("read","create") becoming updatable, - // then earlier versions of the API will need to override their - // StructTagMap to maintain the original visibility flags. This - // is where such overrides should happen, along with a comment - // about what changed and when. For example: - // - // // This field became updatable in version YYYY-MM-DD. - // clusterStructTagMap["Properties.Spec.FieldName"] = reflect.StructTag("visibility:\"read create\"") - // - - api.Register(version{}) - - // Register enum type validations - validate.RegisterAlias("enum_actiontype", EnumValidateTag(PossibleActionTypeValues()...)) - validate.RegisterAlias("enum_createdbytype", EnumValidateTag(PossibleCreatedByTypeValues()...)) - validate.RegisterAlias("enum_managedserviceidentitytype", EnumValidateTag(PossibleManagedServiceIdentityTypeValues()...)) - validate.RegisterAlias("enum_networktype", EnumValidateTag(PossibleNetworkTypeValues()...)) - validate.RegisterAlias("enum_origin", EnumValidateTag(PossibleOriginValues()...)) - validate.RegisterAlias("enum_outboundtype", EnumValidateTag(PossibleOutboundTypeValues()...)) - validate.RegisterAlias("enum_provisioningstate", EnumValidateTag(PossibleProvisioningStateValues()...)) - validate.RegisterAlias("enum_resourceprovisioningstate", EnumValidateTag(PossibleResourceProvisioningStateValues()...)) - validate.RegisterAlias("enum_versions", EnumValidateTag(PossibleVersionsValues()...)) - validate.RegisterAlias("enum_visibility", EnumValidateTag(PossibleVisibilityValues()...)) -} diff --git a/package-lock.json b/package-lock.json index db0240519..3cf13c3a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,81 +5,85 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-autorest": "^0.41.1", - "@azure-tools/typespec-azure-core": "^0.41.0", - "@azure-tools/typespec-azure-resource-manager": "^0.41.0", - "@typespec/http": "^0.55.0", - "@typespec/openapi": "^0.55.0", - "@typespec/openapi3": "^0.55.0", - "@typespec/rest": "^0.55.0", - "@typespec/versioning": "^0.55.0" + "@azure-tools/typespec-autorest": "^0.42.0", + "@azure-tools/typespec-azure-core": "^0.42.0", + "@azure-tools/typespec-azure-resource-manager": "^0.42.0", + "@typespec/http": "^0.56.0", + "@typespec/openapi": "^0.56.0", + "@typespec/openapi3": "^0.56.0", + "@typespec/rest": "^0.56.0", + "@typespec/versioning": "^0.56.0" } }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.41.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.41.1.tgz", - "integrity": "sha512-m2Rq8aFMvICfkG/+B1kGSDepCUDHhiQ93y1/IcE+XU1+IU2iuNoSgUd0lHgksP5Aqnvs3Wm9JDmA9nMNjOM1Ww==", + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.42.0.tgz", + "integrity": "sha512-3cB5SiIbRDvGXpadnxwqsNhQ4A9pteGTHIpVlKpENpvzIoWU9phe+uBmGJDiQ/9CQPiLk7JncER95XYVOvn/vA==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.41.0", - "@azure-tools/typespec-client-generator-core": "~0.41.1", - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/openapi": "~0.55.0", - "@typespec/rest": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@azure-tools/typespec-azure-core": "~0.42.0", + "@azure-tools/typespec-client-generator-core": "~0.42.0", + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/openapi": "~0.56.0", + "@typespec/rest": "~0.56.0", + "@typespec/versioning": "~0.56.0" } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.41.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.41.0.tgz", - "integrity": "sha512-bnVrLxyjhMfKv75POL3m+lWjyqpLtWYEM9t2mrhFECHfW3+gWzTKIg98oNMKLXmev/sCc9QhbkKLs72jqxNL1Q==", + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.42.0.tgz", + "integrity": "sha512-8C96RkgSWtgqsaHRMWCd2iDltFJZTGmFQiTZazZj/uRy0Wn1ikjSriSN8t1puL5SiUPd0BVJP/YXiwAfjfZYDA==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/rest": "~0.55.0" + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/rest": "~0.56.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.41.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.41.0.tgz", - "integrity": "sha512-KPeQQle+hd508bkRjWHDsUXhoLjXVJg0DQyPM9wIxf+3cE0yH0aUxWPU6aj+aTio84226ExO2Qh8IadqgoQ5qg==", + "version": "0.42.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.42.0.tgz", + "integrity": "sha512-RCqcrhE1yniAih5vDFOC5K4MpDr9XmG8qBB39G49/KyEKnWOQ3Nwvt/6fXaU42D9X2L6kfEAIz/AdiSJ/H5O6w==", + "dependencies": { + "change-case": "~5.4.4", + "pluralize": "^8.0.0" + }, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-autorest": "~0.41.0", - "@azure-tools/typespec-azure-core": "~0.41.0", - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/openapi": "~0.55.0", - "@typespec/rest": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@azure-tools/typespec-autorest": "~0.42.0", + "@azure-tools/typespec-azure-core": "~0.42.0", + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/openapi": "~0.56.0", + "@typespec/rest": "~0.56.0", + "@typespec/versioning": "~0.56.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.41.1", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.41.1.tgz", - "integrity": "sha512-0eul/+2JEXVdN/wKL2wgCXuwiYJsnExe8v3AEkO+1SF6CP6iUj1yqwD6ypjZ9D8fmt7wAChCao4LYcOAsPXNdg==", + "version": "0.42.2", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.42.2.tgz", + "integrity": "sha512-Hei86GqNFfKpFhivZPpKo1ktSRQMnZKjLoMwIumklmMpeo5KgyzEgRSpJEiS+zmPZELs2Fu07VgfvpW0IXurUg==", "peer": true, "dependencies": { - "change-case": "~5.4.3", + "change-case": "~5.4.4", "pluralize": "^8.0.0" }, "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "~0.41.0", - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/rest": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@azure-tools/typespec-azure-core": "~0.42.0", + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/rest": "~0.56.0", + "@typespec/versioning": "~0.56.0" } }, "node_modules/@babel/code-frame": { @@ -96,21 +100,21 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz", + "integrity": "sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA==", "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.24.2", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", - "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.5.tgz", + "integrity": "sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw==", "peer": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", + "@babel/helper-validator-identifier": "^7.24.5", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -167,14 +171,14 @@ } }, "node_modules/@typespec/compiler": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.55.0.tgz", - "integrity": "sha512-JxBkP7fTc3yzDYZ+Ms+ZHYlL2Ym22oloLDl6107SGaShNJBdQlabgE0aV8WvYRRBYt8g0RNb+sDLEcjvahj6Gw==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-0.56.0.tgz", + "integrity": "sha512-K+VhXycoeqcoSGtB0/l1XYco4V2qRsCOOwqklVM4Yew7kTcKVfz7CT7a6a2OKWDMNg5iijZtRBoM5YF50XtQug==", "peer": true, "dependencies": { "@babel/code-frame": "~7.24.2", "ajv": "~8.12.0", - "change-case": "~5.4.3", + "change-case": "~5.4.4", "globby": "~14.0.1", "mustache": "~4.2.0", "picocolors": "~1.0.0", @@ -195,32 +199,32 @@ } }, "node_modules/@typespec/http": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.55.0.tgz", - "integrity": "sha512-r30RWzMTJgbyRpdtZxezlvXI/nkAvgilX1OM+s3A039lGLA+JRukgvKIZ3LaNr3lNXHiqeWQDrIZNhqBnpW1zw==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-0.56.0.tgz", + "integrity": "sha512-f/tpHRWev9bnAtNPFkfCU/5SFou9glA/rPDY0m2W5bK6EG1/6/TKKKz5FoKPA4xvc2dQ5vu/ouGLb4i5UzXvWQ==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0" + "@typespec/compiler": "~0.56.0" } }, "node_modules/@typespec/openapi": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.55.0.tgz", - "integrity": "sha512-5T4VuJSOGfMFSs+1dOl3U3BC6VhKAxSTBrwcQDIEEygnqCSbj/tMFDhNfzKYKARRDotgM8ESOrZU6XH5srVR7A==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-0.56.0.tgz", + "integrity": "sha512-q8+IHRglXBm3slvonRLSNYN2fX7plbWA+ugIiMJZTeyc3enqfxPqMGA8BCiAFV3kwP0uPPpIXbCSIVhHgkONbA==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0" + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0" } }, "node_modules/@typespec/openapi3": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.55.0.tgz", - "integrity": "sha512-dfn/wrKSF4Ls1dWMpAguQggoc4HGx2tf3FN2xhBln6EtahNZNgN5sOE+XY0hGPI4MCE5QexMUlXSiXpxzlNA/A==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi3/-/openapi3-0.56.0.tgz", + "integrity": "sha512-55JPUP7dFk4iXn4fNKZEs76j7hAdlWfoMWNPsQPRJCP//KWCtNXfTP+/TTVPVv1L/6HztbXyPV0agKZwyS7gDw==", "dependencies": { "yaml": "~2.4.1" }, @@ -228,33 +232,33 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0", - "@typespec/openapi": "~0.55.0", - "@typespec/versioning": "~0.55.0" + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0", + "@typespec/openapi": "~0.56.0", + "@typespec/versioning": "~0.56.0" } }, "node_modules/@typespec/rest": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.55.0.tgz", - "integrity": "sha512-RPZnx5D4xdTNiP0l++9IA8mUhnegPxetbdJ5RaG/QX2fTyF/gQ7t6AHIgdq8DfYVXqukQI/iGytJ135ObftbtQ==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.56.0.tgz", + "integrity": "sha512-8w4WhWDcpEQNW8bB1BHhiBxIQUChDJtyq/n9p2OI/Bm1wncd61y/ZNOtcxmlKq8uB9d+dzHiZdEfqFCR8HF8/Q==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0", - "@typespec/http": "~0.55.0" + "@typespec/compiler": "~0.56.0", + "@typespec/http": "~0.56.0" } }, "node_modules/@typespec/versioning": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.55.0.tgz", - "integrity": "sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.56.0.tgz", + "integrity": "sha512-j7IN9XFyGn3LH6IOJkinEvk9sDncsxiWPULOAe0VQ+D/dtCfLawDMUALnvklMDRKeD1OOUPSCjjUAp9OB0f7YA==", "engines": { "node": ">=18.0.0" }, "peerDependencies": { - "@typespec/compiler": "~0.55.0" + "@typespec/compiler": "~0.56.0" } }, "node_modules/ajv": { @@ -323,8 +327,7 @@ "node_modules/change-case": { "version": "5.4.4", "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", - "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", - "peer": true + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==" }, "node_modules/cliui": { "version": "8.0.1", @@ -541,18 +544,6 @@ "node": ">=6" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "peer": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -618,7 +609,6 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "peer": true, "engines": { "node": ">=4" } @@ -732,13 +722,10 @@ } }, "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "peer": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -937,16 +924,10 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "peer": true - }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", "bin": { "yaml": "bin.mjs" }, diff --git a/package.json b/package.json index 224bf23f4..a15f6bb1c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "dependencies": { - "@azure-tools/typespec-autorest": "^0.41.1", - "@azure-tools/typespec-azure-core": "^0.41.0", - "@azure-tools/typespec-azure-resource-manager": "^0.41.0", - "@typespec/http": "^0.55.0", - "@typespec/openapi": "^0.55.0", - "@typespec/openapi3": "^0.55.0", - "@typespec/rest": "^0.55.0", - "@typespec/versioning": "^0.55.0" + "@azure-tools/typespec-autorest": "^0.42.0", + "@azure-tools/typespec-azure-core": "^0.42.0", + "@azure-tools/typespec-azure-resource-manager": "^0.42.0", + "@typespec/http": "^0.56.0", + "@typespec/openapi": "^0.56.0", + "@typespec/openapi3": "^0.56.0", + "@typespec/rest": "^0.56.0", + "@typespec/versioning": "^0.56.0" } }