From 3cbac82d625f9ddf7bf280888370aa3c6e0b8b83 Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Fri, 11 Jun 2021 15:13:29 -0700 Subject: [PATCH 1/2] Rename ApiVersion to APIVersion --- .../resourcegroup_arm_types.go | 10 ++-- .../resourcegroup_types.go | 2 +- .../pkg/armclient/template_client_test.go | 4 +- hack/generated/pkg/genruntime/base_types.go | 2 +- .../azure_deployment_reconciler.go | 6 +- .../reflecthelpers/reflect_helpers_test.go | 2 +- .../pkg/astmodel/arm_spec_interface.go | 20 +++---- .../convert_to_arm_function_builder.go | 4 +- .../pkg/astmodel/identifier_factory.go | 5 +- hack/generator/pkg/astmodel/resource_type.go | 2 +- .../pipeline_add_arm_conversion_interface.go | 10 ++-- ...e_conversion_on_arm_type_only_azure.golden | 14 ++--- ...version_on_arm_type_only_crossplane.golden | 6 +- ...endent_resource_and_ownership_azure.golden | 56 +++++++++---------- ...t_resource_and_ownership_crossplane.golden | 18 +++--- ...urce_empty_objecttype_removed_azure.golden | 28 +++++----- ...empty_objecttype_removed_crossplane.golden | 12 ++-- ..._has_embedded_resource_inside_azure.golden | 42 +++++++------- ...embedded_resource_inside_crossplane.golden | 18 +++--- ...ed_resource_multiple_contexts_azure.golden | 14 ++--- ...source_multiple_contexts_crossplane.golden | 6 +- ...est_embedded_resource_removed_azure.golden | 28 +++++----- ...mbedded_resource_removed_crossplane.golden | 12 ++-- ...Arm_test_embedded_subresource_azure.golden | 28 +++++----- ...est_embedded_subresource_crossplane.golden | 12 ++-- ...d_subresource_same_properties_azure.golden | 28 +++++----- ...resource_same_properties_crossplane.golden | 12 ++-- ...rm_test_id_resource_reference_azure.golden | 14 ++--- ...st_id_resource_reference_crossplane.golden | 6 +- ..._optional_resource_references_azure.golden | 14 ++--- ...onal_resource_references_crossplane.golden | 6 +- ...ple_resource_array_properties_azure.golden | 14 ++--- ...esource_array_properties_crossplane.golden | 6 +- ...e_resource_complex_properties_azure.golden | 14 ++--- ...ource_complex_properties_crossplane.golden | 6 +- ...t_simple_resource_json_fields_azure.golden | 14 ++--- ...ple_resource_json_fields_crossplane.golden | 6 +- ...imple_resource_map_properties_azure.golden | 14 ++--- ..._resource_map_properties_crossplane.golden | 6 +- ..._simple_resource_renders_spec_azure.golden | 14 ++--- ...le_resource_renders_spec_crossplane.golden | 6 +- .../Embedded_type_simple_resource.golden | 14 ++--- .../EnumNames/Multi_valued_enum_name.golden | 14 ++--- .../EnumNames/Single_valued_enum_name.golden | 14 ++--- 44 files changed, 292 insertions(+), 291 deletions(-) diff --git a/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_arm_types.go b/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_arm_types.go index f1e4350e7a7..54b360e2332 100644 --- a/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_arm_types.go +++ b/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_arm_types.go @@ -25,9 +25,9 @@ type ResourceGroupStatusPropertiesArm struct { type ResourceGroupSpecArm struct { - //ApiVersion: API Version of the resource type, optional when apiProfile is used + //APIVersion: API Version of the resource type, optional when apiProfile is used //on the template - ApiVersion string `json:"apiVersion"` + APIVersion string `json:"apiVersion"` //Name: Name of the resource Name string `json:"name"` @@ -47,9 +47,9 @@ type ResourceGroupSpecArm struct { var _ genruntime.ARMResourceSpec = &ResourceGroupSpecArm{} -// GetApiVersion returns the ApiVersion of the resource -func (spec ResourceGroupSpecArm) GetApiVersion() string { - return string(spec.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (spec ResourceGroupSpecArm) GetAPIVersion() string { + return string(spec.APIVersion) } // GetName returns the Name of the resource diff --git a/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_types.go b/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_types.go index 4fcb3c288be..8d0d81dc571 100644 --- a/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_types.go +++ b/hack/generated/_apis/microsoft.resources/v1alpha1api20200601/resourcegroup_types.go @@ -184,7 +184,7 @@ func (spec *ResourceGroupSpec) ConvertToARM(name string, resolvedReferences genr return nil, nil } result := ResourceGroupSpecArm{} - result.ApiVersion = "2020-06-01" // TODO: Update this to match what the codegenerated resources do with APIVersion eventually + result.APIVersion = "2020-06-01" // TODO: Update this to match what the codegenerated resources do with APIVersion eventually result.Location = spec.Location result.Name = name result.ManagedBy = spec.ManagedBy diff --git a/hack/generated/pkg/armclient/template_client_test.go b/hack/generated/pkg/armclient/template_client_test.go index 39de1ffe517..45ecf91ce6e 100644 --- a/hack/generated/pkg/armclient/template_client_test.go +++ b/hack/generated/pkg/armclient/template_client_test.go @@ -60,11 +60,11 @@ func Test_NewResourceGroupDeployment(t *testing.T) { log.Printf("Created resource: %s\n", id) // Delete the RG - _, err = testContext.AzureClient.BeginDeleteResource(ctx, id, typedResourceGroupSpec.ApiVersion, nil) + _, err = testContext.AzureClient.BeginDeleteResource(ctx, id, typedResourceGroupSpec.APIVersion, nil) g.Expect(err).ToNot(HaveOccurred()) // Ensure that the resource group is deleted - g.Eventually([]string{id, typedResourceGroupSpec.ApiVersion}).Should(testContext.AzureMatch.BeDeleted(ctx)) + g.Eventually([]string{id, typedResourceGroupSpec.APIVersion}).Should(testContext.AzureMatch.BeDeleted(ctx)) } func Test_NewResourceGroupDeployment_Error(t *testing.T) { diff --git a/hack/generated/pkg/genruntime/base_types.go b/hack/generated/pkg/genruntime/base_types.go index 2dea3f74174..87c331b7705 100644 --- a/hack/generated/pkg/genruntime/base_types.go +++ b/hack/generated/pkg/genruntime/base_types.go @@ -87,7 +87,7 @@ func AddAnnotation(obj MetaObject, k string, v string) { // methods to access properties common to all ARM Resource Specs. An Azure // Deployment is made of these. type ARMResourceSpec interface { - GetApiVersion() string + GetAPIVersion() string GetType() string diff --git a/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go b/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go index 9f2c4e86457..d2363d03e16 100644 --- a/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go +++ b/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go @@ -388,7 +388,7 @@ func (r *AzureDeploymentReconciler) StartDeleteOfResource(ctx context.Context) ( } // retryAfter = ARM can tell us how long to wait for a DELETE - retryAfter, err := r.ARMClient.BeginDeleteResource(ctx, resource.GetId(), resource.Spec().GetApiVersion(), emptyStatus) + retryAfter, err := r.ARMClient.BeginDeleteResource(ctx, resource.GetId(), resource.Spec().GetAPIVersion(), emptyStatus) if err != nil { return ctrl.Result{}, errors.Wrapf(err, "deleting resource %q", resource.Spec().GetType()) } @@ -424,7 +424,7 @@ func (r *AzureDeploymentReconciler) MonitorDelete(ctx context.Context) (ctrl.Res } // already deleting, just check to see if it still exists and if it's gone, remove finalizer - found, retryAfter, err := r.ARMClient.HeadResource(ctx, resource.GetId(), resource.Spec().GetApiVersion()) + found, retryAfter, err := r.ARMClient.HeadResource(ctx, resource.GetId(), resource.Spec().GetAPIVersion()) if err != nil { if retryAfter != 0 { r.log.V(3).Info("Error performing HEAD on resource, will retry", "delaySec", retryAfter/time.Second) @@ -657,7 +657,7 @@ func (r *AzureDeploymentReconciler) getStatus(ctx context.Context, id string) (g } // Get the resource - retryAfter, err := r.ARMClient.GetResource(ctx, id, deployableSpec.Spec().GetApiVersion(), armStatus) + retryAfter, err := r.ARMClient.GetResource(ctx, id, deployableSpec.Spec().GetAPIVersion(), armStatus) if r.log.V(4).Enabled() { statusBytes, marshalErr := json.Marshal(armStatus) if marshalErr != nil { diff --git a/hack/generated/pkg/reflecthelpers/reflect_helpers_test.go b/hack/generated/pkg/reflecthelpers/reflect_helpers_test.go index d62d8c7c73d..f01600c3641 100644 --- a/hack/generated/pkg/reflecthelpers/reflect_helpers_test.go +++ b/hack/generated/pkg/reflecthelpers/reflect_helpers_test.go @@ -147,7 +147,7 @@ func Test_ConvertResourceToDeployableResource(t *testing.T) { g.Expect(ok).To(BeTrue()) g.Expect("myrg").To(Equal(rgResource.ResourceGroup())) g.Expect("azureName").To(Equal(rgResource.Spec().GetName())) - g.Expect("2017-09-01").To(Equal(rgResource.Spec().GetApiVersion())) + g.Expect("2017-09-01").To(Equal(rgResource.Spec().GetAPIVersion())) g.Expect(string(batch.BatchAccountsSpecTypeMicrosoftBatchBatchAccounts)).To(Equal(rgResource.Spec().GetType())) } diff --git a/hack/generator/pkg/astmodel/arm_spec_interface.go b/hack/generator/pkg/astmodel/arm_spec_interface.go index c4493dd4a0e..557aed153b6 100644 --- a/hack/generator/pkg/astmodel/arm_spec_interface.go +++ b/hack/generator/pkg/astmodel/arm_spec_interface.go @@ -15,7 +15,7 @@ import ( ) const ( - ApiVersionProperty = "ApiVersion" + APIVersionProperty = "APIVersion" TypeProperty = "Type" NameProperty = "Name" ) @@ -36,7 +36,7 @@ func NewARMSpecInterfaceImpl( spec *ObjectType) (*InterfaceImplementation, error) { // Check the spec first to ensure it looks how we expect - apiVersionProperty := idFactory.CreatePropertyName(ApiVersionProperty, Exported) + apiVersionProperty := idFactory.CreatePropertyName(APIVersionProperty, Exported) err := checkPropertyPresence(spec, apiVersionProperty) if err != nil { return nil, err @@ -53,7 +53,7 @@ func NewARMSpecInterfaceImpl( } getNameFunc := &objectFunction{ - name: "GetName", + name: "Get" + NameProperty, o: spec, idFactory: idFactory, asFunc: getNameFunction, @@ -61,18 +61,18 @@ func NewARMSpecInterfaceImpl( } getTypeFunc := &objectFunction{ - name: "GetType", + name: "Get" + TypeProperty, o: spec, idFactory: idFactory, asFunc: getTypeFunction, requiredPackages: NewPackageReferenceSet(GenRuntimeReference), } - getApiVersionFunc := &objectFunction{ - name: "GetApiVersion", + getAPIVersionFunc := &objectFunction{ + name: "Get" + APIVersionProperty, o: spec, idFactory: idFactory, - asFunc: getApiVersionFunction, + asFunc: getAPIVersionFunction, requiredPackages: NewPackageReferenceSet(GenRuntimeReference), } @@ -80,7 +80,7 @@ func NewARMSpecInterfaceImpl( MakeTypeName(GenRuntimeReference, "ARMResourceSpec"), getNameFunc, getTypeFunc, - getApiVersionFunc) + getAPIVersionFunc) return result, nil } @@ -105,13 +105,13 @@ func getTypeFunction(k *objectFunction, codeGenerationContext *CodeGenerationCon true) } -func getApiVersionFunction(k *objectFunction, codeGenerationContext *CodeGenerationContext, receiver TypeName, methodName string) *dst.FuncDecl { +func getAPIVersionFunction(k *objectFunction, codeGenerationContext *CodeGenerationContext, receiver TypeName, methodName string) *dst.FuncDecl { return armSpecInterfaceSimpleGetFunction( k, codeGenerationContext, receiver, methodName, - "ApiVersion", + APIVersionProperty, true) } diff --git a/hack/generator/pkg/astmodel/armconversion/convert_to_arm_function_builder.go b/hack/generator/pkg/astmodel/armconversion/convert_to_arm_function_builder.go index 659c082da5e..2a7ac636389 100644 --- a/hack/generator/pkg/astmodel/armconversion/convert_to_arm_function_builder.go +++ b/hack/generator/pkg/astmodel/armconversion/convert_to_arm_function_builder.go @@ -63,8 +63,8 @@ func newConvertToARMFunctionBuilder( result.propertyConversionHandlers = []propertyConversionHandler{ result.namePropertyHandler, result.referencePropertyHandler, - result.fixedValuePropertyHandler("Type"), - result.fixedValuePropertyHandler("ApiVersion"), + result.fixedValuePropertyHandler(astmodel.TypeProperty), + result.fixedValuePropertyHandler(astmodel.APIVersionProperty), result.propertiesWithSameNameHandler, } diff --git a/hack/generator/pkg/astmodel/identifier_factory.go b/hack/generator/pkg/astmodel/identifier_factory.go index 0b980946c94..ad64ff77fde 100644 --- a/hack/generator/pkg/astmodel/identifier_factory.go +++ b/hack/generator/pkg/astmodel/identifier_factory.go @@ -120,8 +120,9 @@ func (factory *identifierFactory) CreatePropertyName(propertyName string, visibi func createRenames() map[string]string { return map[string]string{ - "$schema": "Schema", - "*": "Star", // This happens mostly in enums + "$schema": "Schema", + "*": "Star", // This happens mostly in enums + "apiVersion": "APIVersion", } } diff --git a/hack/generator/pkg/astmodel/resource_type.go b/hack/generator/pkg/astmodel/resource_type.go index 86d73ca7f0b..76a32186388 100644 --- a/hack/generator/pkg/astmodel/resource_type.go +++ b/hack/generator/pkg/astmodel/resource_type.go @@ -77,7 +77,7 @@ func NewAzureResourceType(specType Type, statusType Type, typeName TypeName) *Re } } - if property.HasName(ApiVersionProperty) { + if property.HasName(APIVersionProperty) { apiVersionProperty = property } } diff --git a/hack/generator/pkg/codegen/pipeline_add_arm_conversion_interface.go b/hack/generator/pkg/codegen/pipeline_add_arm_conversion_interface.go index 4c3562d1a03..a32024a7d58 100644 --- a/hack/generator/pkg/codegen/pipeline_add_arm_conversion_interface.go +++ b/hack/generator/pkg/codegen/pipeline_add_arm_conversion_interface.go @@ -191,19 +191,19 @@ func (c *armConversionApplier) transformSpec(resourceType *astmodel.ResourceType // TODO: https://github.com/kubernetes-sigs/controller-tools/issues/461 is fixed // drop Type property - t = t.WithoutProperty("Type") + t = t.WithoutProperty(astmodel.TypeProperty) - // drop ApiVersion property - t = t.WithoutProperty("ApiVersion") + // drop APIVersion property + t = t.WithoutProperty(astmodel.APIVersionProperty) - nameProp, hasName := t.Property("Name") + nameProp, hasName := t.Property(astmodel.NameProperty) if !hasName { return t, nil } // rename Name to AzureName azureNameProp := armconversion.GetAzureNameProperty(c.idFactory).WithType(nameProp.PropertyType()) - return t.WithoutProperty("Name").WithProperty(azureNameProp), nil + return t.WithoutProperty(astmodel.NameProperty).WithProperty(azureNameProp), nil } kubernetesDef, err := resourceSpecDef.ApplyObjectTransformations(remapProperties, injectOwnerProperty) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_azure.golden index c09fa856711..8a461ef6548 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_azure.golden @@ -154,7 +154,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *PropertiesARM `json:"properties,omitempty"` Type FakeResourceSpecType `json:"type"` @@ -162,9 +162,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -178,9 +178,9 @@ func (fakeResourceSpecARM FakeResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -205,7 +205,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 result.Name = name if fakeResourceSpec.Properties != nil { propertiesARM, err := (*fakeResourceSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_crossplane.golden index 2f0f9d21121..246193611f8 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_oneof_resource_conversion_on_arm_type_only_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -54,9 +54,9 @@ type FakeResourceParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_azure.golden index 78303c145fc..80a77d6fce8 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_azure.golden @@ -153,16 +153,16 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type ASpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -315,16 +315,16 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type BSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -477,16 +477,16 @@ type CList struct { } type C_SpecARM struct { - ApiVersion CSpecApiVersion `json:"apiVersion"` + APIVersion CSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type CSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &C_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (cSpecARM C_SpecARM) GetApiVersion() string { - return string(cSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (cSpecARM C_SpecARM) GetAPIVersion() string { + return string(cSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -639,16 +639,16 @@ type DList struct { } type D_SpecARM struct { - ApiVersion DSpecApiVersion `json:"apiVersion"` + APIVersion DSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type DSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &D_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (dSpecARM D_SpecARM) GetApiVersion() string { - return string(dSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (dSpecARM D_SpecARM) GetAPIVersion() string { + return string(dSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -662,9 +662,9 @@ func (dSpecARM D_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -688,7 +688,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name result.Type = ASpecTypeMicrosoftAzureA return result, nil @@ -714,9 +714,9 @@ func (aSpec *A_Spec) PopulateFromARM(owner genruntime.KnownResourceReference, ar func (aSpec *A_Spec) SetAzureName(azureName string) { aSpec.AzureName = azureName } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -740,7 +740,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name result.Type = BSpecTypeMicrosoftAzureB return result, nil @@ -766,9 +766,9 @@ func (bSpec *B_Spec) PopulateFromARM(owner genruntime.KnownResourceReference, ar func (bSpec *B_Spec) SetAzureName(azureName string) { bSpec.AzureName = azureName } // +kubebuilder:validation:Enum={"2020-06-01"} -type CSpecApiVersion string +type CSpecAPIVersion string -const CSpecApiVersion20200601 = CSpecApiVersion("2020-06-01") +const CSpecAPIVersion20200601 = CSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/C"} type CSpecType string @@ -792,7 +792,7 @@ func (cSpec *C_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result C_SpecARM - result.ApiVersion = CSpecApiVersion20200601 + result.APIVersion = CSpecAPIVersion20200601 result.Name = name result.Type = CSpecTypeMicrosoftAzureC return result, nil @@ -818,9 +818,9 @@ func (cSpec *C_Spec) PopulateFromARM(owner genruntime.KnownResourceReference, ar func (cSpec *C_Spec) SetAzureName(azureName string) { cSpec.AzureName = azureName } // +kubebuilder:validation:Enum={"2020-06-01"} -type DSpecApiVersion string +type DSpecAPIVersion string -const DSpecApiVersion20200601 = DSpecApiVersion("2020-06-01") +const DSpecAPIVersion20200601 = DSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/D"} type DSpecType string @@ -844,7 +844,7 @@ func (dSpec *D_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result D_SpecARM - result.ApiVersion = DSpecApiVersion20200601 + result.APIVersion = DSpecAPIVersion20200601 result.Name = name result.Type = DSpecTypeMicrosoftAzureD return result, nil diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_crossplane.golden index 3e78ab927d6..b96600f53be 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_dependent_resource_and_ownership_crossplane.golden @@ -92,7 +92,7 @@ type C_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -110,7 +110,7 @@ type BParameters struct { ANameSelector *v1alpha1.Selector `json:"aNameSelector,omitempty"` // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -128,7 +128,7 @@ type CParameters struct { ANameSelector *v1alpha1.Selector `json:"aNameSelector,omitempty"` // +kubebuilder:validation:Required - ApiVersion CSpecApiVersion `json:"apiVersion"` + APIVersion CSpecAPIVersion `json:"apiVersion"` BName string `json:"bName"` BNameRef *v1alpha1.Reference `json:"bNameRef,omitempty"` BNameSelector *v1alpha1.Selector `json:"bNameSelector,omitempty"` @@ -144,9 +144,9 @@ type CParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -154,9 +154,9 @@ type ASpecType string const ASpecTypeMicrosoftAzureA = ASpecType("Microsoft.Azure/A") // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -164,9 +164,9 @@ type BSpecType string const BSpecTypeMicrosoftAzureB = BSpecType("Microsoft.Azure/B") // +kubebuilder:validation:Enum={"2020-06-01"} -type CSpecApiVersion string +type CSpecAPIVersion string -const CSpecApiVersion20200601 = CSpecApiVersion("2020-06-01") +const CSpecAPIVersion20200601 = CSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/C"} type CSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_azure.golden index 395035b2373..5059c7eb57e 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *APropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -316,7 +316,7 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *BPropertiesARM `json:"properties,omitempty"` Type BSpecType `json:"type"` @@ -324,9 +324,9 @@ type B_SpecARM struct { var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -346,9 +346,9 @@ type APropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -373,7 +373,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -421,9 +421,9 @@ type BPropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -448,7 +448,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name if bSpec.Properties != nil { propertiesARM, err := (*bSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_crossplane.golden index df6baa210dd..a198a10e259 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_empty_objecttype_removed_crossplane.golden @@ -66,7 +66,7 @@ type B_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -81,7 +81,7 @@ type AParameters struct { type BParameters struct { // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -102,9 +102,9 @@ type AProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -117,9 +117,9 @@ type BProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_azure.golden index 92eb92c3b19..6c5c2a8d2e2 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *APropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -316,7 +316,7 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *BPropertiesARM `json:"properties,omitempty"` Type BSpecType `json:"type"` @@ -324,9 +324,9 @@ type B_SpecARM struct { var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -479,7 +479,7 @@ type CList struct { } type C_SpecARM struct { - ApiVersion CSpecApiVersion `json:"apiVersion"` + APIVersion CSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *CPropertiesARM `json:"properties,omitempty"` Type CSpecType `json:"type"` @@ -487,9 +487,9 @@ type C_SpecARM struct { var _ genruntime.ARMResourceSpec = &C_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (cSpecARM C_SpecARM) GetApiVersion() string { - return string(cSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (cSpecARM C_SpecARM) GetAPIVersion() string { + return string(cSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -510,9 +510,9 @@ type APropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -537,7 +537,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -586,9 +586,9 @@ type BPropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -613,7 +613,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name if bSpec.Properties != nil { propertiesARM, err := (*bSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -662,9 +662,9 @@ type CPropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type CSpecApiVersion string +type CSpecAPIVersion string -const CSpecApiVersion20200601 = CSpecApiVersion("2020-06-01") +const CSpecAPIVersion20200601 = CSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/C"} type CSpecType string @@ -689,7 +689,7 @@ func (cSpec *C_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result C_SpecARM - result.ApiVersion = CSpecApiVersion20200601 + result.APIVersion = CSpecAPIVersion20200601 result.Name = name if cSpec.Properties != nil { propertiesARM, err := (*cSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_crossplane.golden index e980379e838..445179864d5 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_has_embedded_resource_inside_crossplane.golden @@ -92,7 +92,7 @@ type C_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -107,7 +107,7 @@ type AParameters struct { type BParameters struct { // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -122,7 +122,7 @@ type BParameters struct { type CParameters struct { // +kubebuilder:validation:Required - ApiVersion CSpecApiVersion `json:"apiVersion"` + APIVersion CSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -143,9 +143,9 @@ type AProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -159,9 +159,9 @@ type BProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -175,9 +175,9 @@ type CProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type CSpecApiVersion string +type CSpecAPIVersion string -const CSpecApiVersion20200601 = CSpecApiVersion("2020-06-01") +const CSpecAPIVersion20200601 = CSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/C"} type CSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_azure.golden index bb276420074..21352bab520 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *APropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -183,9 +183,9 @@ type APropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -210,7 +210,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_crossplane.golden index ad3f309587f..4269d742ca2 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_multiple_contexts_crossplane.golden @@ -40,7 +40,7 @@ type A_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -60,9 +60,9 @@ type AProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_azure.golden index fe65bb7ba84..18a8b8ced2f 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *APropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -316,7 +316,7 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *BPropertiesARM `json:"properties,omitempty"` Type BSpecType `json:"type"` @@ -324,9 +324,9 @@ type B_SpecARM struct { var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -347,9 +347,9 @@ type APropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -374,7 +374,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -422,9 +422,9 @@ type BPropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -449,7 +449,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name if bSpec.Properties != nil { propertiesARM, err := (*bSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_crossplane.golden index 16903bda7bd..b715f222465 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_resource_removed_crossplane.golden @@ -66,7 +66,7 @@ type B_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -81,7 +81,7 @@ type AParameters struct { type BParameters struct { // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -102,9 +102,9 @@ type AProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -117,9 +117,9 @@ type BProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_azure.golden index d0743968dc2..41c8a1c0a31 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *APropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -316,7 +316,7 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *BPropertiesARM `json:"properties,omitempty"` Type BSpecType `json:"type"` @@ -324,9 +324,9 @@ type B_SpecARM struct { var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -346,9 +346,9 @@ type APropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -373,7 +373,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -421,9 +421,9 @@ type BPropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -448,7 +448,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name if bSpec.Properties != nil { propertiesARM, err := (*bSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_crossplane.golden index bd1368a9cb8..04d11380e31 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_crossplane.golden @@ -66,7 +66,7 @@ type B_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -85,7 +85,7 @@ type BParameters struct { ANameSelector *v1alpha1.Selector `json:"aNameSelector,omitempty"` // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -106,9 +106,9 @@ type AProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -121,9 +121,9 @@ type BProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_azure.golden index 17235468fba..42d75258868 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_azure.golden @@ -153,7 +153,7 @@ type AList struct { } type A_SpecARM struct { - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *CommonPropertiesARM `json:"properties,omitempty"` Type ASpecType `json:"type"` @@ -161,9 +161,9 @@ type A_SpecARM struct { var _ genruntime.ARMResourceSpec = &A_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aSpecARM A_SpecARM) GetApiVersion() string { - return string(aSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aSpecARM A_SpecARM) GetAPIVersion() string { + return string(aSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -316,7 +316,7 @@ type BList struct { } type B_SpecARM struct { - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *CommonPropertiesARM `json:"properties,omitempty"` Type BSpecType `json:"type"` @@ -324,9 +324,9 @@ type B_SpecARM struct { var _ genruntime.ARMResourceSpec = &B_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (bSpecARM B_SpecARM) GetApiVersion() string { - return string(bSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (bSpecARM B_SpecARM) GetAPIVersion() string { + return string(bSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -340,9 +340,9 @@ func (bSpecARM B_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -367,7 +367,7 @@ func (aSpec *A_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result A_SpecARM - result.ApiVersion = ASpecApiVersion20200601 + result.APIVersion = ASpecAPIVersion20200601 result.Name = name if aSpec.Properties != nil { propertiesARM, err := (*aSpec.Properties).ConvertToARM(name, resolvedReferences) @@ -410,9 +410,9 @@ func (aSpec *A_Spec) PopulateFromARM(owner genruntime.KnownResourceReference, ar func (aSpec *A_Spec) SetAzureName(azureName string) { aSpec.AzureName = azureName } // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string @@ -437,7 +437,7 @@ func (bSpec *B_Spec) ConvertToARM(name string, resolvedReferences genruntime.Res return nil, nil } var result B_SpecARM - result.ApiVersion = BSpecApiVersion20200601 + result.APIVersion = BSpecAPIVersion20200601 result.Name = name if bSpec.Properties != nil { propertiesARM, err := (*bSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_crossplane.golden index 19b7883cd24..aba99f0eb48 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_embedded_subresource_same_properties_crossplane.golden @@ -66,7 +66,7 @@ type B_Spec struct { type AParameters struct { // +kubebuilder:validation:Required - ApiVersion ASpecApiVersion `json:"apiVersion"` + APIVersion ASpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -85,7 +85,7 @@ type BParameters struct { ANameSelector *v1alpha1.Selector `json:"aNameSelector,omitempty"` // +kubebuilder:validation:Required - ApiVersion BSpecApiVersion `json:"apiVersion"` + APIVersion BSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -99,9 +99,9 @@ type BParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type ASpecApiVersion string +type ASpecAPIVersion string -const ASpecApiVersion20200601 = ASpecApiVersion("2020-06-01") +const ASpecAPIVersion20200601 = ASpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/A"} type ASpecType string @@ -109,9 +109,9 @@ type ASpecType string const ASpecTypeMicrosoftAzureA = ASpecType("Microsoft.Azure/A") // +kubebuilder:validation:Enum={"2020-06-01"} -type BSpecApiVersion string +type BSpecAPIVersion string -const BSpecApiVersion20200601 = BSpecApiVersion("2020-06-01") +const BSpecAPIVersion20200601 = BSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/B"} type BSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_azure.golden index c60be741c55..12b94e8c9d4 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_azure.golden @@ -153,7 +153,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *FakeResourcePropertiesARM `json:"properties,omitempty"` Type FakeResourceSpecType `json:"type"` @@ -161,9 +161,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -183,9 +183,9 @@ type FakeResourcePropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -210,7 +210,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 result.Name = name if fakeResourceSpec.Properties != nil { propertiesARM, err := (*fakeResourceSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_crossplane.golden index f30a33fe5a7..30397a19c99 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_id_resource_reference_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -65,9 +65,9 @@ type FakeResourceProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_azure.golden index 60d939f39d2..cd8bf7361de 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_azure.golden @@ -153,7 +153,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Properties *FakeResourcePropertiesARM `json:"properties,omitempty"` Type FakeResourceSpecType `json:"type"` @@ -161,9 +161,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -183,9 +183,9 @@ type FakeResourcePropertiesARM struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -210,7 +210,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 result.Name = name if fakeResourceSpec.Properties != nil { propertiesARM, err := (*fakeResourceSpec.Properties).ConvertToARM(name, resolvedReferences) diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_crossplane.golden index 84335cd5dbc..8aa4065c3d8 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_required_and_optional_resource_references_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -66,9 +66,9 @@ type FakeResourceProperties struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_azure.golden index 92fc5e94900..13bf483b578 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_azure.golden @@ -153,7 +153,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` ArrayFoo []FooARM `json:"arrayFoo"` ArrayOfArrays [][]FooARM `json:"arrayOfArrays,omitempty"` ArrayOfArraysOfArrays [][][]FooARM `json:"arrayOfArraysOfArrays,omitempty"` @@ -165,9 +165,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -191,9 +191,9 @@ const ( ) // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -224,7 +224,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 for _, item := range fakeResourceSpec.ArrayFoo { itemARM, err := item.ConvertToARM(name, resolvedReferences) if err != nil { diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_crossplane.golden index 70d21a6b5b4..98b726d6924 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_array_properties_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required ArrayFoo []Foo `json:"arrayFoo"` @@ -70,9 +70,9 @@ const ( ) // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_azure.golden index 6d09e6f4487..f4d9126702b 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_azure.golden @@ -153,7 +153,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Color *FakeResourceSpecColor `json:"color,omitempty"` Foo FooARM `json:"foo"` Name string `json:"name"` @@ -163,9 +163,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -179,9 +179,9 @@ func (fakeResourceSpecARM FakeResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"blue","green","red"} type FakeResourceSpecColor string @@ -219,7 +219,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 if fakeResourceSpec.Color != nil { color := *fakeResourceSpec.Color result.Color = &color diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_crossplane.golden index af08fb8101a..04a879ed223 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_complex_properties_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Color *FakeResourceSpecColor `json:"color,omitempty"` // +kubebuilder:validation:Required @@ -58,9 +58,9 @@ type FakeResourceParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"blue","green","red"} type FakeResourceSpecColor string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_azure.golden index 2f305c9677f..9255db32013 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_azure.golden @@ -154,7 +154,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` JsonObject map[string]v1.JSON `json:"jsonObject"` MandatoryJson v1.JSON `json:"mandatoryJson"` Name string `json:"name"` @@ -164,9 +164,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -180,9 +180,9 @@ func (fakeResourceSpecARM FakeResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -213,7 +213,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 if fakeResourceSpec.JsonObject != nil { result.JsonObject = make(map[string]v1.JSON) for key, value := range fakeResourceSpec.JsonObject { diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_crossplane.golden index 98b3fffd71a..fe83851ebff 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_json_fields_crossplane.golden @@ -41,7 +41,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required JsonObject map[string]v1.JSON `json:"jsonObject"` @@ -61,9 +61,9 @@ type FakeResourceParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_azure.golden index f0bc74775eb..93399dba440 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_azure.golden @@ -153,7 +153,7 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` MapFoo map[string]FooARM `json:"mapFoo"` MapOfArrays map[string][]FooARM `json:"mapOfArrays,omitempty"` MapOfEnums map[string]Color `json:"mapOfEnums,omitempty"` @@ -167,9 +167,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -193,9 +193,9 @@ const ( ) // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -228,7 +228,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 if fakeResourceSpec.MapFoo != nil { result.MapFoo = make(map[string]FooARM) for key, value := range fakeResourceSpec.MapFoo { diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_crossplane.golden index 148b3248d68..1865d7f3a39 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_map_properties_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required MapFoo map[string]Foo `json:"mapFoo"` @@ -72,9 +72,9 @@ const ( ) // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_azure.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_azure.golden index b6824a312a5..e21b697c648 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_azure.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_azure.golden @@ -153,16 +153,16 @@ type FakeResourceList struct { } type FakeResource_SpecARM struct { - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type FakeResourceSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -176,9 +176,9 @@ func (fakeResourceSpecARM FakeResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string @@ -202,7 +202,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 result.Name = name result.Type = FakeResourceSpecTypeMicrosoftAzureFakeResource return result, nil diff --git a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_crossplane.golden b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_crossplane.golden index 84741d6bbf9..de6d4dc575b 100644 --- a/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_crossplane.golden +++ b/hack/generator/pkg/codegen/testdata/ArmResource/Arm_test_simple_resource_renders_spec_crossplane.golden @@ -40,7 +40,7 @@ type FakeResource_Spec struct { type FakeResourceParameters struct { // +kubebuilder:validation:Required - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` // +kubebuilder:validation:Required Name string `json:"name"` @@ -53,9 +53,9 @@ type FakeResourceParameters struct { } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/FakeResource"} type FakeResourceSpecType string diff --git a/hack/generator/pkg/codegen/testdata/EmbeddedTypes/Embedded_type_simple_resource.golden b/hack/generator/pkg/codegen/testdata/EmbeddedTypes/Embedded_type_simple_resource.golden index 78cb1d12e73..72b830c8abe 100644 --- a/hack/generator/pkg/codegen/testdata/EmbeddedTypes/Embedded_type_simple_resource.golden +++ b/hack/generator/pkg/codegen/testdata/EmbeddedTypes/Embedded_type_simple_resource.golden @@ -158,7 +158,7 @@ type FakeResourceList struct { type FakeResource_SpecARM struct { EmbeddedTestType `json:",inline"` - ApiVersion FakeResourceSpecApiVersion `json:"apiVersion"` + APIVersion FakeResourceSpecAPIVersion `json:"apiVersion"` Color *FakeResourceSpecColor `json:"color,omitempty"` Foo FooARM `json:"foo"` Name string `json:"name"` @@ -168,9 +168,9 @@ type FakeResource_SpecARM struct { var _ genruntime.ARMResourceSpec = &FakeResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (fakeResourceSpecARM FakeResource_SpecARM) GetApiVersion() string { - return string(fakeResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (fakeResourceSpecARM FakeResource_SpecARM) GetAPIVersion() string { + return string(fakeResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -215,9 +215,9 @@ func (embeddedTestType *EmbeddedTestType) PopulateFromARM(owner genruntime.Known } // +kubebuilder:validation:Enum={"2020-06-01"} -type FakeResourceSpecApiVersion string +type FakeResourceSpecAPIVersion string -const FakeResourceSpecApiVersion20200601 = FakeResourceSpecApiVersion("2020-06-01") +const FakeResourceSpecAPIVersion20200601 = FakeResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"blue","green","red"} type FakeResourceSpecColor string @@ -257,7 +257,7 @@ func (fakeResourceSpec *FakeResource_Spec) ConvertToARM(name string, resolvedRef return nil, nil } var result FakeResource_SpecARM - result.ApiVersion = FakeResourceSpecApiVersion20200601 + result.APIVersion = FakeResourceSpecAPIVersion20200601 if fakeResourceSpec.Color != nil { color := *fakeResourceSpec.Color result.Color = &color diff --git a/hack/generator/pkg/codegen/testdata/EnumNames/Multi_valued_enum_name.golden b/hack/generator/pkg/codegen/testdata/EnumNames/Multi_valued_enum_name.golden index 0c6a6d533ac..845543c5c0f 100644 --- a/hack/generator/pkg/codegen/testdata/EnumNames/Multi_valued_enum_name.golden +++ b/hack/generator/pkg/codegen/testdata/EnumNames/Multi_valued_enum_name.golden @@ -153,16 +153,16 @@ type AResourceList struct { } type AResource_SpecARM struct { - ApiVersion AResourceSpecApiVersion `json:"apiVersion"` + APIVersion AResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type AResourceSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &AResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aResourceSpecARM AResource_SpecARM) GetApiVersion() string { - return string(aResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aResourceSpecARM AResource_SpecARM) GetAPIVersion() string { + return string(aResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -176,9 +176,9 @@ func (aResourceSpecARM AResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type AResourceSpecApiVersion string +type AResourceSpecAPIVersion string -const AResourceSpecApiVersion20200601 = AResourceSpecApiVersion("2020-06-01") +const AResourceSpecAPIVersion20200601 = AResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/AResource"} type AResourceSpecType string @@ -202,7 +202,7 @@ func (aResourceSpec *AResource_Spec) ConvertToARM(name string, resolvedReference return nil, nil } var result AResource_SpecARM - result.ApiVersion = AResourceSpecApiVersion20200601 + result.APIVersion = AResourceSpecAPIVersion20200601 result.Name = name result.Type = AResourceSpecTypeMicrosoftAzureAResource return result, nil diff --git a/hack/generator/pkg/codegen/testdata/EnumNames/Single_valued_enum_name.golden b/hack/generator/pkg/codegen/testdata/EnumNames/Single_valued_enum_name.golden index b92e01c6756..4055e207d01 100644 --- a/hack/generator/pkg/codegen/testdata/EnumNames/Single_valued_enum_name.golden +++ b/hack/generator/pkg/codegen/testdata/EnumNames/Single_valued_enum_name.golden @@ -151,16 +151,16 @@ type AResourceSpecName string const AResourceSpecNameOnlyonevalue = AResourceSpecName("onlyonevalue") type AResource_SpecARM struct { - ApiVersion AResourceSpecApiVersion `json:"apiVersion"` + APIVersion AResourceSpecAPIVersion `json:"apiVersion"` Name string `json:"name"` Type AResourceSpecType `json:"type"` } var _ genruntime.ARMResourceSpec = &AResource_SpecARM{} -// GetApiVersion returns the ApiVersion of the resource -func (aResourceSpecARM AResource_SpecARM) GetApiVersion() string { - return string(aResourceSpecARM.ApiVersion) +// GetAPIVersion returns the APIVersion of the resource +func (aResourceSpecARM AResource_SpecARM) GetAPIVersion() string { + return string(aResourceSpecARM.APIVersion) } // GetName returns the Name of the resource @@ -174,9 +174,9 @@ func (aResourceSpecARM AResource_SpecARM) GetType() string { } // +kubebuilder:validation:Enum={"2020-06-01"} -type AResourceSpecApiVersion string +type AResourceSpecAPIVersion string -const AResourceSpecApiVersion20200601 = AResourceSpecApiVersion("2020-06-01") +const AResourceSpecAPIVersion20200601 = AResourceSpecAPIVersion("2020-06-01") // +kubebuilder:validation:Enum={"Microsoft.Azure/AResource"} type AResourceSpecType string @@ -196,7 +196,7 @@ func (aResourceSpec *AResource_Spec) ConvertToARM(name string, resolvedReference return nil, nil } var result AResource_SpecARM - result.ApiVersion = AResourceSpecApiVersion20200601 + result.APIVersion = AResourceSpecAPIVersion20200601 result.Name = name result.Type = AResourceSpecTypeMicrosoftAzureAResource return result, nil From 8ae905b73ffeca245bed792c2f6efc5caead1a5f Mon Sep 17 00:00:00 2001 From: Matthew Christopher Date: Fri, 11 Jun 2021 15:15:10 -0700 Subject: [PATCH 2/2] Rename GetId to GetID --- hack/generated/pkg/genruntime/base_types.go | 4 ++-- .../pkg/reconcilers/azure_deployment_reconciler.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hack/generated/pkg/genruntime/base_types.go b/hack/generated/pkg/genruntime/base_types.go index 87c331b7705..b4715a8efe4 100644 --- a/hack/generated/pkg/genruntime/base_types.go +++ b/hack/generated/pkg/genruntime/base_types.go @@ -107,7 +107,7 @@ type ARMResource interface { Status() ARMResourceStatus // TODO: Golang wants this to be GetID - GetId() string // TODO: Should this be on Status instead? + GetID() string // TODO: Should this be on Status instead? } func NewArmResource(spec ARMResourceSpec, status ARMResourceStatus, id string) ARMResource { @@ -134,7 +134,7 @@ func (resource *armResourceImpl) Status() ARMResourceStatus { return resource.status } -func (resource *armResourceImpl) GetId() string { +func (resource *armResourceImpl) GetID() string { return resource.Id } diff --git a/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go b/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go index d2363d03e16..71a89a1f085 100644 --- a/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go +++ b/hack/generated/pkg/reconcilers/azure_deployment_reconciler.go @@ -384,11 +384,11 @@ func (r *AzureDeploymentReconciler) StartDeleteOfResource(ctx context.Context) ( emptyStatus, err := reflecthelpers.NewEmptyArmResourceStatus(r.obj) if err != nil { - return ctrl.Result{}, errors.Wrapf(err, "creating empty status for %q", resource.GetId()) + return ctrl.Result{}, errors.Wrapf(err, "creating empty status for %q", resource.GetID()) } // retryAfter = ARM can tell us how long to wait for a DELETE - retryAfter, err := r.ARMClient.BeginDeleteResource(ctx, resource.GetId(), resource.Spec().GetAPIVersion(), emptyStatus) + retryAfter, err := r.ARMClient.BeginDeleteResource(ctx, resource.GetID(), resource.Spec().GetAPIVersion(), emptyStatus) if err != nil { return ctrl.Result{}, errors.Wrapf(err, "deleting resource %q", resource.Spec().GetType()) } @@ -424,7 +424,7 @@ func (r *AzureDeploymentReconciler) MonitorDelete(ctx context.Context) (ctrl.Res } // already deleting, just check to see if it still exists and if it's gone, remove finalizer - found, retryAfter, err := r.ARMClient.HeadResource(ctx, resource.GetId(), resource.Spec().GetAPIVersion()) + found, retryAfter, err := r.ARMClient.HeadResource(ctx, resource.GetID(), resource.Spec().GetAPIVersion()) if err != nil { if retryAfter != 0 { r.log.V(3).Info("Error performing HEAD on resource, will retry", "delaySec", retryAfter/time.Second)