Skip to content

Commit

Permalink
Add example converter tool for reference
Browse files Browse the repository at this point in the history
Signed-off-by: Sergen Yalçın <[email protected]>
  • Loading branch information
sergenyalcin committed May 21, 2024
1 parent c0643d6 commit eae946f
Show file tree
Hide file tree
Showing 16 changed files with 1,328 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cmd/converter/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package converter

import (
"context"
"testing"

"github.com/crossplane/upjet/pkg/examples/conversion"

"github.com/upbound/provider-azure/config"
)

func Test(t *testing.T) {
pc, err := config.GetProvider(context.TODO(), false)
if err != nil {
panic(err)
}

if err = conversion.ConvertSingletonListToEmbeddedObject(pc,
"../examples",
"../hack/boilerplate.go.txt"); err != nil {
panic(err)
}
}
38 changes: 38 additions & 0 deletions examples/cache/v1beta2/rediscache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: cache.azure.upbound.io/v1beta2
kind: RedisCache
metadata:
annotations:
meta.upbound.io/example-id: cache/v1beta2/rediscache
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
capacity: 2
enableNonSslPort: false
family: C
location: West Europe
minimumTlsVersion: "1.2"
redisConfiguration: {}
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example
skuName: Standard

---

apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
metadata:
annotations:
meta.upbound.io/example-id: cache/v1beta2/rediscache
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
location: West Europe
266 changes: 266 additions & 0 deletions examples/compute/v1beta2/virtualmachineruncommand.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: compute.azure.upbound.io/v1beta2
kind: VirtualMachineRunCommand
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
location: West Europe
source:
- script: echo 'hello world'
virtualMachineIdSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: compute.azure.upbound.io/v1beta2
kind: LinuxVirtualMachine
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
adminPasswordSecretRef:
key: example-key
name: example-secret
namespace: upbound-system
adminUsername: adminuser
disablePasswordAuthentication: false
identity:
- identityIds:
- ${azurerm_user_assigned_identity.example.id}
type: SystemAssigned, UserAssigned
location: West Europe
networkInterfaceIdsRefs:
- name: example
osDisk:
- caching: ReadWrite
storageAccountType: Premium_LRS
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example
size: Standard_B2s
sourceImageReference:
- offer: 0001-com-ubuntu-server-jammy
publisher: Canonical
sku: 22_04-lts
version: latest

---

apiVersion: network.azure.upbound.io/v1beta1
kind: NetworkInterface
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
ipConfiguration:
- name: internal
privateIpAddressAllocation: Dynamic
subnetIdSelector:
matchLabels:
testing.upbound.io/example-name: example
location: West Europe
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
location: West Europe

---

apiVersion: authorization.azure.upbound.io/v1beta1
kind: RoleAssignment
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
principalId: ${azurerm_user_assigned_identity.example.principal_id}
roleDefinitionName: Storage Blob Data Contributor
scope: ${azurerm_storage_account.example.id}

---

apiVersion: storage.azure.upbound.io/v1beta2
kind: Account
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
accountReplicationType: LRS
accountTier: Standard
location: West Europe
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: storage.azure.upbound.io/v1beta1
kind: Blob
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example1
name: example1
spec:
forProvider:
sourceContent: echo 'hello world'
storageAccountNameSelector:
matchLabels:
testing.upbound.io/example-name: example
storageContainerNameSelector:
matchLabels:
testing.upbound.io/example-name: example
type: Block

---

apiVersion: storage.azure.upbound.io/v1beta1
kind: Blob
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example2
name: example2
spec:
forProvider:
storageAccountNameSelector:
matchLabels:
testing.upbound.io/example-name: example
storageContainerNameSelector:
matchLabels:
testing.upbound.io/example-name: example
type: Append

---

apiVersion: storage.azure.upbound.io/v1beta1
kind: Blob
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example3
name: example3
spec:
forProvider:
storageAccountNameSelector:
matchLabels:
testing.upbound.io/example-name: example
storageContainerNameSelector:
matchLabels:
testing.upbound.io/example-name: example
type: Append

---

apiVersion: storage.azure.upbound.io/v1beta1
kind: Container
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
containerAccessType: blob
storageAccountNameSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: network.azure.upbound.io/v1beta2
kind: Subnet
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
addressPrefixes:
- 10.0.2.0/24
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example
virtualNetworkNameSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: managedidentity.azure.upbound.io/v1beta1
kind: UserAssignedIdentity
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
location: West Europe
name: example-uai
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example

---

apiVersion: network.azure.upbound.io/v1beta2
kind: VirtualNetwork
metadata:
annotations:
meta.upbound.io/example-id: compute/v1beta2/virtualmachineruncommand
labels:
testing.upbound.io/example-name: example
name: example
spec:
forProvider:
addressSpace:
- 10.0.0.0/16
location: West Europe
resourceGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: example
Loading

0 comments on commit eae946f

Please sign in to comment.