Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 2fc49a0

Browse files
committed
Cleanup
1 parent fdc3753 commit 2fc49a0

5 files changed

Lines changed: 11 additions & 32 deletions

File tree

apis/network/v1alpha3/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The Crossplane Authors.
2+
Copyright 2021 The Crossplane Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ var (
5353
SubnetGroupVersionKind = SchemeGroupVersion.WithKind(SubnetKind)
5454
)
5555

56-
// Subnet type metadata.
56+
// DdosProtectionPlan type metadata.
5757
var (
5858
DdosProtectionPlanKind = reflect.TypeOf(DdosProtectionPlan{}).Name()
5959
DdosProtectionPlanGroupKind = schema.GroupKind{Group: Group, Kind: DdosProtectionPlanKind}.String()

apis/network/v1alpha3/types.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The Crossplane Authors.
2+
Copyright 2021 The Crossplane Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -236,9 +236,6 @@ type DdosProtectionPlanPropertiesFormat struct {
236236
// ProvisioningState - The provisioning state of the DDoS protection plan resource.
237237
// +optional
238238
ProvisioningState *string `json:"provisioningState,omitempty"`
239-
240-
// VirtualNetworks - The list of virtual networks associated with the DDoS protection plan resource.
241-
// VirtualNetworks *[]network.SubResource `json:"virtualNetworks,omitempty"`
242239
}
243240

244241
// A DdosProtectionPlanSpec defines the desired state of a DdosProtectionPlan.
@@ -256,13 +253,13 @@ type DdosProtectionPlanSpec struct {
256253
// +optional
257254
DdosProtectionPlanPropertiesFormat `json:"properties,omitempty"`
258255

259-
// ResourceGroupName - Name of the Subnet's resource group.
256+
// ResourceGroupName - Name of the Ddos Protection Plan's resource group.
260257
ResourceGroupName string `json:"resourceGroupName,omitempty"`
261258

262-
// ResourceGroupNameRef - A reference to the the Subnets's resource group.
259+
// ResourceGroupNameRef - A reference to the the Ddos Protection Plan's resource group.
263260
ResourceGroupNameRef *xpv1.Reference `json:"resourceGroupNameRef,omitempty"`
264261

265-
// ResourceGroupNameSelector - Selects a reference to the the Subnets's
262+
// ResourceGroupNameSelector - Selects a reference to the the Ddos Protection Plan's
266263
// resource group.
267264
ResourceGroupNameSelector *xpv1.Selector `json:"resourceGroupNameSelector,omitempty"`
268265
}

package/crds/network.azure.crossplane.io_ddosprotectionplans.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ spec:
8888
- name
8989
type: object
9090
resourceGroupName:
91-
description: ResourceGroupName - Name of the Subnet's resource group.
91+
description: ResourceGroupName - Name of the Ddos Protection Plan's resource group.
9292
type: string
9393
resourceGroupNameRef:
94-
description: ResourceGroupNameRef - A reference to the the Subnets's resource group.
94+
description: ResourceGroupNameRef - A reference to the the Ddos Protection Plan's resource group.
9595
properties:
9696
name:
9797
description: Name of the referenced object.
@@ -100,7 +100,7 @@ spec:
100100
- name
101101
type: object
102102
resourceGroupNameSelector:
103-
description: ResourceGroupNameSelector - Selects a reference to the the Subnets's resource group.
103+
description: ResourceGroupNameSelector - Selects a reference to the the Ddos Protection Plan's resource group.
104104
properties:
105105
matchControllerRef:
106106
description: MatchControllerRef ensures an object with the same controller reference as the selecting object is selected.

pkg/clients/network/network.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The Crossplane Authors.
2+
Copyright 2021 The Crossplane Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -107,8 +107,6 @@ func UpdateSubnetStatusFromAzure(v *v1alpha3.Subnet, az networkmgmt.Subnet) {
107107
v.Status.Purpose = azure.ToString(az.Purpose)
108108
}
109109

110-
// --------------------------------------------------------------------------------------------------- //
111-
112110
// NewDdosProtectionPlanParameters returns an Azure DdosProtectionPlan object from a ddosProtectionPlan spec
113111
func NewDdosProtectionPlanParameters(d *v1alpha3.DdosProtectionPlan) networkmgmt.DdosProtectionPlan {
114112
return networkmgmt.DdosProtectionPlan{

pkg/controller/network/ddosprotectionplan/managed.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019 The Crossplane Authors.
2+
Copyright 2021 The Crossplane Authors.
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
@@ -15,7 +15,6 @@ package ddosprotectionplan
1515

1616
import (
1717
"context"
18-
"fmt"
1918

2019
azurenetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network"
2120
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-06-01/network/networkapi"
@@ -89,16 +88,13 @@ func (c *connecter) Connect(ctx context.Context, mg resource.Managed) (managed.E
8988
}
9089

9190
func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.ExternalObservation, error) {
92-
fmt.Println("=====================OBSERVE START=====================")
9391
d, ok := mg.(*v1alpha3.DdosProtectionPlan)
9492
if !ok {
95-
fmt.Println("=====================OBSERVE END ONE=====================")
9693
return managed.ExternalObservation{}, errors.New(errNotDdosProtectionPlan)
9794
}
9895

9996
az, err := e.client.Get(ctx, d.Spec.ResourceGroupName, meta.GetExternalName(d))
10097
if err != nil {
101-
fmt.Println("=====================OBSERVE END THREE=====================")
10298
return managed.ExternalObservation{}, errors.Wrap(resource.Ignore(azureclients.IsNotFound, err), errGetDdosProtectionPlan)
10399
}
104100

@@ -120,12 +116,10 @@ func (e *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex
120116
},
121117
}
122118

123-
fmt.Println("=====================OBSERVE END LAST=====================")
124119
return o, nil
125120
}
126121

127122
func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.ExternalCreation, error) {
128-
fmt.Println("***********************CREATE START***********************")
129123
d, ok := mg.(*v1alpha3.DdosProtectionPlan)
130124
if !ok {
131125
return managed.ExternalCreation{}, errors.New(errNotDdosProtectionPlan)
@@ -136,49 +130,39 @@ func (e *external) Create(ctx context.Context, mg resource.Managed) (managed.Ext
136130
ddos := network.NewDdosProtectionPlanParameters(d)
137131

138132
if _, err := e.client.CreateOrUpdate(ctx, d.Spec.ResourceGroupName, meta.GetExternalName(d), ddos); err != nil {
139-
fmt.Println("***********************CREATE END ONE***********************")
140133
return managed.ExternalCreation{}, errors.Wrap(err, errCreateDdosProtectionPlan)
141134
}
142-
fmt.Println("***********************CREATE END LAST***********************")
143135
return managed.ExternalCreation{}, nil
144136
}
145137

146138
func (e *external) Update(ctx context.Context, mg resource.Managed) (managed.ExternalUpdate, error) {
147-
fmt.Println("^^^^^^^^^^^^^^^^^^^^UPDATE START^^^^^^^^^^^^^^^^^^^^")
148139
d, ok := mg.(*v1alpha3.DdosProtectionPlan)
149140
if !ok {
150-
fmt.Println("^^^^^^^^^^^^^^^^^^^^UPDATE END ONE^^^^^^^^^^^^^^^^^^^^")
151141
return managed.ExternalUpdate{}, errors.New(errNotDdosProtectionPlan)
152142
}
153143

154144
az, err := e.client.Get(ctx, d.Spec.ResourceGroupName, meta.GetExternalName(d))
155145
if err != nil {
156-
fmt.Println("^^^^^^^^^^^^^^^^^^^^UPDATE END TWO^^^^^^^^^^^^^^^^^^^^")
157146
return managed.ExternalUpdate{}, errors.Wrap(err, errGetDdosProtectionPlan)
158147
}
159148

160149
if !network.IsDdosProtectionPlanUpToDate(d, az) {
161150
ddos := network.NewDdosProtectionPlanParameters(d)
162151
if _, err := e.client.CreateOrUpdate(ctx, d.Spec.ResourceGroupName, meta.GetExternalName(d), ddos); err != nil {
163-
fmt.Println("^^^^^^^^^^^^^^^^^^^^UPDATE END THREE^^^^^^^^^^^^^^^^^^^^")
164152
return managed.ExternalUpdate{}, errors.Wrap(err, errUpdateDdosProtectionPlan)
165153
}
166154
}
167-
fmt.Println("^^^^^^^^^^^^^^^^^^^^UPDATE END LAST^^^^^^^^^^^^^^^^^^^^")
168155
return managed.ExternalUpdate{}, nil
169156
}
170157

171158
func (e *external) Delete(ctx context.Context, mg resource.Managed) error {
172-
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!DELETE START!!!!!!!!!!!!!!!!!!!!!!!!!")
173159
d, ok := mg.(*v1alpha3.DdosProtectionPlan)
174160
if !ok {
175-
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!DELETE END ONE!!!!!!!!!!!!!!!!!!!!!!!!!")
176161
return errors.New(errNotDdosProtectionPlan)
177162
}
178163

179164
mg.SetConditions(xpv1.Deleting())
180165

181166
_, err := e.client.Delete(ctx, d.Spec.ResourceGroupName, meta.GetExternalName(d))
182-
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!DELETE LAST!!!!!!!!!!!!!!!!!!!!!!!!!")
183167
return errors.Wrap(resource.Ignore(azureclients.IsNotFound, err), errDeleteDdosProtectionPlan)
184168
}

0 commit comments

Comments
 (0)