github.com/cloudwan/edgelq-sdk@v1.15.4/logging/resources/v1/bucket/bucket.pb.parentname.go (about)

     1  // Code generated by protoc-gen-goten-resource
     2  // Resource: Bucket
     3  // DO NOT EDIT!!!
     4  
     5  package bucket
     6  
     7  import (
     8  	"fmt"
     9  	"net/url"
    10  	"reflect"
    11  	"regexp"
    12  	"strings"
    13  
    14  	"google.golang.org/grpc/codes"
    15  	"google.golang.org/grpc/status"
    16  	"google.golang.org/protobuf/proto"
    17  
    18  	"github.com/cloudwan/goten-sdk/runtime/goten"
    19  	gotenresource "github.com/cloudwan/goten-sdk/runtime/resource"
    20  )
    21  
    22  // proto imports
    23  import (
    24  	iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    25  	iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    26  	log_descriptor "github.com/cloudwan/edgelq-sdk/logging/resources/v1/log_descriptor"
    27  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    28  	meta "github.com/cloudwan/goten-sdk/types/meta"
    29  )
    30  
    31  // ensure the imports are used
    32  var (
    33  	_ = codes.NotFound
    34  	_ = new(fmt.Stringer)
    35  	_ = new(proto.Message)
    36  	_ = status.Status{}
    37  	_ = url.URL{}
    38  	_ = strings.Builder{}
    39  
    40  	_ = new(goten.GotenMessage)
    41  	_ = new(gotenresource.ListQuery)
    42  )
    43  
    44  // make sure we're using proto imports
    45  var (
    46  	_ = &iam_organization.Organization{}
    47  	_ = &iam_project.Project{}
    48  	_ = &log_descriptor.LogDescriptor{}
    49  	_ = &meta_service.Service{}
    50  	_ = &meta.Meta{}
    51  )
    52  
    53  var parentRegexPath_Project_Region = regexp.MustCompile("^projects/(?P<project_id>-|[\\w][\\w.-]{0,127})/regions/(?P<region_id>-|[a-z][a-z0-9\\-]{0,28}[a-z0-9])$")
    54  var parentRegexPath_Organization_Region = regexp.MustCompile("^organizations/(?P<organization_id>-|[\\w][\\w.-]{0,127})/regions/(?P<region_id>-|[a-z][a-z0-9\\-]{0,28}[a-z0-9])$")
    55  var parentRegexPath_Service_Region = regexp.MustCompile("^services/(?P<service_id>-|[a-z][a-z0-9\\-.]{0,28}[a-z0-9])/regions/(?P<region_id>-|[a-z][a-z0-9\\-]{0,28}[a-z0-9])$")
    56  
    57  type ParentName struct {
    58  	NamePattern
    59  	ProjectId      string `firestore:"projectId"`
    60  	RegionId       string `firestore:"regionId"`
    61  	OrganizationId string `firestore:"organizationId"`
    62  	ServiceId      string `firestore:"serviceId"`
    63  }
    64  
    65  func ParseParentName(name string) (*ParentName, error) {
    66  	var matches []string
    67  	if matches = parentRegexPath_Project_Region.FindStringSubmatch(name); matches != nil {
    68  		return NewNameBuilder().
    69  			SetProjectId(matches[1]).
    70  			SetRegionId(matches[2]).
    71  			Parent(), nil
    72  	}
    73  	if matches = parentRegexPath_Organization_Region.FindStringSubmatch(name); matches != nil {
    74  		return NewNameBuilder().
    75  			SetOrganizationId(matches[1]).
    76  			SetRegionId(matches[2]).
    77  			Parent(), nil
    78  	}
    79  	if matches = parentRegexPath_Service_Region.FindStringSubmatch(name); matches != nil {
    80  		return NewNameBuilder().
    81  			SetServiceId(matches[1]).
    82  			SetRegionId(matches[2]).
    83  			Parent(), nil
    84  	}
    85  
    86  	return nil, status.Errorf(codes.InvalidArgument, "unable to parse '%s' as Bucket parent name", name)
    87  }
    88  
    89  func MustParseParentName(name string) *ParentName {
    90  	result, err := ParseParentName(name)
    91  	if err != nil {
    92  		panic(err)
    93  	}
    94  	return result
    95  }
    96  
    97  func (name *ParentName) SetFromSegments(segments gotenresource.NameSegments) error {
    98  	if len(segments) == 2 && segments[0].CollectionLowerJson == "projects" && segments[1].CollectionLowerJson == "regions" {
    99  		name.Pattern = NamePattern_Project_Region
   100  		name.ProjectId = segments[0].Id
   101  		name.RegionId = segments[1].Id
   102  		return nil
   103  	} else if len(segments) == 2 && segments[0].CollectionLowerJson == "organizations" && segments[1].CollectionLowerJson == "regions" {
   104  		name.Pattern = NamePattern_Organization_Region
   105  		name.OrganizationId = segments[0].Id
   106  		name.RegionId = segments[1].Id
   107  		return nil
   108  	} else if len(segments) == 2 && segments[0].CollectionLowerJson == "services" && segments[1].CollectionLowerJson == "regions" {
   109  		name.Pattern = NamePattern_Service_Region
   110  		name.ServiceId = segments[0].Id
   111  		name.RegionId = segments[1].Id
   112  		return nil
   113  	}
   114  	return status.Errorf(codes.InvalidArgument, "unable to use segments %s to form Bucket parent name", segments)
   115  }
   116  
   117  func (name *ParentName) GetProjectName() *iam_project.Name {
   118  	if name == nil {
   119  		return nil
   120  	}
   121  
   122  	switch name.Pattern {
   123  	case NamePattern_Project_Region:
   124  		return iam_project.NewNameBuilder().
   125  			SetId(name.ProjectId).
   126  			Name()
   127  	default:
   128  		return nil
   129  	}
   130  }
   131  
   132  func (name *ParentName) GetOrganizationName() *iam_organization.Name {
   133  	if name == nil {
   134  		return nil
   135  	}
   136  
   137  	switch name.Pattern {
   138  	case NamePattern_Organization_Region:
   139  		return iam_organization.NewNameBuilder().
   140  			SetId(name.OrganizationId).
   141  			Name()
   142  	default:
   143  		return nil
   144  	}
   145  }
   146  
   147  func (name *ParentName) GetServiceName() *meta_service.Name {
   148  	if name == nil {
   149  		return nil
   150  	}
   151  
   152  	switch name.Pattern {
   153  	case NamePattern_Service_Region:
   154  		return meta_service.NewNameBuilder().
   155  			SetId(name.ServiceId).
   156  			Name()
   157  	default:
   158  		return nil
   159  	}
   160  }
   161  
   162  func (name *ParentName) IsSpecified() bool {
   163  	if name == nil || name.Pattern == "" {
   164  		return false
   165  	}
   166  	switch name.Pattern {
   167  	case NamePattern_Project_Region:
   168  		return name.ProjectId != "" && name.RegionId != ""
   169  	case NamePattern_Organization_Region:
   170  		return name.OrganizationId != "" && name.RegionId != ""
   171  	case NamePattern_Service_Region:
   172  		return name.ServiceId != "" && name.RegionId != ""
   173  	}
   174  	return false
   175  }
   176  
   177  func (name *ParentName) IsFullyQualified() bool {
   178  	if name == nil || name.Pattern == "" {
   179  		return false
   180  	}
   181  
   182  	switch name.Pattern {
   183  	case NamePattern_Project_Region:
   184  		return name.ProjectId != "" && name.ProjectId != gotenresource.WildcardId && name.RegionId != "" && name.RegionId != gotenresource.WildcardId
   185  	case NamePattern_Organization_Region:
   186  		return name.OrganizationId != "" && name.OrganizationId != gotenresource.WildcardId && name.RegionId != "" && name.RegionId != gotenresource.WildcardId
   187  	case NamePattern_Service_Region:
   188  		return name.ServiceId != "" && name.ServiceId != gotenresource.WildcardId && name.RegionId != "" && name.RegionId != gotenresource.WildcardId
   189  	}
   190  
   191  	return false
   192  }
   193  
   194  func (name *ParentName) FullyQualifiedName() (string, error) {
   195  	if !name.IsFullyQualified() {
   196  		return "", status.Errorf(codes.InvalidArgument, "Parent name for Bucket is not fully qualified")
   197  	}
   198  	return fmt.Sprintf("//logging.edgelq.com/%s", name.String()), nil
   199  }
   200  
   201  func (name *ParentName) GetResourceDescriptor() gotenresource.Descriptor {
   202  	return descriptor
   203  }
   204  
   205  func (name *ParentName) GetPattern() gotenresource.NamePattern {
   206  	if name == nil {
   207  		return ""
   208  	}
   209  	return name.Pattern
   210  }
   211  
   212  func (name *ParentName) GetIdParts() map[string]string {
   213  	if name != nil {
   214  		return map[string]string{
   215  			"projectId":      name.ProjectId,
   216  			"regionId":       name.RegionId,
   217  			"organizationId": name.OrganizationId,
   218  			"serviceId":      name.ServiceId,
   219  		}
   220  	}
   221  	return map[string]string{
   222  		"projectId":      "",
   223  		"regionId":       "",
   224  		"organizationId": "",
   225  		"serviceId":      "",
   226  	}
   227  }
   228  
   229  func (name *ParentName) GetSegments() gotenresource.NameSegments {
   230  	if name == nil {
   231  		return nil
   232  	}
   233  
   234  	switch name.Pattern {
   235  	case NamePattern_Project_Region:
   236  		return gotenresource.NameSegments{
   237  			gotenresource.NameSegment{
   238  				CollectionLowerJson: "projects",
   239  				Id:                  name.ProjectId,
   240  			},
   241  			gotenresource.NameSegment{
   242  				CollectionLowerJson: "regions",
   243  				Id:                  name.RegionId,
   244  			},
   245  		}
   246  	case NamePattern_Organization_Region:
   247  		return gotenresource.NameSegments{
   248  			gotenresource.NameSegment{
   249  				CollectionLowerJson: "organizations",
   250  				Id:                  name.OrganizationId,
   251  			},
   252  			gotenresource.NameSegment{
   253  				CollectionLowerJson: "regions",
   254  				Id:                  name.RegionId,
   255  			},
   256  		}
   257  	case NamePattern_Service_Region:
   258  		return gotenresource.NameSegments{
   259  			gotenresource.NameSegment{
   260  				CollectionLowerJson: "services",
   261  				Id:                  name.ServiceId,
   262  			},
   263  			gotenresource.NameSegment{
   264  				CollectionLowerJson: "regions",
   265  				Id:                  name.RegionId,
   266  			},
   267  		}
   268  	}
   269  	return nil
   270  }
   271  
   272  func (name *ParentName) GetIParentName() gotenresource.Name {
   273  	return nil
   274  }
   275  
   276  func (name *ParentName) GetIUnderlyingParentName() gotenresource.Name {
   277  	return nil
   278  }
   279  
   280  func (name *ParentName) String() string {
   281  	if name == nil {
   282  		return "<nil>"
   283  	}
   284  
   285  	if valueStr, err := name.ProtoString(); err != nil {
   286  		panic(err)
   287  	} else {
   288  		return valueStr
   289  	}
   290  }
   291  
   292  func (name *ParentName) DescendsFrom(ancestor string) bool {
   293  	if name == nil {
   294  		return false
   295  	}
   296  
   297  	switch name.Pattern {
   298  	case NamePattern_Project_Region:
   299  		return ancestor == "projects" || ancestor == "regions"
   300  	case NamePattern_Organization_Region:
   301  		return ancestor == "organizations" || ancestor == "regions"
   302  	case NamePattern_Service_Region:
   303  		return ancestor == "services" || ancestor == "regions"
   304  	}
   305  
   306  	return false
   307  }
   308  
   309  func (name *ParentName) AsReference() *ParentReference {
   310  	return &ParentReference{ParentName: *name}
   311  }
   312  
   313  func (name *ParentName) AsRawReference() gotenresource.Reference {
   314  	return name.AsReference()
   315  }
   316  
   317  // implement methods required by protobuf-go library for string-struct conversion
   318  
   319  func (name *ParentName) ProtoString() (string, error) {
   320  	if name == nil {
   321  		return "", nil
   322  	}
   323  	switch name.Pattern {
   324  	case NamePattern_Project_Region:
   325  		return "projects/" + name.ProjectId + "/regions/" + name.RegionId, nil
   326  	case NamePattern_Organization_Region:
   327  		return "organizations/" + name.OrganizationId + "/regions/" + name.RegionId, nil
   328  	case NamePattern_Service_Region:
   329  		return "services/" + name.ServiceId + "/regions/" + name.RegionId, nil
   330  	}
   331  	return "", nil
   332  }
   333  
   334  func (name *ParentName) ParseProtoString(data string) error {
   335  	parsed, err := ParseParentName(data)
   336  	if err != nil {
   337  		return err
   338  	}
   339  	*name = *parsed
   340  	return nil
   341  }
   342  
   343  // GotenEqual returns true if other is of same type and paths are equal (implements goten.Equaler interface)
   344  func (name *ParentName) GotenEqual(other interface{}) bool {
   345  	if other == nil {
   346  		return name == nil
   347  	}
   348  	other1, ok := other.(*ParentName)
   349  	if !ok {
   350  		other2, ok := other.(ParentName)
   351  		if ok {
   352  			other1 = &other2
   353  		} else {
   354  			return false
   355  		}
   356  	}
   357  	if other1 == nil {
   358  		return name == nil
   359  	} else if name == nil {
   360  		return false
   361  	}
   362  	if name.ProjectId != other1.ProjectId {
   363  		return false
   364  	}
   365  	if name.RegionId != other1.RegionId {
   366  		return false
   367  	}
   368  	if name.OrganizationId != other1.OrganizationId {
   369  		return false
   370  	}
   371  	if name.ServiceId != other1.ServiceId {
   372  		return false
   373  	}
   374  	if name.Pattern != other1.Pattern {
   375  		return false
   376  	}
   377  
   378  	return true
   379  }
   380  
   381  // Matches is same as GotenEqual, but also will accept "other" if name is wildcard.
   382  func (name *ParentName) Matches(other interface{}) bool {
   383  	if other == nil {
   384  		return name == nil
   385  	}
   386  	other1, ok := other.(*ParentName)
   387  	if !ok {
   388  		other2, ok := other.(ParentName)
   389  		if ok {
   390  			other1 = &other2
   391  		} else {
   392  			return false
   393  		}
   394  	}
   395  	if other1 == nil {
   396  		return name == nil
   397  	} else if name == nil {
   398  		return false
   399  	}
   400  
   401  	if name.Pattern != other1.Pattern {
   402  		return false
   403  	}
   404  	switch name.Pattern {
   405  	case NamePattern_Project_Region:
   406  		if name.ProjectId != other1.ProjectId &&
   407  			name.ProjectId != gotenresource.WildcardId {
   408  			return false
   409  		}
   410  		if name.RegionId != other1.RegionId &&
   411  			name.RegionId != gotenresource.WildcardId {
   412  			return false
   413  		}
   414  	case NamePattern_Organization_Region:
   415  		if name.OrganizationId != other1.OrganizationId &&
   416  			name.OrganizationId != gotenresource.WildcardId {
   417  			return false
   418  		}
   419  		if name.RegionId != other1.RegionId &&
   420  			name.RegionId != gotenresource.WildcardId {
   421  			return false
   422  		}
   423  	case NamePattern_Service_Region:
   424  		if name.ServiceId != other1.ServiceId &&
   425  			name.ServiceId != gotenresource.WildcardId {
   426  			return false
   427  		}
   428  		if name.RegionId != other1.RegionId &&
   429  			name.RegionId != gotenresource.WildcardId {
   430  			return false
   431  		}
   432  	}
   433  
   434  	return true
   435  }
   436  
   437  // implement CustomTypeCliValue method
   438  func (name *ParentName) SetFromCliFlag(raw string) error {
   439  	parsedName, err := ParseParentName(raw)
   440  	if err != nil {
   441  		return err
   442  	}
   443  	*name = *parsedName
   444  	return nil
   445  }
   446  
   447  type ParentReference struct {
   448  	ParentName
   449  	project      *iam_project.Project
   450  	organization *iam_organization.Organization
   451  	service      *meta_service.Service
   452  }
   453  
   454  func MakeParentReference(name *ParentName) (*ParentReference, error) {
   455  	return &ParentReference{
   456  		ParentName: *name,
   457  	}, nil
   458  }
   459  
   460  func ParseParentReference(name string) (*ParentReference, error) {
   461  	parsedName, err := ParseParentName(name)
   462  	if err != nil {
   463  		return nil, err
   464  	}
   465  	return MakeParentReference(parsedName)
   466  }
   467  
   468  func MustParseParentReference(name string) *ParentReference {
   469  	result, err := ParseParentReference(name)
   470  	if err != nil {
   471  		panic(err)
   472  	}
   473  	return result
   474  }
   475  func (ref *ParentReference) GetProjectReference() *iam_project.Reference {
   476  	if ref == nil {
   477  		return nil
   478  	}
   479  
   480  	switch ref.Pattern {
   481  	case NamePattern_Project_Region:
   482  		return iam_project.NewNameBuilder().
   483  			SetId(ref.ProjectId).
   484  			Reference()
   485  	default:
   486  		return nil
   487  	}
   488  }
   489  func (ref *ParentReference) GetOrganizationReference() *iam_organization.Reference {
   490  	if ref == nil {
   491  		return nil
   492  	}
   493  
   494  	switch ref.Pattern {
   495  	case NamePattern_Organization_Region:
   496  		return iam_organization.NewNameBuilder().
   497  			SetId(ref.OrganizationId).
   498  			Reference()
   499  	default:
   500  		return nil
   501  	}
   502  }
   503  func (ref *ParentReference) GetServiceReference() *meta_service.Reference {
   504  	if ref == nil {
   505  		return nil
   506  	}
   507  
   508  	switch ref.Pattern {
   509  	case NamePattern_Service_Region:
   510  		return meta_service.NewNameBuilder().
   511  			SetId(ref.ServiceId).
   512  			Reference()
   513  	default:
   514  		return nil
   515  	}
   516  }
   517  
   518  func (ref *ParentReference) GetUnderlyingReference() gotenresource.Reference {
   519  	if ref == nil {
   520  		return nil
   521  	}
   522  	projectRef := ref.GetProjectReference()
   523  	if projectRef != nil {
   524  		return projectRef
   525  	}
   526  	organizationRef := ref.GetOrganizationReference()
   527  	if organizationRef != nil {
   528  		return organizationRef
   529  	}
   530  	serviceRef := ref.GetServiceReference()
   531  	if serviceRef != nil {
   532  		return serviceRef
   533  	}
   534  
   535  	return nil
   536  }
   537  
   538  func (ref *ParentReference) ResolveRaw(res gotenresource.Resource) error {
   539  	switch typedRes := res.(type) {
   540  	case *iam_project.Project:
   541  		if name := ref.GetProjectName(); name == nil {
   542  			return status.Errorf(codes.InvalidArgument, "cannot set Project as parent of Bucket, because pattern does not match")
   543  		}
   544  		ref.project = typedRes
   545  		return nil
   546  	case *iam_organization.Organization:
   547  		if name := ref.GetOrganizationName(); name == nil {
   548  			return status.Errorf(codes.InvalidArgument, "cannot set Organization as parent of Bucket, because pattern does not match")
   549  		}
   550  		ref.organization = typedRes
   551  		return nil
   552  	case *meta_service.Service:
   553  		if name := ref.GetServiceName(); name == nil {
   554  			return status.Errorf(codes.InvalidArgument, "cannot set Service as parent of Bucket, because pattern does not match")
   555  		}
   556  		ref.service = typedRes
   557  		return nil
   558  	default:
   559  		return status.Errorf(codes.Internal, "Invalid parent type for Bucket, got %s", reflect.TypeOf(res).Elem().Name())
   560  	}
   561  }
   562  
   563  func (ref *ParentReference) Resolved() bool {
   564  	if name := ref.GetProjectName(); name != nil {
   565  		return ref.project != nil
   566  	}
   567  	if name := ref.GetOrganizationName(); name != nil {
   568  		return ref.organization != nil
   569  	}
   570  	if name := ref.GetServiceName(); name != nil {
   571  		return ref.service != nil
   572  	}
   573  	return true
   574  }
   575  
   576  func (ref *ParentReference) ClearCached() {
   577  	ref.project = nil
   578  	ref.organization = nil
   579  	ref.service = nil
   580  }
   581  
   582  func (ref *ParentReference) GetProject() *iam_project.Project {
   583  	if ref == nil {
   584  		return nil
   585  	}
   586  	return ref.project
   587  }
   588  func (ref *ParentReference) GetOrganization() *iam_organization.Organization {
   589  	if ref == nil {
   590  		return nil
   591  	}
   592  	return ref.organization
   593  }
   594  func (ref *ParentReference) GetService() *meta_service.Service {
   595  	if ref == nil {
   596  		return nil
   597  	}
   598  	return ref.service
   599  }
   600  
   601  func (ref *ParentReference) GetRawResource() gotenresource.Resource {
   602  	if name := ref.ParentName.GetProjectName(); name != nil {
   603  		return ref.project
   604  	}
   605  	if name := ref.ParentName.GetOrganizationName(); name != nil {
   606  		return ref.organization
   607  	}
   608  	if name := ref.ParentName.GetServiceName(); name != nil {
   609  		return ref.service
   610  	}
   611  	return nil
   612  }
   613  
   614  func (ref *ParentReference) IsFullyQualified() bool {
   615  	if ref == nil {
   616  		return false
   617  	}
   618  	return ref.ParentName.IsFullyQualified()
   619  }
   620  
   621  func (ref *ParentReference) IsSpecified() bool {
   622  	if ref == nil {
   623  		return false
   624  	}
   625  	return ref.ParentName.IsSpecified()
   626  }
   627  
   628  func (ref *ParentReference) GetResourceDescriptor() gotenresource.Descriptor {
   629  	return descriptor
   630  }
   631  
   632  func (ref *ParentReference) GetPattern() gotenresource.NamePattern {
   633  	if ref == nil {
   634  		return ""
   635  	}
   636  	return ref.Pattern
   637  }
   638  
   639  func (ref *ParentReference) GetIdParts() map[string]string {
   640  	if ref != nil {
   641  		return ref.ParentName.GetIdParts()
   642  	}
   643  	return map[string]string{
   644  		"projectId":      "",
   645  		"regionId":       "",
   646  		"organizationId": "",
   647  		"serviceId":      "",
   648  	}
   649  }
   650  
   651  func (ref *ParentReference) GetSegments() gotenresource.NameSegments {
   652  	if ref != nil {
   653  		return ref.ParentName.GetSegments()
   654  	}
   655  	return nil
   656  }
   657  
   658  func (ref *ParentReference) GetIParentName() gotenresource.Name {
   659  	return nil
   660  }
   661  
   662  func (ref *ParentReference) GetIUnderlyingParentName() gotenresource.Name {
   663  	return nil
   664  }
   665  
   666  func (ref *ParentReference) String() string {
   667  	if ref == nil {
   668  		return "<nil>"
   669  	}
   670  	return ref.ParentName.String()
   671  }
   672  
   673  // implement methods required by protobuf-go library for string-struct conversion
   674  
   675  func (ref *ParentReference) ProtoString() (string, error) {
   676  	if ref == nil {
   677  		return "", nil
   678  	}
   679  	return ref.ParentName.ProtoString()
   680  }
   681  
   682  func (ref *ParentReference) ParseProtoString(data string) error {
   683  	parsed, err := ParseParentReference(data)
   684  	if err != nil {
   685  		return err
   686  	}
   687  	*ref = *parsed
   688  	return nil
   689  }
   690  
   691  // GotenEqual returns true if other is of same type and paths are equal (implements goten.Equaler interface)
   692  func (ref *ParentReference) GotenEqual(other interface{}) bool {
   693  	if other == nil {
   694  		return ref == nil
   695  	}
   696  	other1, ok := other.(*ParentReference)
   697  	if !ok {
   698  		other2, ok := other.(ParentReference)
   699  		if ok {
   700  			other1 = &other2
   701  		} else {
   702  			return false
   703  		}
   704  	}
   705  	if other1 == nil {
   706  		return ref == nil
   707  	} else if ref == nil {
   708  		return false
   709  	}
   710  	if ref.project != other1.project {
   711  		return false
   712  	}
   713  	if ref.organization != other1.organization {
   714  		return false
   715  	}
   716  	if ref.service != other1.service {
   717  		return false
   718  	}
   719  
   720  	return ref.ParentName.GotenEqual(other1.ParentName)
   721  }
   722  
   723  // Matches is same as GotenEqual, but also will accept "other" if name is wildcard.
   724  func (name *ParentReference) Matches(other interface{}) bool {
   725  	if other == nil {
   726  		return name == nil
   727  	}
   728  	other1, ok := other.(*ParentReference)
   729  	if !ok {
   730  		other2, ok := other.(ParentReference)
   731  		if ok {
   732  			other1 = &other2
   733  		} else {
   734  			return false
   735  		}
   736  	}
   737  	if other1 == nil {
   738  		return name == nil
   739  	} else if name == nil {
   740  		return false
   741  	}
   742  	return name.ParentName.Matches(&other1.ParentName)
   743  }
   744  
   745  // implement CustomTypeCliValue method
   746  func (ref *ParentReference) SetFromCliFlag(raw string) error {
   747  	parsedRef, err := ParseParentReference(raw)
   748  	if err != nil {
   749  		return err
   750  	}
   751  	*ref = *parsedRef
   752  	return nil
   753  }