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

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