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

     1  // Code generated by protoc-gen-goten-resource
     2  // Resource: PlanAssignment
     3  // DO NOT EDIT!!!
     4  
     5  package plan_assignment
     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  	iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    16  	iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    17  	accepted_plan "github.com/cloudwan/edgelq-sdk/limits/resources/v1/accepted_plan"
    18  	common "github.com/cloudwan/edgelq-sdk/limits/resources/v1/common"
    19  	plan "github.com/cloudwan/edgelq-sdk/limits/resources/v1/plan"
    20  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    21  	meta "github.com/cloudwan/goten-sdk/types/meta"
    22  )
    23  
    24  // ensure the imports are used
    25  var (
    26  	_ = googlefieldmaskpb.FieldMask{}
    27  
    28  	_ = view.View_UNSPECIFIED
    29  )
    30  
    31  // make sure we're using proto imports
    32  var (
    33  	_ = &iam_organization.Organization{}
    34  	_ = &iam_project.Project{}
    35  	_ = &accepted_plan.AcceptedPlan{}
    36  	_ = &common.RegionalPlanAssignment{}
    37  	_ = &plan.Plan{}
    38  	_ = &meta_service.Service{}
    39  	_ = &meta.Meta{}
    40  )
    41  
    42  func ResourceViewFieldMask(viewName view.View, extraMask *PlanAssignment_FieldMask) *PlanAssignment_FieldMask {
    43  	protoFieldMask := &googlefieldmaskpb.FieldMask{}
    44  
    45  	switch viewName {
    46  	case view.View_UNSPECIFIED:
    47  		return extraMask
    48  	case view.View_FULL:
    49  		return nil
    50  	case view.View_BASIC:
    51  		protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "default_regional_plan", "service")
    52  		break
    53  	case view.View_DETAIL:
    54  		protoFieldMask.Paths = append(protoFieldMask.Paths, "name", "default_regional_plan", "service", "extensions", "regional_plan_overrides")
    55  		break
    56  	case view.View_NAME:
    57  		protoFieldMask.Paths = append(protoFieldMask.Paths, "name")
    58  		break
    59  	default:
    60  		return extraMask
    61  	}
    62  	if extraMask != nil {
    63  		protoFieldMask.Paths = append(protoFieldMask.Paths, extraMask.ToProtoFieldMask().Paths...)
    64  	}
    65  	res := &PlanAssignment_FieldMask{}
    66  	_ = res.FromProtoFieldMask(protoFieldMask)
    67  	return res
    68  }