github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/pkg/oam.go (about) 1 // Copyright (c) 2021, 2022, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package pkg 5 6 import ( 7 "context" 8 oamcore "github.com/crossplane/oam-kubernetes-runtime/apis/core/v1alpha2" 9 10 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 11 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 12 "k8s.io/apimachinery/pkg/runtime/schema" 13 ) 14 15 // GetAppConfig returns the specified appconfig in a given namespace 16 func GetAppConfig(namespace string, name string) (*unstructured.Unstructured, error) { 17 client, err := GetDynamicClient() 18 if err != nil { 19 return nil, err 20 } 21 a, err := client.Resource(getOamAppConfigScheme()).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{}) 22 if err != nil { 23 return nil, err 24 } 25 return a, nil 26 } 27 28 // getOamAppConfigScheme returns the appconfig scheme needed to get unstructured data 29 func getOamAppConfigScheme() schema.GroupVersionResource { 30 return schema.GroupVersionResource{ 31 Group: oamcore.Group, 32 Version: oamcore.Version, 33 Resource: "applicationconfigurations", 34 } 35 }