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

     1  // Code generated by protoc-gen-goten-resource
     2  // Resource: Condition
     3  // DO NOT EDIT!!!
     4  
     5  package condition
     6  
     7  import (
     8  	googlefieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
     9  
    10  	"github.com/cloudwan/goten-sdk/types/view"
    11  )
    12  
    13  // proto imports
    14  import (
    15  	attestation_domain "github.com/cloudwan/edgelq-sdk/iam/resources/v1/attestation_domain"
    16  	organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    17  	permission "github.com/cloudwan/edgelq-sdk/iam/resources/v1/permission"
    18  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    19  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    20  	meta "github.com/cloudwan/goten-sdk/types/meta"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = googlefieldmaskpb.FieldMask{}
    26  
    27  	_ = view.View_UNSPECIFIED
    28  )
    29  
    30  // make sure we're using proto imports
    31  var (
    32  	_ = &attestation_domain.AttestationDomain{}
    33  	_ = &organization.Organization{}
    34  	_ = &permission.Permission{}
    35  	_ = &project.Project{}
    36  	_ = &meta_service.Service{}
    37  	_ = &meta.Meta{}
    38  )
    39  
    40  func ResourceViewFieldMask(viewName view.View, extraMask *Condition_FieldMask) *Condition_FieldMask {
    41  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
    42  
    43  	switch viewName {
    44  	case view.View_UNSPECIFIED:
    45  		return extraMask
    46  	case view.View_FULL:
    47  		return nil
    48  	case view.View_NAME:
    49  		protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "display_name")
    50  		break
    51  	default:
    52  		return extraMask
    53  	}
    54  	if extraMask != nil {
    55  		protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...)
    56  	}
    57  	res := &Condition_FieldMask{}
    58  	_ = res.FromProtoFieldMask(protoFieldMask)
    59  	return res
    60  }