Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apis/network/v1alpha3/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,24 @@ func (mg *Subnet) ResolveReferences(ctx context.Context, c client.Reader) error

return nil
}

// ResolveReferences of this PublicIPAddress
func (mg *PublicIPAddress) ResolveReferences(ctx context.Context, c client.Reader) error {
r := reference.NewAPIResolver(c, mg)

// Resolve spec.resourceGroupName
rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: mg.Spec.ForProvider.ResourceGroupName,
Reference: mg.Spec.ForProvider.ResourceGroupNameRef,
Selector: mg.Spec.ForProvider.ResourceGroupNameSelector,
To: reference.To{Managed: &v1alpha3.ResourceGroup{}, List: &v1alpha3.ResourceGroupList{}},
Extract: reference.ExternalName(),
})
if err != nil {
return errors.Wrap(err, "spec.forProvider.resourceGroupName")
}
mg.Spec.ForProvider.ResourceGroupName = rsp.ResolvedValue
mg.Spec.ForProvider.ResourceGroupNameRef = rsp.ResolvedReference

return nil
}
9 changes: 9 additions & 0 deletions apis/network/v1alpha3/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ var (
SubnetGroupVersionKind = SchemeGroupVersion.WithKind(SubnetKind)
)

// PublicIpAddress type metadata.
var (
PublicIPAddressKind = reflect.TypeOf(PublicIPAddress{}).Name()
PublicIPAddressGroupKind = schema.GroupKind{Group: Group, Kind: PublicIPAddressKind}.String()
PublicIPAddressKindAPIVersion = PublicIPAddressKind + "." + SchemeGroupVersion.String()
PublicIPAddressGroupVersionKind = SchemeGroupVersion.WithKind(PublicIPAddressKind)
)

func init() {
SchemeBuilder.Register(&VirtualNetwork{}, &VirtualNetworkList{})
SchemeBuilder.Register(&Subnet{}, &SubnetList{})
SchemeBuilder.Register(&PublicIPAddress{}, &PublicIPAddressList{})
}
102 changes: 102 additions & 0 deletions apis/network/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,105 @@ type SubnetList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []Subnet `json:"items"`
}

// A PublicIPAddressSpec defines the desired state of a PublicIPAddress.
type PublicIPAddressSpec struct {
xpv1.ResourceSpec `json:",inline"`
// +kubebuilder:validation:Required
ForProvider PublicIPAddressFormat `json:"properties"`
}

// PublicIPAddressFormat defines properties of the PublicIPAddress.
type PublicIPAddressFormat struct {
// ResourceGroupName - Name of the Public IP address's resource group.
// +immutable
ResourceGroupName string `json:"resourceGroupName,omitempty"`
Comment thread
vaspahomov marked this conversation as resolved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// ResourceGroupNameRef - A reference to the the Public IP address's resource
// group.
// +immutable
// +optional
ResourceGroupNameRef *xpv1.Reference `json:"resourceGroupNameRef,omitempty"`
Comment thread
vaspahomov marked this conversation as resolved.

// ResourceGroupNameSelector - Select a reference to the Public IP address's
// resource group.
// +optional
ResourceGroupNameSelector *xpv1.Selector `json:"resourceGroupNameSelector,omitempty"`
Comment thread
vaspahomov marked this conversation as resolved.
Outdated

// PublicIPAllocationMethod - The public IP address allocation method. Possible values include: 'Static', 'Dynamic'
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=Static;Dynamic
PublicIPAllocationMethod string `json:"allocationMethod"`
Comment thread
vaspahomov marked this conversation as resolved.

// PublicIPAllocationMethod - The public IP address version. Possible values include: 'IPV4', 'IPV6'
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=IPV4;IPV6
PublicIPAddressVersion string `json:"version"`
Comment thread
vaspahomov marked this conversation as resolved.

// Location - Resource location.
// +optional
Location *string `json:"location,omitempty"`

// SKU of PublicIPAddress
// +optional
SKU *SKU `json:"sku,omitempty"`

// Tags - Resource tags.
// +optional
Tags map[string]*string `json:"tags,omitempty"`
}

// SKU of PublicIPAddress
type SKU struct {
// Name - Name of sku. Possible values include: ['Standard', 'Basic']
// +kubebuilder:validation:Enum=Standard;Basic
Name string `json:"name,omitempty"`
}

// A PublicIPAddressStatus represents the observed state of a PublicIPAddress.
type PublicIPAddressStatus struct {
xpv1.ResourceStatus `json:",inline"`

// State of this PublicIPAddress.
State string `json:"state,omitempty"`

// A Message providing detail about the state of this PublicIPAddress, if any.
Message string `json:"message,omitempty"`

// Etag - A unique string that changes whenever the resource is updated.
Etag string `json:"etag,omitempty"`

// ID of this PublicIPAddress.
ID string `json:"id,omitempty"`

// Address - A string identifying address of PublicIPAddress resource
Address string `json:"address"`
}

// +kubebuilder:object:root=true

// A PublicIPAddress is a managed resource that represents an Azure PublicIPAddress.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="STATE",type="string",JSONPath=".status.state"
// +kubebuilder:printcolumn:name="LOCATION",type="string",JSONPath=".spec.properties.location"
// +kubebuilder:printcolumn:name="ADDRESS",type="string",JSONPath=".status.address"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,azure}
type PublicIPAddress struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PublicIPAddressSpec `json:"spec"`
Status PublicIPAddressStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// PublicIPAddressList contains a list of PublicIPAddress items
type PublicIPAddressList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PublicIPAddress `json:"items"`
}
157 changes: 157 additions & 0 deletions apis/network/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions apis/network/v1alpha3/zz_generated.managed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions apis/network/v1alpha3/zz_generated.managedlist.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading